1; Bitcode compatibility test for llvm 6.0.0 2; 3; N.b: This is 6.0-compatible IR. The CHECK lines occasionally differ from 4; the IR used to generate the bitcode, and may need to be updated. 5 6; RUN: opt -verify -disable-output < %s.bc 7; RUN: llvm-dis < %s.bc | FileCheck %s 8 9target datalayout = "E" 10; CHECK: target datalayout = "E" 11 12target triple = "x86_64-apple-macosx10.10.0" 13; CHECK: target triple = "x86_64-apple-macosx10.10.0" 14 15;; Module-level assembly 16module asm "beep boop" 17; CHECK: module asm "beep boop" 18 19;; Comdats 20$comdat.any = comdat any 21; CHECK: $comdat.any = comdat any 22$comdat.exactmatch = comdat exactmatch 23; CHECK: $comdat.exactmatch = comdat exactmatch 24$comdat.largest = comdat largest 25; CHECK: $comdat.largest = comdat largest 26$comdat.noduplicates = comdat noduplicates 27; CHECK: $comdat.noduplicates = comdat noduplicates 28$comdat.samesize = comdat samesize 29; CHECK: $comdat.samesize = comdat samesize 30 31;; Constants 32@const.true = constant i1 true 33; CHECK: @const.true = constant i1 true 34@const.false = constant i1 false 35; CHECK: @const.false = constant i1 false 36@const.int = constant i32 zeroinitializer 37; CHECK: @const.int = constant i32 0 38@const.float = constant double 0.0 39; CHECK: @const.float = constant double 0.0 40@const.null = constant i8* null 41; CHECK: @const.null = constant i8* null 42%const.struct.type = type { i32, i8 } 43%const.struct.type.packed = type <{ i32, i8 }> 44@const.struct = constant %const.struct.type { i32 -1, i8 undef } 45; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef } 46@const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }> 47; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }> 48 49; CHECK: @constant.array.i8 = constant [3 x i8] c"\00\01\00" 50@constant.array.i8 = constant [3 x i8] [i8 -0, i8 1, i8 0] 51; CHECK: @constant.array.i16 = constant [3 x i16] [i16 0, i16 1, i16 0] 52@constant.array.i16 = constant [3 x i16] [i16 -0, i16 1, i16 0] 53; CHECK: @constant.array.i32 = constant [3 x i32] [i32 0, i32 1, i32 0] 54@constant.array.i32 = constant [3 x i32] [i32 -0, i32 1, i32 0] 55; CHECK: @constant.array.i64 = constant [3 x i64] [i64 0, i64 1, i64 0] 56@constant.array.i64 = constant [3 x i64] [i64 -0, i64 1, i64 0] 57; CHECK: @constant.array.f16 = constant [3 x half] [half 0xH8000, half 0xH3C00, half 0xH0000] 58@constant.array.f16 = constant [3 x half] [half -0.0, half 1.0, half 0.0] 59; CHECK: @constant.array.f32 = constant [3 x float] [float -0.000000e+00, float 1.000000e+00, float 0.000000e+00] 60@constant.array.f32 = constant [3 x float] [float -0.0, float 1.0, float 0.0] 61; CHECK: @constant.array.f64 = constant [3 x double] [double -0.000000e+00, double 1.000000e+00, double 0.000000e+00] 62@constant.array.f64 = constant [3 x double] [double -0.0, double 1.0, double 0.0] 63 64; CHECK: @constant.vector.i8 = constant <3 x i8> <i8 0, i8 1, i8 0> 65@constant.vector.i8 = constant <3 x i8> <i8 -0, i8 1, i8 0> 66; CHECK: @constant.vector.i16 = constant <3 x i16> <i16 0, i16 1, i16 0> 67@constant.vector.i16 = constant <3 x i16> <i16 -0, i16 1, i16 0> 68; CHECK: @constant.vector.i32 = constant <3 x i32> <i32 0, i32 1, i32 0> 69@constant.vector.i32 = constant <3 x i32> <i32 -0, i32 1, i32 0> 70; CHECK: @constant.vector.i64 = constant <3 x i64> <i64 0, i64 1, i64 0> 71@constant.vector.i64 = constant <3 x i64> <i64 -0, i64 1, i64 0> 72; CHECK: @constant.vector.f16 = constant <3 x half> <half 0xH8000, half 0xH3C00, half 0xH0000> 73@constant.vector.f16 = constant <3 x half> <half -0.0, half 1.0, half 0.0> 74; CHECK: @constant.vector.f32 = constant <3 x float> <float -0.000000e+00, float 1.000000e+00, float 0.000000e+00> 75@constant.vector.f32 = constant <3 x float> <float -0.0, float 1.0, float 0.0> 76; CHECK: @constant.vector.f64 = constant <3 x double> <double -0.000000e+00, double 1.000000e+00, double 0.000000e+00> 77@constant.vector.f64 = constant <3 x double> <double -0.0, double 1.0, double 0.0> 78 79;; Global Variables 80; Format: [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass] 81; [ThreadLocal] [(unnamed_addr|local_unnamed_addr)] [AddrSpace] [ExternallyInitialized] 82; <global | constant> <Type> [<InitializerConstant>] 83; [, section "name"] [, comdat [($name)]] [, align <Alignment>] 84 85; Global Variables -- Simple 86@g1 = global i32 0 87; CHECK: @g1 = global i32 0 88@g2 = constant i32 0 89; CHECK: @g2 = constant i32 0 90 91; Global Variables -- Linkage 92@g.private = private global i32 0 93; CHECK: @g.private = private global i32 0 94@g.internal = internal global i32 0 95; CHECK: @g.internal = internal global i32 0 96@g.available_externally = available_externally global i32 0 97; CHECK: @g.available_externally = available_externally global i32 0 98@g.linkonce = linkonce global i32 0 99; CHECK: @g.linkonce = linkonce global i32 0 100@g.weak = weak global i32 0 101; CHECK: @g.weak = weak global i32 0 102@g.common = common global i32 0 103; CHECK: @g.common = common global i32 0 104@g.appending = appending global [4 x i8] c"test" 105; CHECK: @g.appending = appending global [4 x i8] c"test" 106@g.extern_weak = extern_weak global i32 107; CHECK: @g.extern_weak = extern_weak global i32 108@g.linkonce_odr = linkonce_odr global i32 0 109; CHECK: @g.linkonce_odr = linkonce_odr global i32 0 110@g.weak_odr = weak_odr global i32 0 111; CHECK: @g.weak_odr = weak_odr global i32 0 112@g.external = external global i32 113; CHECK: @g.external = external global i32 114 115; Global Variables -- Visibility 116@g.default = default global i32 0 117; CHECK: @g.default = global i32 0 118@g.hidden = hidden global i32 0 119; CHECK: @g.hidden = hidden global i32 0 120@g.protected = protected global i32 0 121; CHECK: @g.protected = protected global i32 0 122 123; Global Variables -- DLLStorageClass 124@g.dlldefault = default global i32 0 125; CHECK: @g.dlldefault = global i32 0 126@g.dllimport = external dllimport global i32 127; CHECK: @g.dllimport = external dllimport global i32 128@g.dllexport = dllexport global i32 0 129; CHECK: @g.dllexport = dllexport global i32 0 130 131; Global Variables -- ThreadLocal 132@g.notthreadlocal = global i32 0 133; CHECK: @g.notthreadlocal = global i32 0 134@g.generaldynamic = thread_local global i32 0 135; CHECK: @g.generaldynamic = thread_local global i32 0 136@g.localdynamic = thread_local(localdynamic) global i32 0 137; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0 138@g.initialexec = thread_local(initialexec) global i32 0 139; CHECK: @g.initialexec = thread_local(initialexec) global i32 0 140@g.localexec = thread_local(localexec) global i32 0 141; CHECK: @g.localexec = thread_local(localexec) global i32 0 142 143; Global Variables -- unnamed_addr and local_unnamed_addr 144@g.unnamed_addr = unnamed_addr global i32 0 145; CHECK: @g.unnamed_addr = unnamed_addr global i32 0 146@g.local_unnamed_addr = local_unnamed_addr global i32 0 147; CHECK: @g.local_unnamed_addr = local_unnamed_addr global i32 0 148 149; Global Variables -- AddrSpace 150@g.addrspace = addrspace(1) global i32 0 151; CHECK: @g.addrspace = addrspace(1) global i32 0 152 153; Global Variables -- ExternallyInitialized 154@g.externally_initialized = external externally_initialized global i32 155; CHECK: @g.externally_initialized = external externally_initialized global i32 156 157; Global Variables -- section 158@g.section = global i32 0, section "_DATA" 159; CHECK: @g.section = global i32 0, section "_DATA" 160 161; Global Variables -- comdat 162@comdat.any = global i32 0, comdat 163; CHECK: @comdat.any = global i32 0, comdat 164@comdat.exactmatch = global i32 0, comdat 165; CHECK: @comdat.exactmatch = global i32 0, comdat 166@comdat.largest = global i32 0, comdat 167; CHECK: @comdat.largest = global i32 0, comdat 168@comdat.noduplicates = global i32 0, comdat 169; CHECK: @comdat.noduplicates = global i32 0, comdat 170@comdat.samesize = global i32 0, comdat 171; CHECK: @comdat.samesize = global i32 0, comdat 172 173; Force two globals from different comdats into sections with the same name. 174$comdat1 = comdat any 175$comdat2 = comdat any 176@g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1) 177; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1) 178@g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2) 179; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2) 180 181; Global Variables -- align 182@g.align = global i32 0, align 4 183; CHECK: @g.align = global i32 0, align 4 184 185; Global Variables -- Intrinsics 186%pri.func.data = type { i32, void ()*, i8* } 187@g.used1 = global i32 0 188@g.used2 = global i32 0 189@g.used3 = global i8 0 190declare void @g.f1() 191@llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata" 192; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata" 193@llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata" 194; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata" 195@llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata" 196; CHECK: @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata" 197@llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata" 198; CHECK: @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata" 199 200;; Aliases 201; Format: @<Name> = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal] 202; [unnamed_addr] alias <AliaseeTy> @<Aliasee> 203 204; Aliases -- Linkage 205@a.private = private alias i32, i32* @g.private 206; CHECK: @a.private = private alias i32, i32* @g.private 207@a.internal = internal alias i32, i32* @g.internal 208; CHECK: @a.internal = internal alias i32, i32* @g.internal 209@a.linkonce = linkonce alias i32, i32* @g.linkonce 210; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce 211@a.weak = weak alias i32, i32* @g.weak 212; CHECK: @a.weak = weak alias i32, i32* @g.weak 213@a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr 214; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr 215@a.weak_odr = weak_odr alias i32, i32* @g.weak_odr 216; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr 217@a.external = external alias i32, i32* @g1 218; CHECK: @a.external = alias i32, i32* @g1 219 220; Aliases -- Visibility 221@a.default = default alias i32, i32* @g.default 222; CHECK: @a.default = alias i32, i32* @g.default 223@a.hidden = hidden alias i32, i32* @g.hidden 224; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden 225@a.protected = protected alias i32, i32* @g.protected 226; CHECK: @a.protected = protected alias i32, i32* @g.protected 227 228; Aliases -- DLLStorageClass 229@a.dlldefault = default alias i32, i32* @g.dlldefault 230; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault 231@a.dllexport = dllexport alias i32, i32* @g.dllexport 232; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport 233 234; Aliases -- ThreadLocal 235@a.notthreadlocal = alias i32, i32* @g.notthreadlocal 236; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal 237@a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic 238; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic 239@a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic 240; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic 241@a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec 242; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec 243@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec 244; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec 245 246; Aliases -- unnamed_addr and local_unnamed_addr 247@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr 248; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr 249@a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr 250; CHECK: @a.local_unnamed_addr = local_unnamed_addr alias i32, i32* @g.local_unnamed_addr 251 252;; IFunc 253; Format @<Name> = [Linkage] [Visibility] ifunc <IFuncTy>, 254; <ResolverTy>* @<Resolver> 255 256; IFunc -- Linkage 257@ifunc.external = external ifunc void (), i8* ()* @ifunc_resolver 258; CHECK: @ifunc.external = ifunc void (), i8* ()* @ifunc_resolver 259@ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver 260; CHECK: @ifunc.private = private ifunc void (), i8* ()* @ifunc_resolver 261@ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver 262; CHECK: @ifunc.internal = internal ifunc void (), i8* ()* @ifunc_resolver 263 264; IFunc -- Visibility 265@ifunc.default = default ifunc void (), i8* ()* @ifunc_resolver 266; CHECK: @ifunc.default = ifunc void (), i8* ()* @ifunc_resolver 267@ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver 268; CHECK: @ifunc.hidden = hidden ifunc void (), i8* ()* @ifunc_resolver 269@ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver 270; CHECK: @ifunc.protected = protected ifunc void (), i8* ()* @ifunc_resolver 271 272define i8* @ifunc_resolver() { 273entry: 274 ret i8* null 275} 276 277;; Functions 278; Format: define [linkage] [visibility] [DLLStorageClass] 279; [cconv] [ret attrs] 280; <ResultType> @<FunctionName> ([argument list]) 281; [(unnamed_addr|local_unnamed_addr)] [fn Attrs] [section "name"] [comdat [($name)]] 282; [align N] [gc] [prefix Constant] [prologue Constant] 283; [personality Constant] { ... } 284 285; Functions -- Simple 286declare void @f1 () 287; CHECK: declare void @f1() 288 289define void @f2 () { 290; CHECK: define void @f2() 291entry: 292 ret void 293} 294 295; Functions -- linkage 296define private void @f.private() { 297; CHECK: define private void @f.private() 298entry: 299 ret void 300} 301define internal void @f.internal() { 302; CHECK: define internal void @f.internal() 303entry: 304 ret void 305} 306define available_externally void @f.available_externally() { 307; CHECK: define available_externally void @f.available_externally() 308entry: 309 ret void 310} 311define linkonce void @f.linkonce() { 312; CHECK: define linkonce void @f.linkonce() 313entry: 314 ret void 315} 316define weak void @f.weak() { 317; CHECK: define weak void @f.weak() 318entry: 319 ret void 320} 321define linkonce_odr void @f.linkonce_odr() { 322; CHECK: define linkonce_odr void @f.linkonce_odr() 323entry: 324 ret void 325} 326define weak_odr void @f.weak_odr() { 327; CHECK: define weak_odr void @f.weak_odr() 328entry: 329 ret void 330} 331declare external void @f.external() 332; CHECK: declare void @f.external() 333declare extern_weak void @f.extern_weak() 334; CHECK: declare extern_weak void @f.extern_weak() 335 336; Functions -- visibility 337declare default void @f.default() 338; CHECK: declare void @f.default() 339declare hidden void @f.hidden() 340; CHECK: declare hidden void @f.hidden() 341declare protected void @f.protected() 342; CHECK: declare protected void @f.protected() 343 344; Functions -- DLLStorageClass 345declare dllimport void @f.dllimport() 346; CHECK: declare dllimport void @f.dllimport() 347declare dllexport void @f.dllexport() 348; CHECK: declare dllexport void @f.dllexport() 349 350; Functions -- cconv (Calling conventions) 351declare ccc void @f.ccc() 352; CHECK: declare void @f.ccc() 353declare fastcc void @f.fastcc() 354; CHECK: declare fastcc void @f.fastcc() 355declare coldcc void @f.coldcc() 356; CHECK: declare coldcc void @f.coldcc() 357declare cc10 void @f.cc10() 358; CHECK: declare ghccc void @f.cc10() 359declare ghccc void @f.ghccc() 360; CHECK: declare ghccc void @f.ghccc() 361declare cc11 void @f.cc11() 362; CHECK: declare cc11 void @f.cc11() 363declare webkit_jscc void @f.webkit_jscc() 364; CHECK: declare webkit_jscc void @f.webkit_jscc() 365declare anyregcc void @f.anyregcc() 366; CHECK: declare anyregcc void @f.anyregcc() 367declare preserve_mostcc void @f.preserve_mostcc() 368; CHECK: declare preserve_mostcc void @f.preserve_mostcc() 369declare preserve_allcc void @f.preserve_allcc() 370; CHECK: declare preserve_allcc void @f.preserve_allcc() 371declare cc64 void @f.cc64() 372; CHECK: declare x86_stdcallcc void @f.cc64() 373declare x86_stdcallcc void @f.x86_stdcallcc() 374; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc() 375declare cc65 void @f.cc65() 376; CHECK: declare x86_fastcallcc void @f.cc65() 377declare x86_fastcallcc void @f.x86_fastcallcc() 378; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc() 379declare cc66 void @f.cc66() 380; CHECK: declare arm_apcscc void @f.cc66() 381declare arm_apcscc void @f.arm_apcscc() 382; CHECK: declare arm_apcscc void @f.arm_apcscc() 383declare cc67 void @f.cc67() 384; CHECK: declare arm_aapcscc void @f.cc67() 385declare arm_aapcscc void @f.arm_aapcscc() 386; CHECK: declare arm_aapcscc void @f.arm_aapcscc() 387declare cc68 void @f.cc68() 388; CHECK: declare arm_aapcs_vfpcc void @f.cc68() 389declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc() 390; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc() 391declare cc69 void @f.cc69() 392; CHECK: declare msp430_intrcc void @f.cc69() 393declare msp430_intrcc void @f.msp430_intrcc() 394; CHECK: declare msp430_intrcc void @f.msp430_intrcc() 395declare cc70 void @f.cc70() 396; CHECK: declare x86_thiscallcc void @f.cc70() 397declare x86_thiscallcc void @f.x86_thiscallcc() 398; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc() 399declare cc71 void @f.cc71() 400; CHECK: declare ptx_kernel void @f.cc71() 401declare ptx_kernel void @f.ptx_kernel() 402; CHECK: declare ptx_kernel void @f.ptx_kernel() 403declare cc72 void @f.cc72() 404; CHECK: declare ptx_device void @f.cc72() 405declare ptx_device void @f.ptx_device() 406; CHECK: declare ptx_device void @f.ptx_device() 407declare cc75 void @f.cc75() 408; CHECK: declare spir_func void @f.cc75() 409declare spir_func void @f.spir_func() 410; CHECK: declare spir_func void @f.spir_func() 411declare cc76 void @f.cc76() 412; CHECK: declare spir_kernel void @f.cc76() 413declare spir_kernel void @f.spir_kernel() 414; CHECK: declare spir_kernel void @f.spir_kernel() 415declare cc77 void @f.cc77() 416; CHECK: declare intel_ocl_bicc void @f.cc77() 417declare intel_ocl_bicc void @f.intel_ocl_bicc() 418; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc() 419declare cc78 void @f.cc78() 420; CHECK: declare x86_64_sysvcc void @f.cc78() 421declare x86_64_sysvcc void @f.x86_64_sysvcc() 422; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc() 423declare cc79 void @f.cc79() 424; CHECK: declare win64cc void @f.cc79() 425declare win64cc void @f.win64cc() 426; CHECK: declare win64cc void @f.win64cc() 427declare cc80 void @f.cc80() 428; CHECK: declare x86_vectorcallcc void @f.cc80() 429declare x86_vectorcallcc void @f.x86_vectorcallcc() 430; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc() 431declare cc81 void @f.cc81() 432; CHECK: declare hhvmcc void @f.cc81() 433declare hhvmcc void @f.hhvmcc() 434; CHECK: declare hhvmcc void @f.hhvmcc() 435declare cc82 void @f.cc82() 436; CHECK: declare hhvm_ccc void @f.cc82() 437declare hhvm_ccc void @f.hhvm_ccc() 438; CHECK: declare hhvm_ccc void @f.hhvm_ccc() 439declare cc83 void @f.cc83() 440; CHECK: declare x86_intrcc void @f.cc83() 441declare x86_intrcc void @f.x86_intrcc() 442; CHECK: declare x86_intrcc void @f.x86_intrcc() 443declare cc84 void @f.cc84() 444; CHECK: declare avr_intrcc void @f.cc84() 445declare avr_intrcc void @f.avr_intrcc() 446; CHECK: declare avr_intrcc void @f.avr_intrcc() 447declare cc85 void @f.cc85() 448; CHECK: declare avr_signalcc void @f.cc85() 449declare avr_signalcc void @f.avr_signalcc() 450; CHECK: declare avr_signalcc void @f.avr_signalcc() 451declare cc87 void @f.cc87() 452; CHECK: declare amdgpu_vs void @f.cc87() 453declare amdgpu_vs void @f.amdgpu_vs() 454; CHECK: declare amdgpu_vs void @f.amdgpu_vs() 455declare cc88 void @f.cc88() 456; CHECK: declare amdgpu_gs void @f.cc88() 457declare amdgpu_gs void @f.amdgpu_gs() 458; CHECK: declare amdgpu_gs void @f.amdgpu_gs() 459declare cc89 void @f.cc89() 460; CHECK: declare amdgpu_ps void @f.cc89() 461declare amdgpu_ps void @f.amdgpu_ps() 462; CHECK: declare amdgpu_ps void @f.amdgpu_ps() 463declare cc90 void @f.cc90() 464; CHECK: declare amdgpu_cs void @f.cc90() 465declare amdgpu_cs void @f.amdgpu_cs() 466; CHECK: declare amdgpu_cs void @f.amdgpu_cs() 467declare cc91 void @f.cc91() 468; CHECK: declare amdgpu_kernel void @f.cc91() 469declare amdgpu_kernel void @f.amdgpu_kernel() 470; CHECK: declare amdgpu_kernel void @f.amdgpu_kernel() 471declare cc93 void @f.cc93() 472; CHECK: declare amdgpu_hs void @f.cc93() 473declare amdgpu_hs void @f.amdgpu_hs() 474; CHECK: declare amdgpu_hs void @f.amdgpu_hs() 475declare cc95 void @f.cc95() 476; CHECK: declare amdgpu_ls void @f.cc95() 477declare amdgpu_ls void @f.amdgpu_ls() 478; CHECK: declare amdgpu_ls void @f.amdgpu_ls() 479declare cc96 void @f.cc96() 480; CHECK: declare amdgpu_es void @f.cc96() 481declare amdgpu_es void @f.amdgpu_es() 482; CHECK: declare amdgpu_es void @f.amdgpu_es() 483declare cc1023 void @f.cc1023() 484; CHECK: declare cc1023 void @f.cc1023() 485 486; Functions -- ret attrs (Return attributes) 487declare zeroext i64 @f.zeroext() 488; CHECK: declare zeroext i64 @f.zeroext() 489declare signext i64 @f.signext() 490; CHECK: declare signext i64 @f.signext() 491declare inreg i32* @f.inreg() 492; CHECK: declare inreg i32* @f.inreg() 493declare noalias i32* @f.noalias() 494; CHECK: declare noalias i32* @f.noalias() 495declare nonnull i32* @f.nonnull() 496; CHECK: declare nonnull i32* @f.nonnull() 497declare dereferenceable(4) i32* @f.dereferenceable4() 498; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4() 499declare dereferenceable(8) i32* @f.dereferenceable8() 500; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8() 501declare dereferenceable(16) i32* @f.dereferenceable16() 502; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16() 503declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null() 504; CHECK: declare dereferenceable_or_null(4) i32* @f.dereferenceable4_or_null() 505declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null() 506; CHECK: declare dereferenceable_or_null(8) i32* @f.dereferenceable8_or_null() 507declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null() 508; CHECK: declare dereferenceable_or_null(16) i32* @f.dereferenceable16_or_null() 509 510; Functions -- Parameter attributes 511declare void @f.param.zeroext(i8 zeroext) 512; CHECK: declare void @f.param.zeroext(i8 zeroext) 513declare void @f.param.signext(i8 signext) 514; CHECK: declare void @f.param.signext(i8 signext) 515declare void @f.param.inreg(i8 inreg) 516; CHECK: declare void @f.param.inreg(i8 inreg) 517declare void @f.param.byval({ i8, i8 }* byval({ i8, i8 })) 518; CHECK: declare void @f.param.byval({ i8, i8 }* byval({ i8, i8 })) 519declare void @f.param.inalloca(i8* inalloca) 520; CHECK: declare void @f.param.inalloca(i8* inalloca) 521declare void @f.param.sret(i8* sret(i8)) 522; CHECK: declare void @f.param.sret(i8* sret(i8)) 523declare void @f.param.noalias(i8* noalias) 524; CHECK: declare void @f.param.noalias(i8* noalias) 525declare void @f.param.nocapture(i8* nocapture) 526; CHECK: declare void @f.param.nocapture(i8* nocapture) 527declare void @f.param.nest(i8* nest) 528; CHECK: declare void @f.param.nest(i8* nest) 529declare i8* @f.param.returned(i8* returned) 530; CHECK: declare i8* @f.param.returned(i8* returned) 531declare void @f.param.nonnull(i8* nonnull) 532; CHECK: declare void @f.param.nonnull(i8* nonnull) 533declare void @f.param.dereferenceable(i8* dereferenceable(4)) 534; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4)) 535declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4)) 536; CHECK: declare void @f.param.dereferenceable_or_null(i8* dereferenceable_or_null(4)) 537 538; Functions -- unnamed_addr and local_unnamed_addr 539declare void @f.unnamed_addr() unnamed_addr 540; CHECK: declare void @f.unnamed_addr() unnamed_addr 541declare void @f.local_unnamed_addr() local_unnamed_addr 542; CHECK: declare void @f.local_unnamed_addr() local_unnamed_addr 543 544; Functions -- fn Attrs (Function attributes) 545declare void @f.alignstack4() alignstack(4) 546; CHECK: declare void @f.alignstack4() #0 547declare void @f.alignstack8() alignstack(8) 548; CHECK: declare void @f.alignstack8() #1 549declare void @f.alwaysinline() alwaysinline 550; CHECK: declare void @f.alwaysinline() #2 551declare void @f.cold() cold 552; CHECK: declare void @f.cold() #3 553declare void @f.convergent() convergent 554; CHECK: declare void @f.convergent() #4 555declare void @f.inlinehint() inlinehint 556; CHECK: declare void @f.inlinehint() #5 557declare void @f.jumptable() unnamed_addr jumptable 558; CHECK: declare void @f.jumptable() unnamed_addr #6 559declare void @f.minsize() minsize 560; CHECK: declare void @f.minsize() #7 561declare void @f.naked() naked 562; CHECK: declare void @f.naked() #8 563declare void @f.nobuiltin() nobuiltin 564; CHECK: declare void @f.nobuiltin() #9 565declare void @f.noduplicate() noduplicate 566; CHECK: declare void @f.noduplicate() #10 567declare void @f.noimplicitfloat() noimplicitfloat 568; CHECK: declare void @f.noimplicitfloat() #11 569declare void @f.noinline() noinline 570; CHECK: declare void @f.noinline() #12 571declare void @f.nonlazybind() nonlazybind 572; CHECK: declare void @f.nonlazybind() #13 573declare void @f.noredzone() noredzone 574; CHECK: declare void @f.noredzone() #14 575declare void @f.noreturn() noreturn 576; CHECK: declare void @f.noreturn() #15 577declare void @f.nounwind() nounwind 578; CHECK: declare void @f.nounwind() #16 579declare void @f.optnone() noinline optnone 580; CHECK: declare void @f.optnone() #17 581declare void @f.optsize() optsize 582; CHECK: declare void @f.optsize() #18 583declare void @f.readnone() readnone 584; CHECK: declare void @f.readnone() #19 585declare void @f.readonly() readonly 586; CHECK: declare void @f.readonly() #20 587declare void @f.returns_twice() returns_twice 588; CHECK: declare void @f.returns_twice() #21 589declare void @f.safestack() safestack 590; CHECK: declare void @f.safestack() #22 591declare void @f.sanitize_address() sanitize_address 592; CHECK: declare void @f.sanitize_address() #23 593declare void @f.sanitize_memory() sanitize_memory 594; CHECK: declare void @f.sanitize_memory() #24 595declare void @f.sanitize_thread() sanitize_thread 596; CHECK: declare void @f.sanitize_thread() #25 597declare void @f.ssp() ssp 598; CHECK: declare void @f.ssp() #26 599declare void @f.sspreq() sspreq 600; CHECK: declare void @f.sspreq() #27 601declare void @f.sspstrong() sspstrong 602; CHECK: declare void @f.sspstrong() #28 603declare void @f.thunk() "thunk" 604; CHECK: declare void @f.thunk() #29 605declare void @f.uwtable() uwtable 606; CHECK: declare void @f.uwtable() #30 607declare void @f.kvpair() "cpu"="cortex-a8" 608; CHECK:declare void @f.kvpair() #31 609declare void @f.norecurse() norecurse 610; CHECK: declare void @f.norecurse() #32 611declare void @f.inaccessiblememonly() inaccessiblememonly 612; CHECK: declare void @f.inaccessiblememonly() #33 613declare void @f.inaccessiblemem_or_argmemonly() inaccessiblemem_or_argmemonly 614; CHECK: declare void @f.inaccessiblemem_or_argmemonly() #34 615declare void @f.strictfp() #35 616 617; Functions -- section 618declare void @f.section() section "80" 619; CHECK: declare void @f.section() section "80" 620 621; Functions -- comdat 622define void @f.comdat_any() comdat($comdat.any) { 623; CHECK: define void @f.comdat_any() comdat($comdat.any) 624entry: 625 ret void 626} 627define void @f.comdat_exactmatch() comdat($comdat.exactmatch) { 628; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch) 629entry: 630 ret void 631} 632define void @f.comdat_largest() comdat($comdat.largest) { 633; CHECK: define void @f.comdat_largest() comdat($comdat.largest) 634entry: 635 ret void 636} 637define void @f.comdat_noduplicates() comdat($comdat.noduplicates) { 638; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates) 639entry: 640 ret void 641} 642define void @f.comdat_samesize() comdat($comdat.samesize) { 643; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize) 644entry: 645 ret void 646} 647 648; Functions -- align 649declare void @f.align2() align 2 650; CHECK: declare void @f.align2() align 2 651declare void @f.align4() align 4 652; CHECK: declare void @f.align4() align 4 653declare void @f.align8() align 8 654; CHECK: declare void @f.align8() align 8 655 656; Functions -- GC 657declare void @f.gcshadow() gc "shadow-stack" 658; CHECK: declare void @f.gcshadow() gc "shadow-stack" 659 660; Functions -- Prefix data 661declare void @f.prefixi32() prefix i32 1684365668 662; CHECK: declare void @f.prefixi32() prefix i32 1684365668 663declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3] 664; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3] 665 666; Functions -- Prologue data 667declare void @f.prologuei32() prologue i32 1684365669 668; CHECK: declare void @f.prologuei32() prologue i32 1684365669 669declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3] 670; CHECK: declare void @f.prologuearray() prologue [4 x i32] [i32 0, i32 1, i32 2, i32 3] 671 672; Functions -- Personality constant 673declare void @llvm.donothing() nounwind readnone 674; CHECK: declare void @llvm.donothing() #35 675define void @f.no_personality() personality i8 3 { 676; CHECK: define void @f.no_personality() personality i8 3 677 invoke void @llvm.donothing() to label %normal unwind label %exception 678exception: 679 %cleanup = landingpad i8 cleanup 680 br label %normal 681normal: 682 ret void 683} 684 685declare i32 @f.personality_handler() 686; CHECK: declare i32 @f.personality_handler() 687define void @f.personality() personality i32 ()* @f.personality_handler { 688; CHECK: define void @f.personality() personality i32 ()* @f.personality_handler 689 invoke void @llvm.donothing() to label %normal unwind label %exception 690exception: 691 %cleanup = landingpad i32 cleanup 692 br label %normal 693normal: 694 ret void 695} 696 697;; Atomic Memory Ordering Constraints 698define void @atomics(i32* %word) { 699 %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic 700 ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic 701 %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic 702 ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic 703 %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic 704 ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic 705 %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic 706 ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic 707 %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic 708 ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic 709 %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic 710 ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic 711 %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic 712 ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic 713 %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 syncscope("singlethread") seq_cst monotonic 714 ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 syncscope("singlethread") seq_cst monotonic 715 %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic 716 ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic 717 %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic 718 ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic 719 %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic 720 ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic 721 %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic 722 ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic 723 %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic 724 ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic 725 %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic 726 ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic 727 %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic 728 ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic 729 %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic 730 ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic 731 %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic 732 ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic 733 %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 syncscope("singlethread") monotonic 734 ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 syncscope("singlethread") monotonic 735 %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 syncscope("singlethread") monotonic 736 ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 syncscope("singlethread") monotonic 737 fence acquire 738 ; CHECK: fence acquire 739 fence release 740 ; CHECK: fence release 741 fence acq_rel 742 ; CHECK: fence acq_rel 743 fence syncscope("singlethread") seq_cst 744 ; CHECK: fence syncscope("singlethread") seq_cst 745 746 %ld.1 = load atomic i32, i32* %word monotonic, align 4 747 ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4 748 %ld.2 = load atomic volatile i32, i32* %word acquire, align 8 749 ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8 750 %ld.3 = load atomic volatile i32, i32* %word syncscope("singlethread") seq_cst, align 16 751 ; CHECK: %ld.3 = load atomic volatile i32, i32* %word syncscope("singlethread") seq_cst, align 16 752 753 store atomic i32 23, i32* %word monotonic, align 4 754 ; CHECK: store atomic i32 23, i32* %word monotonic, align 4 755 store atomic volatile i32 24, i32* %word monotonic, align 4 756 ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4 757 store atomic volatile i32 25, i32* %word syncscope("singlethread") monotonic, align 4 758 ; CHECK: store atomic volatile i32 25, i32* %word syncscope("singlethread") monotonic, align 4 759 ret void 760} 761 762;; Fast Math Flags 763define void @fastmathflags(float %op1, float %op2) { 764 %f.nnan = fadd nnan float %op1, %op2 765 ; CHECK: %f.nnan = fadd nnan float %op1, %op2 766 %f.ninf = fadd ninf float %op1, %op2 767 ; CHECK: %f.ninf = fadd ninf float %op1, %op2 768 %f.nsz = fadd nsz float %op1, %op2 769 ; CHECK: %f.nsz = fadd nsz float %op1, %op2 770 %f.arcp = fadd arcp float %op1, %op2 771 ; CHECK: %f.arcp = fadd arcp float %op1, %op2 772 %f.contract = fadd contract float %op1, %op2 773 ; CHECK: %f.contract = fadd contract float %op1, %op2 774 %f.afn = fadd afn float %op1, %op2 775 ; CHECK: %f.afn = fadd afn float %op1, %op2 776 %f.reassoc = fadd reassoc float %op1, %op2 777 ; CHECK: %f.reassoc = fadd reassoc float %op1, %op2 778 %f.fast = fadd fast float %op1, %op2 779 ; CHECK: %f.fast = fadd fast float %op1, %op2 780 ret void 781} 782 783; Check various fast math flags and floating-point types on calls. 784 785declare float @fmf1() 786declare double @fmf2() 787declare <4 x double> @fmf3() 788 789; CHECK-LABEL: fastMathFlagsForCalls( 790define void @fastMathFlagsForCalls(float %f, double %d1, <4 x double> %d2) { 791 %call.fast = call fast float @fmf1() 792 ; CHECK: %call.fast = call fast float @fmf1() 793 794 ; Throw in some other attributes to make sure those stay in the right places. 795 796 %call.nsz.arcp = notail call nsz arcp double @fmf2() 797 ; CHECK: %call.nsz.arcp = notail call nsz arcp double @fmf2() 798 799 %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3() 800 ; CHECK: %call.nnan.ninf = tail call nnan ninf fastcc <4 x double> @fmf3() 801 802 ret void 803} 804 805;; Type System 806%opaquety = type opaque 807define void @typesystem() { 808 %p0 = bitcast i8* null to i32 (i32)* 809 ; CHECK: %p0 = bitcast i8* null to i32 (i32)* 810 %p1 = bitcast i8* null to void (i8*)* 811 ; CHECK: %p1 = bitcast i8* null to void (i8*)* 812 %p2 = bitcast i8* null to i32 (i8*, ...)* 813 ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)* 814 %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)* 815 ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)* 816 %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)* 817 ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)* 818 %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)* 819 ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)* 820 821 %t0 = alloca i1942652 822 ; CHECK: %t0 = alloca i1942652 823 %t1 = alloca half 824 ; CHECK: %t1 = alloca half 825 %t2 = alloca float 826 ; CHECK: %t2 = alloca float 827 %t3 = alloca double 828 ; CHECK: %t3 = alloca double 829 %t4 = alloca fp128 830 ; CHECK: %t4 = alloca fp128 831 %t5 = alloca x86_fp80 832 ; CHECK: %t5 = alloca x86_fp80 833 %t6 = alloca ppc_fp128 834 ; CHECK: %t6 = alloca ppc_fp128 835 %t7 = alloca x86_mmx 836 ; CHECK: %t7 = alloca x86_mmx 837 %t8 = alloca %opaquety* 838 ; CHECK: %t8 = alloca %opaquety* 839 840 ret void 841} 842 843declare void @llvm.token(token) 844; CHECK: declare void @llvm.token(token) 845 846;; Inline Assembler Expressions 847define void @inlineasm(i32 %arg) { 848 call i32 asm "bswap $0", "=r,r"(i32 %arg) 849 ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg) 850 call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg) 851 ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg) 852 ret void 853} 854 855;; Instructions 856 857; Instructions -- Terminators 858define void @instructions.terminators(i8 %val) personality i32 -10 { 859 br i1 false, label %iftrue, label %iffalse 860 ; CHECK: br i1 false, label %iftrue, label %iffalse 861 br label %iftrue 862 ; CHECK: br label %iftrue 863iftrue: 864 ret void 865 ; CHECK: ret void 866iffalse: 867 868 switch i8 %val, label %defaultdest [ 869 ; CHECK: switch i8 %val, label %defaultdest [ 870 i8 0, label %defaultdest.0 871 ; CHECK: i8 0, label %defaultdest.0 872 i8 1, label %defaultdest.1 873 ; CHECK: i8 1, label %defaultdest.1 874 i8 2, label %defaultdest.2 875 ; CHECK: i8 2, label %defaultdest.2 876 ] 877 ; CHECK: ] 878defaultdest: 879 ret void 880defaultdest.0: 881 ret void 882defaultdest.1: 883 ret void 884defaultdest.2: 885 886 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2] 887 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2] 888 indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2] 889 ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2] 890 891 invoke fastcc void @f.fastcc() 892 ; CHECK: invoke fastcc void @f.fastcc() 893 to label %defaultdest unwind label %exc 894 ; CHECK: to label %defaultdest unwind label %exc 895exc: 896 %cleanup = landingpad i32 cleanup 897 898 resume i32 undef 899 ; CHECK: resume i32 undef 900 unreachable 901 ; CHECK: unreachable 902 903 ret void 904} 905 906define i32 @instructions.win_eh.1() personality i32 -3 { 907entry: 908 %arg1 = alloca i32 909 %arg2 = alloca i32 910 invoke void @f.ccc() to label %normal unwind label %catchswitch1 911 invoke void @f.ccc() to label %normal unwind label %catchswitch2 912 invoke void @f.ccc() to label %normal unwind label %catchswitch3 913 914catchswitch1: 915 %cs1 = catchswitch within none [label %catchpad1] unwind to caller 916 917catchpad1: 918 catchpad within %cs1 [] 919 br label %normal 920 ; CHECK: catchpad within %cs1 [] 921 ; CHECK-NEXT: br label %normal 922 923catchswitch2: 924 %cs2 = catchswitch within none [label %catchpad2] unwind to caller 925 926catchpad2: 927 catchpad within %cs2 [i32* %arg1] 928 br label %normal 929 ; CHECK: catchpad within %cs2 [i32* %arg1] 930 ; CHECK-NEXT: br label %normal 931 932catchswitch3: 933 %cs3 = catchswitch within none [label %catchpad3] unwind label %cleanuppad1 934 935catchpad3: 936 catchpad within %cs3 [i32* %arg1, i32* %arg2] 937 br label %normal 938 ; CHECK: catchpad within %cs3 [i32* %arg1, i32* %arg2] 939 ; CHECK-NEXT: br label %normal 940 941cleanuppad1: 942 %clean.1 = cleanuppad within none [] 943 unreachable 944 ; CHECK: %clean.1 = cleanuppad within none [] 945 ; CHECK-NEXT: unreachable 946 947normal: 948 ret i32 0 949} 950; 951define i32 @instructions.win_eh.2() personality i32 -4 { 952entry: 953 invoke void @f.ccc() to label %invoke.cont unwind label %catchswitch 954 955invoke.cont: 956 invoke void @f.ccc() to label %continue unwind label %cleanup 957 958cleanup: 959 %clean = cleanuppad within none [] 960 ; CHECK: %clean = cleanuppad within none [] 961 cleanupret from %clean unwind to caller 962 ; CHECK: cleanupret from %clean unwind to caller 963 964catchswitch: 965 %cs = catchswitch within none [label %catchpad] unwind label %terminate 966 967catchpad: 968 %catch = catchpad within %cs [] 969 br label %body 970 ; CHECK: %catch = catchpad within %cs [] 971 ; CHECK-NEXT: br label %body 972 973body: 974 invoke void @f.ccc() [ "funclet"(token %catch) ] 975 to label %continue unwind label %terminate.inner 976 catchret from %catch to label %return 977 ; CHECK: catchret from %catch to label %return 978 979return: 980 ret i32 0 981 982terminate.inner: 983 cleanuppad within %catch [] 984 unreachable 985 ; CHECK: cleanuppad within %catch [] 986 ; CHECK-NEXT: unreachable 987 988terminate: 989 cleanuppad within none [] 990 unreachable 991 ; CHECK: cleanuppad within none [] 992 ; CHECK-NEXT: unreachable 993 994continue: 995 ret i32 0 996} 997 998; Instructions -- Binary Operations 999define void @instructions.binops(i8 %op1, i8 %op2) { 1000 ; nuw x nsw 1001 add i8 %op1, %op2 1002 ; CHECK: add i8 %op1, %op2 1003 add nuw i8 %op1, %op2 1004 ; CHECK: add nuw i8 %op1, %op2 1005 add nsw i8 %op1, %op2 1006 ; CHECK: add nsw i8 %op1, %op2 1007 add nuw nsw i8 %op1, %op2 1008 ; CHECK: add nuw nsw i8 %op1, %op2 1009 sub i8 %op1, %op2 1010 ; CHECK: sub i8 %op1, %op2 1011 sub nuw i8 %op1, %op2 1012 ; CHECK: sub nuw i8 %op1, %op2 1013 sub nsw i8 %op1, %op2 1014 ; CHECK: sub nsw i8 %op1, %op2 1015 sub nuw nsw i8 %op1, %op2 1016 ; CHECK: sub nuw nsw i8 %op1, %op2 1017 mul i8 %op1, %op2 1018 ; CHECK: mul i8 %op1, %op2 1019 mul nuw i8 %op1, %op2 1020 ; CHECK: mul nuw i8 %op1, %op2 1021 mul nsw i8 %op1, %op2 1022 ; CHECK: mul nsw i8 %op1, %op2 1023 mul nuw nsw i8 %op1, %op2 1024 ; CHECK: mul nuw nsw i8 %op1, %op2 1025 1026 ; exact 1027 udiv i8 %op1, %op2 1028 ; CHECK: udiv i8 %op1, %op2 1029 udiv exact i8 %op1, %op2 1030 ; CHECK: udiv exact i8 %op1, %op2 1031 sdiv i8 %op1, %op2 1032 ; CHECK: sdiv i8 %op1, %op2 1033 sdiv exact i8 %op1, %op2 1034 ; CHECK: sdiv exact i8 %op1, %op2 1035 1036 ; none 1037 urem i8 %op1, %op2 1038 ; CHECK: urem i8 %op1, %op2 1039 srem i8 %op1, %op2 1040 ; CHECK: srem i8 %op1, %op2 1041 1042 ret void 1043} 1044 1045; Instructions -- Bitwise Binary Operations 1046define void @instructions.bitwise_binops(i8 %op1, i8 %op2) { 1047 ; nuw x nsw 1048 shl i8 %op1, %op2 1049 ; CHECK: shl i8 %op1, %op2 1050 shl nuw i8 %op1, %op2 1051 ; CHECK: shl nuw i8 %op1, %op2 1052 shl nsw i8 %op1, %op2 1053 ; CHECK: shl nsw i8 %op1, %op2 1054 shl nuw nsw i8 %op1, %op2 1055 ; CHECK: shl nuw nsw i8 %op1, %op2 1056 1057 ; exact 1058 lshr i8 %op1, %op2 1059 ; CHECK: lshr i8 %op1, %op2 1060 lshr exact i8 %op1, %op2 1061 ; CHECK: lshr exact i8 %op1, %op2 1062 ashr i8 %op1, %op2 1063 ; CHECK: ashr i8 %op1, %op2 1064 ashr exact i8 %op1, %op2 1065 ; CHECK: ashr exact i8 %op1, %op2 1066 1067 ; none 1068 and i8 %op1, %op2 1069 ; CHECK: and i8 %op1, %op2 1070 or i8 %op1, %op2 1071 ; CHECK: or i8 %op1, %op2 1072 xor i8 %op1, %op2 1073 ; CHECK: xor i8 %op1, %op2 1074 1075 ret void 1076} 1077 1078; Instructions -- Vector Operations 1079define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) { 1080 extractelement <4 x float> %vec, i8 0 1081 ; CHECK: extractelement <4 x float> %vec, i8 0 1082 insertelement <4 x float> %vec, float 3.500000e+00, i8 0 1083 ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0 1084 shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer 1085 ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer 1086 1087 ret void 1088} 1089 1090; Instructions -- Aggregate Operations 1091define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p, 1092 [3 x i8] %arr, { i8, { i32 }} %n, 1093 <2 x i8*> %pvec, <2 x i64> %offsets) { 1094 extractvalue { i8, i32 } %up, 0 1095 ; CHECK: extractvalue { i8, i32 } %up, 0 1096 extractvalue <{ i8, i32 }> %p, 1 1097 ; CHECK: extractvalue <{ i8, i32 }> %p, 1 1098 extractvalue [3 x i8] %arr, 2 1099 ; CHECK: extractvalue [3 x i8] %arr, 2 1100 extractvalue { i8, { i32 } } %n, 1, 0 1101 ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0 1102 1103 insertvalue { i8, i32 } %up, i8 1, 0 1104 ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0 1105 insertvalue <{ i8, i32 }> %p, i32 2, 1 1106 ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1 1107 insertvalue [3 x i8] %arr, i8 0, 0 1108 ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0 1109 insertvalue { i8, { i32 } } %n, i32 0, 1, 0 1110 ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0 1111 1112 %up.ptr = alloca { i8, i32 } 1113 %p.ptr = alloca <{ i8, i32 }> 1114 %arr.ptr = alloca [3 x i8] 1115 %n.ptr = alloca { i8, { i32 } } 1116 1117 getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0 1118 ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0 1119 getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1 1120 ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1 1121 getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2 1122 ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2 1123 getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1 1124 ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1 1125 getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0 1126 ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0 1127 getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets 1128 ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets 1129 1130 ret void 1131} 1132 1133; Instructions -- Memory Access and Addressing Operations 1134!7 = !{i32 1} 1135!8 = !{} 1136!9 = !{i64 4} 1137define void @instructions.memops(i32** %base) { 1138 alloca i32, i8 4, align 4 1139 ; CHECK: alloca i32, i8 4, align 4 1140 alloca inalloca i32, i8 4, align 4 1141 ; CHECK: alloca inalloca i32, i8 4, align 4 1142 1143 load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9 1144 ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9 1145 load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9 1146 ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9, !dereferenceable_or_null !9 1147 1148 store i32* null, i32** %base, align 4, !nontemporal !8 1149 ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8 1150 store volatile i32* null, i32** %base, align 4, !nontemporal !8 1151 ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8 1152 1153 ret void 1154} 1155 1156; Instructions -- Conversion Operations 1157define void @instructions.conversions() { 1158 trunc i32 -1 to i1 1159 ; CHECK: trunc i32 -1 to i1 1160 zext i32 -1 to i64 1161 ; CHECK: zext i32 -1 to i64 1162 sext i32 -1 to i64 1163 ; CHECK: sext i32 -1 to i64 1164 fptrunc float undef to half 1165 ; CHECK: fptrunc float undef to half 1166 fpext half undef to float 1167 ; CHECK: fpext half undef to float 1168 fptoui float undef to i32 1169 ; CHECK: fptoui float undef to i32 1170 fptosi float undef to i32 1171 ; CHECK: fptosi float undef to i32 1172 uitofp i32 1 to float 1173 ; CHECK: uitofp i32 1 to float 1174 sitofp i32 -1 to float 1175 ; CHECK: sitofp i32 -1 to float 1176 ptrtoint i8* null to i64 1177 ; CHECK: ptrtoint i8* null to i64 1178 inttoptr i64 0 to i8* 1179 ; CHECK: inttoptr i64 0 to i8* 1180 bitcast i32 0 to i32 1181 ; CHECK: bitcast i32 0 to i32 1182 addrspacecast i32* null to i32 addrspace(1)* 1183 ; CHECK: addrspacecast i32* null to i32 addrspace(1)* 1184 1185 ret void 1186} 1187 1188; Instructions -- Other Operations 1189define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) { 1190entry: 1191 icmp eq i32 %op1, %op2 1192 ; CHECK: icmp eq i32 %op1, %op2 1193 icmp ne i32 %op1, %op2 1194 ; CHECK: icmp ne i32 %op1, %op2 1195 icmp ugt i32 %op1, %op2 1196 ; CHECK: icmp ugt i32 %op1, %op2 1197 icmp uge i32 %op1, %op2 1198 ; CHECK: icmp uge i32 %op1, %op2 1199 icmp ult i32 %op1, %op2 1200 ; CHECK: icmp ult i32 %op1, %op2 1201 icmp ule i32 %op1, %op2 1202 ; CHECK: icmp ule i32 %op1, %op2 1203 icmp sgt i32 %op1, %op2 1204 ; CHECK: icmp sgt i32 %op1, %op2 1205 icmp sge i32 %op1, %op2 1206 ; CHECK: icmp sge i32 %op1, %op2 1207 icmp slt i32 %op1, %op2 1208 ; CHECK: icmp slt i32 %op1, %op2 1209 icmp sle i32 %op1, %op2 1210 ; CHECK: icmp sle i32 %op1, %op2 1211 1212 fcmp false half %fop1, %fop2 1213 ; CHECK: fcmp false half %fop1, %fop2 1214 fcmp oeq half %fop1, %fop2 1215 ; CHECK: fcmp oeq half %fop1, %fop2 1216 fcmp ogt half %fop1, %fop2 1217 ; CHECK: fcmp ogt half %fop1, %fop2 1218 fcmp oge half %fop1, %fop2 1219 ; CHECK: fcmp oge half %fop1, %fop2 1220 fcmp olt half %fop1, %fop2 1221 ; CHECK: fcmp olt half %fop1, %fop2 1222 fcmp ole half %fop1, %fop2 1223 ; CHECK: fcmp ole half %fop1, %fop2 1224 fcmp one half %fop1, %fop2 1225 ; CHECK: fcmp one half %fop1, %fop2 1226 fcmp ord half %fop1, %fop2 1227 ; CHECK: fcmp ord half %fop1, %fop2 1228 fcmp ueq half %fop1, %fop2 1229 ; CHECK: fcmp ueq half %fop1, %fop2 1230 fcmp ugt half %fop1, %fop2 1231 ; CHECK: fcmp ugt half %fop1, %fop2 1232 fcmp uge half %fop1, %fop2 1233 ; CHECK: fcmp uge half %fop1, %fop2 1234 fcmp ult half %fop1, %fop2 1235 ; CHECK: fcmp ult half %fop1, %fop2 1236 fcmp ule half %fop1, %fop2 1237 ; CHECK: fcmp ule half %fop1, %fop2 1238 fcmp une half %fop1, %fop2 1239 ; CHECK: fcmp une half %fop1, %fop2 1240 fcmp uno half %fop1, %fop2 1241 ; CHECK: fcmp uno half %fop1, %fop2 1242 fcmp true half %fop1, %fop2 1243 ; CHECK: fcmp true half %fop1, %fop2 1244 1245 br label %exit 1246L1: 1247 %v1 = add i32 %op1, %op2 1248 br label %exit 1249L2: 1250 %v2 = add i32 %op1, %op2 1251 br label %exit 1252exit: 1253 phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ] 1254 ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ] 1255 1256 select i1 true, i32 0, i32 1 1257 ; CHECK: select i1 true, i32 0, i32 1 1258 select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2> 1259 ; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2> 1260 1261 call void @f.nobuiltin() builtin 1262 ; CHECK: call void @f.nobuiltin() #43 1263 1264 ; When used in a non-strictfp function the strictfp callsite attribute 1265 ; should get translated to nobuiltin. 1266 call void @f.strictfp() strictfp 1267 ; CHECK: call void @f.strictfp() #9 1268 1269 call fastcc noalias i32* @f.noalias() noinline 1270 ; CHECK: call fastcc noalias i32* @f.noalias() #12 1271 tail call ghccc nonnull i32* @f.nonnull() minsize 1272 ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #7 1273 1274 ret void 1275} 1276 1277define void @instructions.call_musttail(i8* inalloca %val) { 1278 musttail call void @f.param.inalloca(i8* inalloca %val) 1279 ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val) 1280 1281 ret void 1282} 1283 1284define void @instructions.call_notail() { 1285 notail call void @f1() 1286 ; CHECK: notail call void @f1() 1287 1288 ret void 1289} 1290 1291define void @instructions.landingpad() personality i32 -2 { 1292 invoke void @llvm.donothing() to label %proceed unwind label %catch1 1293 invoke void @llvm.donothing() to label %proceed unwind label %catch2 1294 invoke void @llvm.donothing() to label %proceed unwind label %catch3 1295 invoke void @llvm.donothing() to label %proceed unwind label %catch4 1296 1297catch1: 1298 landingpad i32 1299 ; CHECK: landingpad i32 1300 cleanup 1301 ; CHECK: cleanup 1302 br label %proceed 1303 1304catch2: 1305 landingpad i32 1306 ; CHECK: landingpad i32 1307 cleanup 1308 ; CHECK: cleanup 1309 catch i32* null 1310 ; CHECK: catch i32* null 1311 br label %proceed 1312 1313catch3: 1314 landingpad i32 1315 ; CHECK: landingpad i32 1316 cleanup 1317 ; CHECK: cleanup 1318 catch i32* null 1319 ; CHECK: catch i32* null 1320 catch i32* null 1321 ; CHECK: catch i32* null 1322 br label %proceed 1323 1324catch4: 1325 landingpad i32 1326 ; CHECK: landingpad i32 1327 filter [2 x i32] zeroinitializer 1328 ; CHECK: filter [2 x i32] zeroinitializer 1329 br label %proceed 1330 1331proceed: 1332 ret void 1333} 1334 1335;; Intrinsic Functions 1336 1337; Intrinsic Functions -- Variable Argument Handling 1338declare void @llvm.va_start(i8*) 1339declare void @llvm.va_copy(i8*, i8*) 1340declare void @llvm.va_end(i8*) 1341define void @instructions.va_arg(i8* %v, ...) { 1342 %ap = alloca i8* 1343 %ap2 = bitcast i8** %ap to i8* 1344 1345 call void @llvm.va_start(i8* %ap2) 1346 ; CHECK: call void @llvm.va_start(i8* %ap2) 1347 1348 va_arg i8* %ap2, i32 1349 ; CHECK: va_arg i8* %ap2, i32 1350 1351 call void @llvm.va_copy(i8* %v, i8* %ap2) 1352 ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2) 1353 1354 call void @llvm.va_end(i8* %ap2) 1355 ; CHECK: call void @llvm.va_end(i8* %ap2) 1356 1357 ret void 1358} 1359 1360; Intrinsic Functions -- Accurate Garbage Collection 1361declare void @llvm.gcroot(i8**, i8*) 1362declare i8* @llvm.gcread(i8*, i8**) 1363declare void @llvm.gcwrite(i8*, i8*, i8**) 1364define void @intrinsics.gc() gc "shadow-stack" { 1365 %ptrloc = alloca i8* 1366 call void @llvm.gcroot(i8** %ptrloc, i8* null) 1367 ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null) 1368 1369 call i8* @llvm.gcread(i8* null, i8** %ptrloc) 1370 ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc) 1371 1372 %ref = alloca i8 1373 call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc) 1374 ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc) 1375 1376 ret void 1377} 1378 1379; Intrinsic Functions -- Code Generation 1380declare i8* @llvm.returnaddress(i32) 1381declare i8* @llvm.frameaddress(i32) 1382declare i32 @llvm.read_register.i32(metadata) 1383declare i64 @llvm.read_register.i64(metadata) 1384declare void @llvm.write_register.i32(metadata, i32) 1385declare void @llvm.write_register.i64(metadata, i64) 1386declare i8* @llvm.stacksave() 1387declare void @llvm.stackrestore(i8*) 1388declare void @llvm.prefetch(i8*, i32, i32, i32) 1389declare void @llvm.pcmarker(i32) 1390declare i64 @llvm.readcyclecounter() 1391declare void @llvm.clear_cache(i8*, i8*) 1392declare void @llvm.instrprof_increment(i8*, i64, i32, i32) 1393 1394!10 = !{!"rax"} 1395define void @intrinsics.codegen() { 1396 call i8* @llvm.returnaddress(i32 1) 1397 ; CHECK: call i8* @llvm.returnaddress(i32 1) 1398 call i8* @llvm.frameaddress(i32 1) 1399 ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) 1400 1401 call i32 @llvm.read_register.i32(metadata !10) 1402 ; CHECK: call i32 @llvm.read_register.i32(metadata !10) 1403 call i64 @llvm.read_register.i64(metadata !10) 1404 ; CHECK: call i64 @llvm.read_register.i64(metadata !10) 1405 call void @llvm.write_register.i32(metadata !10, i32 0) 1406 ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0) 1407 call void @llvm.write_register.i64(metadata !10, i64 0) 1408 ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0) 1409 1410 %stack = call i8* @llvm.stacksave() 1411 ; CHECK: %stack = call i8* @llvm.stacksave() 1412 call void @llvm.stackrestore(i8* %stack) 1413 ; CHECK: call void @llvm.stackrestore(i8* %stack) 1414 1415 call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0) 1416 ; CHECK: call void @llvm.prefetch.p0i8(i8* %stack, i32 0, i32 3, i32 0) 1417 1418 call void @llvm.pcmarker(i32 1) 1419 ; CHECK: call void @llvm.pcmarker(i32 1) 1420 1421 call i64 @llvm.readcyclecounter() 1422 ; CHECK: call i64 @llvm.readcyclecounter() 1423 1424 call void @llvm.clear_cache(i8* null, i8* null) 1425 ; CHECK: call void @llvm.clear_cache(i8* null, i8* null) 1426 1427 call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0) 1428 ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0) 1429 1430 ret void 1431} 1432 1433declare void @llvm.localescape(...) 1434declare i8* @llvm.localrecover(i8* %func, i8* %fp, i32 %idx) 1435define void @intrinsics.localescape() { 1436 %static.alloca = alloca i32 1437 call void (...) @llvm.localescape(i32* %static.alloca) 1438 ; CHECK: call void (...) @llvm.localescape(i32* %static.alloca) 1439 1440 call void @intrinsics.localrecover() 1441 1442 ret void 1443} 1444define void @intrinsics.localrecover() { 1445 %func = bitcast void ()* @intrinsics.localescape to i8* 1446 %fp = call i8* @llvm.frameaddress(i32 1) 1447 call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0) 1448 ; CHECK: call i8* @llvm.localrecover(i8* %func, i8* %fp, i32 0) 1449 1450 ret void 1451} 1452 1453; We need this function to provide `uses' for some metadata tests. 1454define void @misc.metadata() { 1455 call void @f1(), !srcloc !11 1456 call void @f1(), !srcloc !12 1457 call void @f1(), !srcloc !13 1458 call void @f1(), !srcloc !14 1459 ret void 1460} 1461 1462declare void @op_bundle_callee_0() 1463declare void @op_bundle_callee_1(i32,i32) 1464 1465define void @call_with_operand_bundle0(i32* %ptr) { 1466; CHECK-LABEL: call_with_operand_bundle0( 1467 entry: 1468 %l = load i32, i32* %ptr 1469 %x = add i32 42, 1 1470 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] 1471; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] 1472 ret void 1473} 1474 1475define void @call_with_operand_bundle1(i32* %ptr) { 1476; CHECK-LABEL: call_with_operand_bundle1( 1477 entry: 1478 %l = load i32, i32* %ptr 1479 %x = add i32 42, 1 1480 1481 call void @op_bundle_callee_0() 1482 call void @op_bundle_callee_0() [ "foo"() ] 1483 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] 1484; CHECK: @op_bundle_callee_0(){{$}} 1485; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"() ] 1486; CHECK-NEXT: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] 1487 ret void 1488} 1489 1490define void @call_with_operand_bundle2(i32* %ptr) { 1491; CHECK-LABEL: call_with_operand_bundle2( 1492 entry: 1493 call void @op_bundle_callee_0() [ "foo"() ] 1494; CHECK: call void @op_bundle_callee_0() [ "foo"() ] 1495 ret void 1496} 1497 1498define void @call_with_operand_bundle3(i32* %ptr) { 1499; CHECK-LABEL: call_with_operand_bundle3( 1500 entry: 1501 %l = load i32, i32* %ptr 1502 %x = add i32 42, 1 1503 call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1504; CHECK: call void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1505 ret void 1506} 1507 1508define void @call_with_operand_bundle4(i32* %ptr) { 1509; CHECK-LABEL: call_with_operand_bundle4( 1510 entry: 1511 %l = load i32, i32* %ptr 1512 %x = add i32 42, 1 1513 call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1514; CHECK: call void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1515 ret void 1516} 1517 1518; Invoke versions of the above tests: 1519 1520 1521define void @invoke_with_operand_bundle0(i32* %ptr) personality i8 3 { 1522; CHECK-LABEL: @invoke_with_operand_bundle0( 1523 entry: 1524 %l = load i32, i32* %ptr 1525 %x = add i32 42, 1 1526 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] to label %normal unwind label %exception 1527; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] 1528 1529exception: 1530 %cleanup = landingpad i8 cleanup 1531 br label %normal 1532normal: 1533 ret void 1534} 1535 1536define void @invoke_with_operand_bundle1(i32* %ptr) personality i8 3 { 1537; CHECK-LABEL: @invoke_with_operand_bundle1( 1538 entry: 1539 %l = load i32, i32* %ptr 1540 %x = add i32 42, 1 1541 1542 invoke void @op_bundle_callee_0() to label %normal unwind label %exception 1543; CHECK: invoke void @op_bundle_callee_0(){{$}} 1544 1545exception: 1546 %cleanup = landingpad i8 cleanup 1547 br label %normal 1548 1549normal: 1550 invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal1 unwind label %exception1 1551; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ] 1552 1553exception1: 1554 %cleanup1 = landingpad i8 cleanup 1555 br label %normal1 1556 1557normal1: 1558 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal2 unwind label %exception2 1559; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1560 1561exception2: 1562 %cleanup2 = landingpad i8 cleanup 1563 br label %normal2 1564 1565normal2: 1566 ret void 1567} 1568 1569define void @invoke_with_operand_bundle2(i32* %ptr) personality i8 3 { 1570; CHECK-LABEL: @invoke_with_operand_bundle2( 1571 entry: 1572 invoke void @op_bundle_callee_0() [ "foo"() ] to label %normal unwind label %exception 1573; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ] 1574 1575exception: 1576 %cleanup = landingpad i8 cleanup 1577 br label %normal 1578normal: 1579 ret void 1580} 1581 1582define void @invoke_with_operand_bundle3(i32* %ptr) personality i8 3 { 1583; CHECK-LABEL: @invoke_with_operand_bundle3( 1584 entry: 1585 %l = load i32, i32* %ptr 1586 %x = add i32 42, 1 1587 invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal unwind label %exception 1588; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1589 1590exception: 1591 %cleanup = landingpad i8 cleanup 1592 br label %normal 1593normal: 1594 ret void 1595} 1596 1597define void @invoke_with_operand_bundle4(i32* %ptr) personality i8 3 { 1598; CHECK-LABEL: @invoke_with_operand_bundle4( 1599 entry: 1600 %l = load i32, i32* %ptr 1601 %x = add i32 42, 1 1602 invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1603 to label %normal unwind label %exception 1604; CHECK: invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1605 1606exception: 1607 %cleanup = landingpad i8 cleanup 1608 br label %normal 1609normal: 1610 ret void 1611} 1612 1613declare void @vaargs_func(...) 1614define void @invoke_with_operand_bundle_vaarg(i32* %ptr) personality i8 3 { 1615; CHECK-LABEL: @invoke_with_operand_bundle_vaarg( 1616 entry: 1617 %l = load i32, i32* %ptr 1618 %x = add i32 42, 1 1619 invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1620 to label %normal unwind label %exception 1621; CHECK: invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] 1622 1623exception: 1624 %cleanup = landingpad i8 cleanup 1625 br label %normal 1626normal: 1627 ret void 1628} 1629 1630 1631declare void @f.writeonly() writeonly 1632; CHECK: declare void @f.writeonly() #40 1633 1634declare void @f.speculatable() speculatable 1635; CHECK: declare void @f.speculatable() #41 1636 1637;; Constant Expressions 1638 1639define i8** @constexpr() { 1640 ; CHECK: ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2) 1641 ret i8** getelementptr inbounds ({ [4 x i8*], [4 x i8*] }, { [4 x i8*], [4 x i8*] }* null, i32 0, inrange i32 1, i32 2) 1642} 1643 1644; CHECK: attributes #0 = { alignstack=4 } 1645; CHECK: attributes #1 = { alignstack=8 } 1646; CHECK: attributes #2 = { alwaysinline } 1647; CHECK: attributes #3 = { cold } 1648; CHECK: attributes #4 = { convergent } 1649; CHECK: attributes #5 = { inlinehint } 1650; CHECK: attributes #6 = { jumptable } 1651; CHECK: attributes #7 = { minsize } 1652; CHECK: attributes #8 = { naked } 1653; CHECK: attributes #9 = { nobuiltin } 1654; CHECK: attributes #10 = { noduplicate } 1655; CHECK: attributes #11 = { noimplicitfloat } 1656; CHECK: attributes #12 = { noinline } 1657; CHECK: attributes #13 = { nonlazybind } 1658; CHECK: attributes #14 = { noredzone } 1659; CHECK: attributes #15 = { noreturn } 1660; CHECK: attributes #16 = { nounwind } 1661; CHECK: attributes #17 = { noinline optnone } 1662; CHECK: attributes #18 = { optsize } 1663; CHECK: attributes #19 = { readnone } 1664; CHECK: attributes #20 = { readonly } 1665; CHECK: attributes #21 = { returns_twice } 1666; CHECK: attributes #22 = { safestack } 1667; CHECK: attributes #23 = { sanitize_address } 1668; CHECK: attributes #24 = { sanitize_memory } 1669; CHECK: attributes #25 = { sanitize_thread } 1670; CHECK: attributes #26 = { ssp } 1671; CHECK: attributes #27 = { sspreq } 1672; CHECK: attributes #28 = { sspstrong } 1673; CHECK: attributes #29 = { "thunk" } 1674; CHECK: attributes #30 = { uwtable } 1675; CHECK: attributes #31 = { "cpu"="cortex-a8" } 1676; CHECK: attributes #32 = { norecurse } 1677; CHECK: attributes #33 = { inaccessiblememonly } 1678; CHECK: attributes #34 = { inaccessiblemem_or_argmemonly } 1679; CHECK: attributes #35 = { nofree nosync nounwind readnone willreturn } 1680; CHECK: attributes #36 = { nofree nosync nounwind willreturn } 1681; CHECK: attributes #37 = { argmemonly nounwind readonly } 1682; CHECK: attributes #38 = { argmemonly nounwind } 1683; CHECK: attributes #39 = { nounwind readonly } 1684; CHECK: attributes #40 = { writeonly } 1685; CHECK: attributes #41 = { speculatable } 1686; CHECK: attributes #42 = { inaccessiblemem_or_argmemonly nofree nosync nounwind willreturn } 1687; CHECK: attributes #43 = { builtin } 1688 1689;; Metadata 1690 1691; Metadata -- Module flags 1692!llvm.module.flags = !{!0, !1, !2, !4, !5, !6} 1693; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6} 1694 1695!0 = !{i32 1, !"mod1", i32 0} 1696; CHECK: !0 = !{i32 1, !"mod1", i32 0} 1697!1 = !{i32 2, !"mod2", i32 0} 1698; CHECK: !1 = !{i32 2, !"mod2", i32 0} 1699!2 = !{i32 3, !"mod3", !3} 1700; CHECK: !2 = !{i32 3, !"mod3", !3} 1701!3 = !{!"mod6", !0} 1702; CHECK: !3 = !{!"mod6", !0} 1703!4 = !{i32 4, !"mod4", i32 0} 1704; CHECK: !4 = !{i32 4, !"mod4", i32 0} 1705!5 = !{i32 5, !"mod5", !0} 1706; CHECK: !5 = !{i32 5, !"mod5", !0} 1707!6 = !{i32 6, !"mod6", !0} 1708; CHECK: !6 = !{i32 6, !"mod6", !0} 1709 1710; Metadata -- Check `distinct' 1711!11 = distinct !{} 1712; CHECK: !11 = distinct !{} 1713!12 = distinct !{} 1714; CHECK: !12 = distinct !{} 1715!13 = !{!11} 1716; CHECK: !13 = !{!11} 1717!14 = !{!12} 1718; CHECK: !14 = !{!12} 1719