Test source: git
Comments: LLVM PR57523
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<Function> : Skipping NOP -- 2. IRCEPass ---------------------------------------- define void @multiple_access_no_preloop(ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) { %entry: %len.a = load i32, ptr %a_len_ptr, align 4 %range_l#0%len.a = icmp sge i32 %len.a, 0 %range_h#0%len.a = icmp slt i32 %len.a, 2147483647 %range#0%len.a = and i1 %range_l#0%len.a, %range_h#0%len.a assume_non_poison i1 %range#0%len.a %len.b = load i32, ptr %b_len_ptr, align 4 %range_l#0%len.b = icmp sge i32 %len.b, 0 %range_h#0%len.b = icmp slt i32 %len.b, 2147483647 %range#0%len.b = and i1 %range_l#0%len.b, %range_h#0%len.b assume_non_poison i1 %range#0%len.b %first.itr.check = icmp sgt i32 %n, 0 br i1 %first.itr.check, label %loop, label %exit %loop: %idx = phi i32 [ 0, %entry ], [ %idx.next, %in.bounds.b ] %idx.next = add i32 %idx, 1 %abc.a = icmp slt i32 %idx, %len.a br i1 %abc.a, label %in.bounds.a, label %out.of.bounds %in.bounds.a: %addr.a = gep ptr %arr_a, 4 x i32 %idx store i32 0, ptr %addr.a, align 4 %abc.b = icmp slt i32 %idx, %len.b br i1 %abc.b, label %in.bounds.b, label %out.of.bounds %in.bounds.b: %addr.b = gep ptr %arr_b, 4 x i32 %idx store i32 4294967295, ptr %addr.b, align 4 %next = icmp slt i32 %idx.next, %n br i1 %next, label %loop, label %exit %exit: ret void %out.of.bounds: ret void } Transformation seems to be correct! (syntactically equal) -- 3. IRCEPass ---------------------------------------- define void @multiple_access_no_preloop(ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) { %entry: %len.a = load i32, ptr %a_len_ptr, align 4 %range_l#0%len.a = icmp sge i32 %len.a, 0 %range_h#0%len.a = icmp slt i32 %len.a, 2147483647 %range#0%len.a = and i1 %range_l#0%len.a, %range_h#0%len.a assume_non_poison i1 %range#0%len.a %len.b = load i32, ptr %b_len_ptr, align 4 %range_l#0%len.b = icmp sge i32 %len.b, 0 %range_h#0%len.b = icmp slt i32 %len.b, 2147483647 %range#0%len.b = and i1 %range_l#0%len.b, %range_h#0%len.b assume_non_poison i1 %range#0%len.b %first.itr.check = icmp sgt i32 %n, 0 br i1 %first.itr.check, label %loop, label %exit %loop: %idx = phi i32 [ 0, %entry ], [ %idx.next, %in.bounds.b ] %idx.next = add i32 %idx, 1 %abc.a = icmp slt i32 %idx, %len.a br i1 %abc.a, label %in.bounds.a, label %out.of.bounds %in.bounds.a: %addr.a = gep ptr %arr_a, 4 x i32 %idx store i32 0, ptr %addr.a, align 4 %abc.b = icmp slt i32 %idx, %len.b br i1 %abc.b, label %in.bounds.b, label %out.of.bounds %in.bounds.b: %addr.b = gep ptr %arr_b, 4 x i32 %idx store i32 4294967295, ptr %addr.b, align 4 %next = icmp slt i32 %idx.next, %n br i1 %next, label %loop, label %exit %exit: ret void %out.of.bounds: ret void } => define void @multiple_access_no_preloop(ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) { %entry: %len.a = load i32, ptr %a_len_ptr, align 4 %range_l#0%len.a = icmp sge i32 %len.a, 0 %range_h#0%len.a = icmp slt i32 %len.a, 2147483647 %range#0%len.a = and i1 %range_l#0%len.a, %range_h#0%len.a assume_non_poison i1 %range#0%len.a %len.b = load i32, ptr %b_len_ptr, align 4 %range_l#0%len.b = icmp sge i32 %len.b, 0 %range_h#0%len.b = icmp slt i32 %len.b, 2147483647 %range#0%len.b = and i1 %range_l#0%len.b, %range_h#0%len.b assume_non_poison i1 %range#0%len.b %first.itr.check = icmp sgt i32 %n, 0 br i1 %first.itr.check, label %loop.preheader, label %exit %loop.preheader: %smin = smin i32 %len.b, %len.a %smin1 = smin i32 %smin, %n %exit.mainloop.at = smax i32 %smin1, 0 %0 = icmp slt i32 0, %exit.mainloop.at br i1 %0, label %loop.preheader2, label %main.pseudo.exit %loop.preheader2: br label %loop %loop: %idx = phi i32 [ %idx.next, %in.bounds.b ], [ 0, %loop.preheader2 ] %idx.next = add i32 %idx, 1 br i1 1, label %in.bounds.a, label %out.of.bounds.loopexit3 %in.bounds.a: %addr.a = gep ptr %arr_a, 4 x i32 %idx store i32 0, ptr %addr.a, align 4 br i1 1, label %in.bounds.b, label %out.of.bounds.loopexit3 %in.bounds.b: %addr.b = gep ptr %arr_b, 4 x i32 %idx store i32 4294967295, ptr %addr.b, align 4 %1 = icmp slt i32 %idx.next, %exit.mainloop.at br i1 %1, label %loop, label %main.exit.selector %main.exit.selector: %idx.next.lcssa = phi i32 [ %idx.next, %in.bounds.b ] %2 = icmp slt i32 %idx.next.lcssa, %n br i1 %2, label %main.pseudo.exit, label %exit.loopexit %out.of.bounds.loopexit3: br label %out.of.bounds %main.pseudo.exit: %idx.copy = phi i32 [ 0, %loop.preheader ], [ %idx.next.lcssa, %main.exit.selector ] %indvar.end = phi i32 [ 0, %loop.preheader ], [ %idx.next.lcssa, %main.exit.selector ] br label %postloop %postloop: br label %loop.postloop %loop.postloop: %idx.postloop = phi i32 [ %idx.next.postloop, %in.bounds.b.postloop ], [ %idx.copy, %postloop ] %idx.next.postloop = add i32 %idx.postloop, 1 %abc.a.postloop = icmp slt i32 %idx.postloop, %len.a br i1 %abc.a.postloop, label %in.bounds.a.postloop, label %out.of.bounds.loopexit %in.bounds.a.postloop: %addr.a.postloop = gep ptr %arr_a, 4 x i32 %idx.postloop store i32 0, ptr %addr.a.postloop, align 4 %abc.b.postloop = icmp slt i32 %idx.postloop, %len.b br i1 %abc.b.postloop, label %in.bounds.b.postloop, label %out.of.bounds.loopexit %in.bounds.b.postloop: %addr.b.postloop = gep ptr %arr_b, 4 x i32 %idx.postloop store i32 4294967295, ptr %addr.b.postloop, align 4 %next.postloop = icmp slt i32 %idx.next.postloop, %n br i1 %next.postloop, label %loop.postloop, label %exit.loopexit.loopexit %exit.loopexit.loopexit: br label %exit.loopexit %exit.loopexit: br label %exit %exit: ret void %out.of.bounds.loopexit: br label %out.of.bounds %out.of.bounds: ret void } Transformation doesn't verify! (unsound) ERROR: Source is more defined than target Example: ptr %arr_a = poison ptr %a_len_ptr = pointer(non-local, block_id=1, offset=536883494652) ptr %arr_b = poison ptr %b_len_ptr = pointer(non-local, block_id=3, offset=274877906940) i32 %n = #x00000005 (5) Source: i32 %len.a = #x00000000 (0) i1 %range_l#0%len.a = #x1 (1) i1 %range_h#0%len.a = #x1 (1) i1 %range#0%len.a = #x1 (1) i32 %len.b = poison i1 %range_l#0%len.b = poison i1 %range_h#0%len.b = poison i1 %range#0%len.b = poison i1 %first.itr.check = #x1 (1) >> Jump to %loop i32 %idx = #x00000000 (0) i32 %idx.next = #x00000001 (1) i1 %abc.a = #x0 (0) >> Jump to %out.of.bounds SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 4 alloc type: 0 Block 1 > size: 549755813888 align: 65536 alloc type: 0 Block 2 > align: 4 alloc type: 0 Block 3 > size: 549755813888 align: 32 alloc type: 0 Block 4 > align: 2 alloc type: 0 Target: i32 %len.a = #x00000000 (0) i1 %range_l#0%len.a = #x1 (1) i1 %range_h#0%len.a = #x1 (1) i1 %range#0%len.a = #x1 (1) i32 %len.b = poison i1 %range_l#0%len.b = poison i1 %range_h#0%len.b = poison i1 %range#0%len.b = poison i1 %first.itr.check = #x1 (1) >> Jump to %loop.preheader i32 %smin = poison i32 %smin1 = poison i32 %exit.mainloop.at = poison i1 %0 = poison UB triggered on br Pass: IRCEPass 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' '-verify-loop-info' '-passes=irce' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats' ------------------- SMT STATS ------------------- Num queries: 6 Num invalid: 0 Num skips: 0 Num trivial: 16 (72.7%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 6 (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/IRCE/multiple-access-no-preloop.ll + /home/nlopes/alive2/build/opt-alive.sh -verify-loop-info -passes=irce -S FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll