Test source: git
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<Function> : Skipping NOP -- 2. MergeICmpsPass ---------------------------------------- declare void @foo(...) define i1 @opeq1(ptr nocapture nowrite dereferenceable(16) %a, ptr nocapture nowrite dereferenceable(16) %b) nofree zeroext { entry: %#0 = load i32, ptr nocapture nowrite dereferenceable(16) %a, align 4 %#1 = load i32, ptr nocapture nowrite dereferenceable(16) %b, align 4 call void @foo() memory(inaccessiblemem: readwrite) %cmp.i = icmp eq i32 %#0, %#1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: %second.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 4 %#2 = load i32, ptr %second.i, align 4 %second2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 4 %#3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %#2, %#3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: %third.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 8 %#4 = load i32, ptr %third.i, align 4 %third2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 8 %#5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %#4, %#5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: %fourth.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 12 %#6 = load i32, ptr %fourth.i, align 4 %fourth2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 12 %#7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %#6, %#7 br label %opeq1.exit opeq1.exit: %#8 = phi i1 [ 0, %entry ], [ 0, %land.rhs.i ], [ 0, %land.rhs.i.2 ], [ %cmp4.i, %land.rhs.i.3 ] ret i1 %#8 } Transformation seems to be correct! (syntactically equal) -- 3. MergeICmpsPass ---------------------------------------- declare void @foo(...) define i1 @opeq1(ptr nocapture nowrite dereferenceable(16) %a, ptr nocapture nowrite dereferenceable(16) %b) nofree zeroext { entry: %#0 = load i32, ptr nocapture nowrite dereferenceable(16) %a, align 4 %#1 = load i32, ptr nocapture nowrite dereferenceable(16) %b, align 4 call void @foo() memory(inaccessiblemem: readwrite) %cmp.i = icmp eq i32 %#0, %#1 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit land.rhs.i: %second.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 4 %#2 = load i32, ptr %second.i, align 4 %second2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 4 %#3 = load i32, ptr %second2.i, align 4 %cmp2.i = icmp eq i32 %#2, %#3 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit land.rhs.i.2: %third.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 8 %#4 = load i32, ptr %third.i, align 4 %third2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 8 %#5 = load i32, ptr %third2.i, align 4 %cmp3.i = icmp eq i32 %#4, %#5 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit land.rhs.i.3: %fourth.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %a, 16 x i64 0, 1 x i64 12 %#6 = load i32, ptr %fourth.i, align 4 %fourth2.i = gep inbounds ptr nocapture nowrite dereferenceable(16) %b, 16 x i64 0, 1 x i64 12 %#7 = load i32, ptr %fourth2.i, align 4 %cmp4.i = icmp eq i32 %#6, %#7 br label %opeq1.exit opeq1.exit: %#8 = phi i1 [ 0, %entry ], [ 0, %land.rhs.i ], [ 0, %land.rhs.i.2 ], [ %cmp4.i, %land.rhs.i.3 ] ret i1 %#8 } => declare void @foo(...) declare i32 @memcmp(nocapture ptr, nocapture ptr, i64) nofree willreturn memory(argmem: read) define i1 @opeq1(ptr nocapture nowrite dereferenceable(16) %a, ptr nocapture nowrite dereferenceable(16) %b) nofree zeroext { entry+land.rhs.i+land.rhs.i.2+land.rhs.i.3: call void @foo() memory(inaccessiblemem: readwrite) %memcmp = memcmp ptr nocapture nowrite dereferenceable(16) %a, ptr nocapture nowrite dereferenceable(16) %b, i64 16 %#0 = icmp eq i32 %memcmp, 0 br label %opeq1.exit opeq1.exit: ret i1 %#0 } Transformation doesn't verify! (unsound) ERROR: Source is more defined than target Example: ptr nocapture nowrite dereferenceable(16) %a = pointer(non-local, block_id=1, offset=8, attrs=3) / Address=#x10 ptr nocapture nowrite dereferenceable(16) %b = pointer(non-local, block_id=1, offset=24, attrs=3) / Address=#x20 Source: i32 %#0 = #x01010102 (16843010) i32 %#1 = #x00040000 (262144) Function @foo returned i1 %cmp.i = #x0 (0) >> Jump to %opeq1.exit i1 %#8 = #x0 (0) SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: 0 Block 1 > size: 129 align: 8 alloc type: 2 alive: false address: 8 Contents: 11: #x01 10: #x01 26: #x04 9: #x01 25: #x00 24: #x00 8: #x02 27: #x00 33: #x04 17: #x40 *: poison Block 2 > size: 0 align: 8 alloc type: 2 alive: false address: 8 Block 3 > size: 0 align: 2 alloc type: 0 alive: true address: 4 Target: Function @foo returned i32 %memcmp = UB triggered! Pass: MergeICmpsPass 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' '-passes=mergeicmps' '-verify-dom-info' '-mtriple=x86_64-unknown-unknown' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats' Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_R35D46aC_Ab8j.bc" ------------------- SMT STATS ------------------- Num queries: 47 Num invalid: 0 Num skips: 0 Num trivial: 6 (11.3%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 30 (63.8%) Num UNSAT: 17 (36.2%) Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll -passes=mergeicmps -verify-dom-info -mtriple=x86_64-unknown-unknown -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll --check-prefix=X86 + /home/nlopes/alive2/build/opt-alive.sh -passes=mergeicmps -verify-dom-info -mtriple=x86_64-unknown-unknown -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll --check-prefix=X86 FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll --check-prefix=X86