Test source: git
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<Function> : Skipping NOP -- 2. FunctionToLoopPassAdaptor ---------------------------------------- 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 ---------------------------------------- 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 ---------------------------------------- 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 ---------------------------------------- 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 ---------------------------------------- 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 ---------------------------------------- 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 ---------------------------------------- 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 } => 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 Function @capture returned SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 4 alloc type: 0 address: 0 LOCAL BLOCKS: Block 2 > size: 4 align: 4 alloc type: 1 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: 0 align: 4 alloc type: 0 address: 0 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_ciQJ1iOy_Byan.bc" ------------------- SMT STATS ------------------- Num queries: 4 Num invalid: 0 Num skips: 0 Num trivial: 15 (78.9%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 4 (100.0%) Num UNSAT: 0 (0.0%) Alive2: Transform doesn't verify; aborting!
+ : 'RUN: at line 2' + /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)' FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LICM/promote-capture.ll