Home | History | Annotate | Download | only in Verifier
      1 ; RUN: not opt -verify < %s 2>&1 | FileCheck %s
      2 
      3 ; Operand bundles uses are like regular uses, and need to be dominated
      4 ; by their defs.
      5 
      6 declare void @g()
      7 
      8 define void @f0(i32* %ptr) {
      9 ; CHECK: Instruction does not dominate all uses!
     10 ; CHECK-NEXT:  %x = add i32 42, 1
     11 ; CHECK-NEXT:  call void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
     12 
     13  entry:
     14   %l = load i32, i32* %ptr
     15   call void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.0, i64 100, i32 %l) ]
     16   %x = add i32 42, 1
     17   ret void
     18 }
     19 
     20 define void @f1(i32* %ptr) personality i8 3 {
     21 ; CHECK: Instruction does not dominate all uses!
     22 ; CHECK-NEXT:  %x = add i32 42, 1
     23 ; CHECK-NEXT:  invoke void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
     24 
     25  entry:
     26   %l = load i32, i32* %ptr
     27   invoke void @g() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.0, i64 100, i32 %l) ] to label %normal unwind label %exception
     28 
     29 exception:
     30   %cleanup = landingpad i8 cleanup
     31   br label %normal
     32 
     33 normal:
     34   %x = add i32 42, 1
     35   ret void
     36 }
     37 
     38 define void @f_deopt(i32* %ptr) {
     39 ; CHECK: Multiple deopt operand bundles
     40 ; CHECK-NEXT: call void @g() [ "deopt"(i32 42, i64 100, i32 %x), "deopt"(float 0.000000e+00, i64 100, i32 %l) ]
     41 ; CHECK-NOT: call void @g() [ "deopt"(i32 42, i64 120, i32 %x) ]
     42 
     43  entry:
     44   %l = load i32, i32* %ptr
     45   call void @g() [ "deopt"(i32 42, i64 100, i32 %x), "deopt"(float 0.0, i64 100, i32 %l) ]
     46   call void @g() [ "deopt"(i32 42, i64 120) ]  ;; The verifier should not complain about this one
     47   %x = add i32 42, 1
     48   ret void
     49 }
     50