109 lines · plain
1; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s2 3%0 = type opaque4declare void @g()5declare ptr @foo0()6declare i8 @foo1()7declare void @noreturn_func()8 9; Operand bundles uses are like regular uses, and need to be dominated10; by their defs.11 12define void @f0(ptr %ptr) {13; CHECK: Instruction does not dominate all uses!14; CHECK-NEXT: %x = add i32 42, 115; CHECK-NEXT: call void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]16 17 entry:18 %l = load i32, ptr %ptr19 call void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.0, i64 100, i32 %l) ]20 %x = add i32 42, 121 ret void22}23 24define void @f1(ptr %ptr) personality i8 3 {25; CHECK: Instruction does not dominate all uses!26; CHECK-NEXT: %x = add i32 42, 127; CHECK-NEXT: invoke void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]28 29 entry:30 %l = load i32, ptr %ptr31 invoke void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.0, i64 100, i32 %l) ] to label %normal unwind label %exception32 33exception:34 %cleanup = landingpad i8 cleanup35 br label %normal36 37normal:38 %x = add i32 42, 139 ret void40}41 42define void @f_deopt(ptr %ptr) {43; CHECK: Multiple deopt operand bundles44; CHECK-NEXT: call void @g() [ "deopt"(i32 42, i64 100, i32 %x), "deopt"(float 0.000000e+00, i64 100, i32 %l) ]45; CHECK-NOT: call void @g() [ "deopt"(i32 42, i64 120, i32 %x) ]46 47 entry:48 %l = load i32, ptr %ptr49 call void @g() [ "deopt"(i32 42, i64 100, i32 %x), "deopt"(float 0.0, i64 100, i32 %l) ]50 call void @g() [ "deopt"(i32 42, i64 120) ] ;; The verifier should not complain about this one51 %x = add i32 42, 152 ret void53}54 55define void @f_gc_transition(ptr %ptr) {56; CHECK: Multiple gc-transition operand bundles57; CHECK-NEXT: call void @g() [ "gc-transition"(i32 42, i64 100, i32 %x), "gc-transition"(float 0.000000e+00, i64 100, i32 %l) ]58; CHECK-NOT: call void @g() [ "gc-transition"(i32 42, i64 120, i32 %x) ]59 60 entry:61 %l = load i32, ptr %ptr62 call void @g() [ "gc-transition"(i32 42, i64 100, i32 %x), "gc-transition"(float 0.0, i64 100, i32 %l) ]63 call void @g() [ "gc-transition"(i32 42, i64 120) ] ;; The verifier should not complain about this one64 %x = add i32 42, 165 ret void66}67 68define void @f_clang_arc_attachedcall() {69; CHECK: requires one function as an argument70; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"() ]71; CHECK-NEXT: Multiple "clang.arc.attachedcall" operand bundles72; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue), "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]73; CHECK-NEXT: must call a function returning a pointer74; CHECK-NEXT: call i8 @foo1() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]75; CHECK-NEXT: or a non-returning function76; CHECK-NEXT: call void @g() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]77; CHECK-NEXT: requires one function as an argument78; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"(ptr null) ]79; CHECK-NEXT: requires one function as an argument80; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"(i64 0) ]81; CHECK-NEXT: invalid function argument82; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"(ptr @foo1) ]83; CHECK-NEXT: invalid function argument84; CHECK-NEXT: call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.assume) ]85 86 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]87 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]88 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]89 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @objc_unsafeClaimAutoreleasedReturnValue) ]90 call ptr @foo0() [ "clang.arc.attachedcall"() ]91 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue), "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]92 call i8 @foo1() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]93 call void @noreturn_func() #0 [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]94 call void @g() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ]95 call ptr @foo0() [ "clang.arc.attachedcall"(ptr null) ]96 call ptr @foo0() [ "clang.arc.attachedcall"(i64 0) ]97 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @foo1) ]98 call ptr @foo0() [ "clang.arc.attachedcall"(ptr @llvm.assume) ]99 ret void100}101 102declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr)103declare ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr)104declare ptr @objc_retainAutoreleasedReturnValue(ptr)105declare ptr @objc_unsafeClaimAutoreleasedReturnValue(ptr)106declare void @llvm.assume(i1)107 108attributes #0 = { noreturn }109