Test Failure: Transforms/InstCombine/memcmp-1.ll

Test source: git

Comments: LLVM bug: load type punning. needs byte type

Log:

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

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify1(ptr %mem, i32 %size) {
#0:
  %ret = memcmp ptr %mem, ptr %mem, i32 %size
  ret i32 %ret
}
Transformation seems to be correct! (syntactically equal)

-- 3. InstCombinePass

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify1(ptr %mem, i32 %size) {
#0:
  %ret = memcmp ptr %mem, ptr %mem, i32 %size
  ret i32 %ret
}
=>
define i32 @test_simplify1(ptr %mem, i32 %size) {
#0:
  ret i32 0
}
Transformation seems to be correct!

-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. InstCombinePass

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify2(ptr %mem1, ptr %mem2) {
#0:
  %ret = memcmp ptr %mem1, ptr %mem2, i32 0
  ret i32 %ret
}
Transformation seems to be correct! (syntactically equal)

-- 7. InstCombinePass

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify2(ptr %mem1, ptr %mem2) {
#0:
  %ret = memcmp ptr %mem1, ptr %mem2, i32 0
  ret i32 %ret
}
=>
define i32 @test_simplify2(ptr %mem1, ptr %mem2) {
#0:
  ret i32 0
}
Transformation seems to be correct!

-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Function> : Skipping NOP
-- 10. InstCombinePass

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify3(ptr %mem1, ptr %mem2) {
#0:
  %ret = memcmp ptr %mem1, ptr %mem2, i32 1
  ret i32 %ret
}
Transformation seems to be correct! (syntactically equal)

-- 11. InstCombinePass

----------------------------------------
declare i32 @memcmp(ptr, ptr, i32)

define i32 @test_simplify3(ptr %mem1, ptr %mem2) {
#0:
  %ret = memcmp ptr %mem1, ptr %mem2, i32 1
  ret i32 %ret
}
=>
define i32 @test_simplify3(ptr %mem1, ptr %mem2) {
#0:
  %lhsc = load i8, ptr %mem1, align 1
  %lhsv = zext i8 %lhsc to i32
  %rhsc = load i8, ptr %mem2, align 1
  %rhsv = zext i8 %rhsc to i32
  %chardiff = sub nsw i32 %lhsv, %rhsv
  ret i32 %chardiff
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source

Example:
ptr %mem1 = pointer(non-local, block_id=1, offset=0) / Address=#x8
ptr %mem2 = pointer(non-local, block_id=2, offset=0) / Address=#x2

Source:
i32 %ret = #x80000000 (2147483648, -2147483648)

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0
Block 1 >	size: 4	align: 8	alloc type: 0	alive: true	address: 8
Contents:
*: null, byte offset=0

Block 2 >	size: 4	align: 1	alloc type: 0	alive: true	address: 2
Contents:
*: #x04


Target:
i8 %lhsc = poison
i32 %lhsv = poison
i8 %rhsc = #x04 (4)
i32 %rhsv = #x00000004 (4)
i32 %chardiff = poison
Source value: #x80000000 (2147483648, -2147483648)
Target value: poison

Pass: InstCombinePass
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=instcombine' '-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_s6D7sFRX_lG7Y.bc"


------------------- SMT STATS -------------------
Num queries: 31
Num invalid: 0
Num skips:   0
Num trivial: 20 (39.2%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     20 (64.5%)
Num UNSAT:   11 (35.5%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 3: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-1.ll -passes=instcombine -S | /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=CHECK --check-prefix=NOBCMP /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-1.ll
+ /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S
+ /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=CHECK --check-prefix=NOBCMP /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-1.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=CHECK --check-prefix=NOBCMP /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-1.ll

 

<-- Back