Test Failure: Transforms/SimpleLoopUnswitch/guards.ll

Test source: git

Log:

Source: <stdin>
ERROR: Unsupported instruction:   invoke void @may_throw(i32 %iv)
          to label %loop unwind label %exit

----------------------------------------
define void @test_simple_case(i1 %cond, i32 %N) {
%entry:
  br label %loop

%loop:
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
  call void @llvm.experimental.guard(i1 %cond) nofree willreturn
  %iv.next = add i32 %iv, 1
  %loop.cond = icmp slt i32 %iv.next, %N
  br i1 %loop.cond, label %loop, label %exit

%exit:
  ret void
}
=>
define void @test_simple_case(i1 %cond, i32 %N) {
%entry:
  br i1 %cond, label %entry.split.us, label %entry.split

%entry.split:
  br label %loop

%loop:
  br label %deopt

%deopt:
  call void @llvm.experimental.guard(i1 0) nofree willreturn
  assume i1 0

%entry.split.us:
  br label %loop.us

%loop.us:
  %iv.us = phi i32 [ 0, %entry.split.us ], [ %iv.next.us, %guarded.us ]
  br label %guarded.us

%guarded.us:
  %iv.next.us = add i32 %iv.us, 1
  %loop.cond.us = icmp slt i32 %iv.next.us, %N
  br i1 %loop.cond.us, label %loop.us, label %exit.split.us

%exit.split.us:
  br label %exit

%exit:
  ret void
}
Transformation doesn't verify!
ERROR: Couldn't prove the correctness of the transformation
Alive2 approximated the semantics of the programs and therefore we
cannot conclude whether the bug found is valid or not.

Approximations done:
 - Unknown libcall: @llvm.experimental.guard



----------------------------------------
define void @test_two_guards(i1 %cond1, i1 %cond2, i32 %N) {
%entry:
  br label %loop

%loop:
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
  call void @llvm.experimental.guard(i1 %cond1) nofree willreturn
  call void @llvm.experimental.guard(i1 %cond2) nofree willreturn
  %iv.next = add i32 %iv, 1
  %loop.cond = icmp slt i32 %iv.next, %N
  br i1 %loop.cond, label %loop, label %exit

%exit:
  ret void
}
=>
define void @test_two_guards(i1 %cond1, i1 %cond2, i32 %N) {
%entry:
  br i1 %cond1, label %entry.split.us, label %entry.split

%entry.split:
  br label %loop

%loop:
  br label %deopt

%deopt:
  call void @llvm.experimental.guard(i1 0) nofree willreturn
  assume i1 0

%entry.split.us:
  br i1 %cond2, label %entry.split.us.split.us, label %entry.split.us.split

%entry.split.us.split.us:
  br label %loop.us.us

%loop.us.us:
  %iv.us.us = phi i32 [ 0, %entry.split.us.split.us ], [ %iv.next.us.us, %guarded.us2 ]
  br label %guarded.us.us

%guarded.us.us:
  br label %guarded.us2

%guarded.us2:
  %iv.next.us.us = add i32 %iv.us.us, 1
  %loop.cond.us.us = icmp slt i32 %iv.next.us.us, %N
  br i1 %loop.cond.us.us, label %loop.us.us, label %exit.split.us.split.us

%exit.split.us.split.us:
  br label %exit.split.us

%exit.split.us:
  br label %exit

%exit:
  ret void

%entry.split.us.split:
  br label %loop.us

%loop.us:
  br label %guarded.us

%guarded.us:
  br label %deopt1

%deopt1:
  call void @llvm.experimental.guard(i1 0) nofree willreturn
  assume i1 0
}
Transformation doesn't verify!
ERROR: Couldn't prove the correctness of the transformation
Alive2 approximated the semantics of the programs and therefore we
cannot conclude whether the bug found is valid or not.

Approximations done:
 - Unknown libcall: @llvm.experimental.guard



----------------------------------------
define void @test_conditional_guards(i1 %cond, i32 %N) {
%entry:
  br label %loop

%loop:
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
  %condition = icmp eq i32 %iv, 123
  br i1 %condition, label %guard, label %backedge

%guard:
  call void @llvm.experimental.guard(i1 %cond) nofree willreturn
  br label %backedge

%backedge:
  %iv.next = add i32 %iv, 1
  %loop.cond = icmp slt i32 %iv.next, %N
  br i1 %loop.cond, label %loop, label %exit

%exit:
  ret void
}
=>
define void @test_conditional_guards(i1 %cond, i32 %N) {
%entry:
  br i1 %cond, label %entry.split.us, label %entry.split

%entry.split:
  br label %loop

%loop:
  %iv = phi i32 [ 0, %entry.split ], [ %iv.next, %backedge ]
  %condition = icmp eq i32 %iv, 123
  br i1 %condition, label %guard, label %backedge

%guard:
  br label %deopt

%deopt:
  call void @llvm.experimental.guard(i1 0) nofree willreturn
  assume i1 0

%backedge:
  %iv.next = add i32 %iv, 1
  %loop.cond = icmp slt i32 %iv.next, %N
  br i1 %loop.cond, label %loop, label %exit.split

%exit.split:
  br label %exit

%entry.split.us:
  br label %loop.us

%loop.us:
  %iv.us = phi i32 [ 0, %entry.split.us ], [ %iv.next.us, %backedge.us ]
  %condition.us = icmp eq i32 %iv.us, 123
  br i1 %condition.us, label %guard.us, label %backedge.us

%guard.us:
  br label %guarded.us

%guarded.us:
  br label %backedge.us

%backedge.us:
  %iv.next.us = add i32 %iv.us, 1
  %loop.cond.us = icmp slt i32 %iv.next.us, %N
  br i1 %loop.cond.us, label %loop.us, label %exit.split.us

%exit.split.us:
  br label %exit

%exit:
  ret void
}
Transformation doesn't verify!
ERROR: Source is more defined than target

Example:
i1 %cond = undef
i32 %N = #x00000001 (1)

Source:
  >> Jump to %loop
i32 %iv = #x00000000 (0)
i1 %condition = #x0 (0)
  >> Jump to %backedge
i32 %iv.next = #x00000001 (1)
i1 %loop.cond = #x0 (0)
  >> Jump to %exit

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0
Block 1 >	size: 0	align: 1

Target:
UB triggered on br



------------------- SMT STATS -------------------
Num queries: 12
Num invalid: 0
Num skips:   0
Num trivial: 6 (33.3%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     12 (100.0%)
Num UNSAT:   0 (0.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

+ : 'RUN: at line 1'
+ /home/nuno/llvm/build/bin/FileCheck /home/nuno/llvm/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
+ /home/nuno/alive2/build/opt-alive.sh '-passes=loop(simple-loop-unswitch<nontrivial>),verify<loops>' -simple-loop-unswitch-guards -S

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nuno/llvm/build/bin/FileCheck /home/nuno/llvm/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll

 

<-- Back