Test Failure: Transforms/MergeICmps/X86/split-block-does-work.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<llvm::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=48, attrs=3) / Address=#x38
ptr nocapture nowrite dereferenceable(16) %b = pointer(non-local, block_id=1, offset=12, attrs=3) / Address=#x14

Source:
i32 %#0 = #x20010100 (536936704)
i32 %#1 = #x00000040 (64)
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: 64	align: 8	alloc type: 2	alive: false	address: 8
Contents:
22: #x00
14: #x00
53: null, byte offset=0
52: null, byte offset=0
18: null, byte offset=0
59: #x00
58: #x00
56: null, byte offset=0
48: #x00
15: #x00
50: #x01
21: null, byte offset=0
57: #x02
51: #x20
19: null, byte offset=0
54: #x01
23: #x00
49: #x01
13: #x00
12: #x40
17: #x10
55: #x01
16: #x01
20: #x01
*: poison

Block 2 >	size: 0	align: 8	alloc type: 2	alive: false	address: 8
Contents:
22: #x01
14: #x40
19: #x00
18: #x00
23: #x01
13: #x01
12: #x00
15: #x01
17: #x00
21: #x00
16: #x00
20: #x00
*: poison

Block 3 >	size: 0	align: 1	alloc type: 0	alive: true	address: 8

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_utsq1gCE_FiCX.bc"


------------------- SMT STATS -------------------
Num queries: 68
Num invalid: 0
Num skips:   0
Num trivial: 6 (8.1%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     54 (79.4%)
Num UNSAT:   14 (20.6%)
Alive2: Transform doesn't verify; aborting!

stderr:

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

 

<-- Back