Test Failure: Transforms/LICM/promote-capture.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. FunctionToLoopPassAdaptor

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 3. PassManager<Function> : Skipping NOP
-- 4. LoopSimplifyPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 5. LoopSimplifyPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 6. LCSSAPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 7. LCSSAPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Loop, AnalysisManager<Loop, LoopStandardAnalysisResults&>, LoopStandardAnalysisResults&, LPMUpdater&> : Skipping NOP
-- 10. LICMPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 11. LICMPass

----------------------------------------
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c = load i32, ptr %count, align 4
  %c.inc = add i32 %c, 1
  store i32 %c.inc, ptr %count, align 4
  br label %latch

latch:
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
=>
declare i1 @cond(i32)
declare void @capture(ptr)

define void @test_captured_after_loop(i32 %len) {
entry:
  %count = alloca i64 4, align 4
  store i32 0, ptr %count, align 4
  %count.promoted = load i32, ptr %count, align 4
  br label %loop

loop:
  %c.inc2 = phi i32 [ %count.promoted, %entry ], [ %c.inc1, %latch ]
  %i = phi i32 [ 0, %entry ], [ %i.next, %latch ]
  %cond = call i1 @cond(i32 %i) nofree memory(none)
  br i1 %cond, label %if, label %latch

if:
  %c.inc = add i32 %c.inc2, 1
  br label %latch

latch:
  %c.inc1 = phi i32 [ %c.inc, %if ], [ %c.inc2, %loop ]
  %i.next = add nuw i32 %i, 1
  %cmp = icmp eq i32 %i.next, %len
  br i1 %cmp, label %exit, label %loop

exit:
  %c.inc1.lcssa = phi i32 [ %c.inc1, %latch ]
  store i32 %c.inc1.lcssa, ptr %count, align 4
  call void @capture(ptr %count) nofree memory(none)
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i32 %len = #x00000001 (1)

Source:
ptr %count = pointer(local, block_id=2, offset=0)
  >> Jump to %loop
i32 %i = #x00000000 (0)
i1 %cond = #x0 (0)
  >> Jump to %latch
i32 %i.next = #x00000001 (1)
i1 %cmp = #x1 (1)
  >> Jump to %exit
void = function did not return!

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 4	alloc type: 0	alive: false	address: 0

LOCAL BLOCKS:
Block 2 >	size: 4	align: 4	alloc type: 1	alive: true

Target:
ptr %count = null
i32 %count.promoted = #x00000000 (0)
  >> Jump to %loop
i32 %c.inc2 = #x00000000 (0)
i32 %i = #x00000000 (0)
i1 %cond = #x0 (0)
  >> Jump to %latch
i32 %c.inc1 = #x00000000 (0)
i32 %i.next = #x00000001 (1)
i1 %cmp = #x1 (1)
  >> Jump to %exit
i32 %c.inc1.lcssa = #x00000000 (0)
Function @capture triggered UB

TARGET MEMORY STATE
===================
LOCAL BLOCKS:
Block 2 >	size: 4	align: 4	alloc type: 1	alive: true	address: 32


Pass: LICMPass
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-load-pass-plugin=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-S' '-passes=loop-mssa(licm)' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_bcZHjIjI_y7cA.bc"


------------------- SMT STATS -------------------
Num queries: 15
Num invalid: 0
Num skips:   0
Num trivial: 15 (50.0%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     13 (86.7%)
Num UNSAT:   2 (13.3%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -passes='loop-mssa(licm)' < /bitbucket/nlopes/llvm/llvm/test/Transforms/LICM/promote-capture.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LICM/promote-capture.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S '-passes=loop-mssa(licm)'
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LICM/promote-capture.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LICM/promote-capture.ll

 

<-- Back