Test Failure: Transforms/InstCombine/memcmp-constant-fold.ll

Test source: git

Comments: LLVM bug: memcmp -> load i32 lowering

Log:

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

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

@charbuf = constant 4 bytes, align 1

define i1 @memcmp_4bytes_unaligned_constant_i8(ptr align(4) %x) {
init:
  store [4 x i8] { 0, 0, 0, 1 }, ptr @charbuf, align 1
  br label %#0

#0:
  %call = tail memcmp ptr align(4) %x, ptr @charbuf, i64 4
  %cmpeq0 = icmp eq i32 %call, 0
  ret i1 %cmpeq0
}
Transformation seems to be correct! (syntactically equal)

-- 3. InstCombinePass

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

@charbuf = constant 4 bytes, align 1

define i1 @memcmp_4bytes_unaligned_constant_i8(ptr align(4) %x) {
init:
  store [4 x i8] { 0, 0, 0, 1 }, ptr @charbuf, align 1
  br label %#0

#0:
  %call = tail memcmp ptr align(4) %x, ptr @charbuf, i64 4
  %cmpeq0 = icmp eq i32 %call, 0
  ret i1 %cmpeq0
}
=>
@charbuf = constant 4 bytes, align 1

define i1 @memcmp_4bytes_unaligned_constant_i8(ptr align(4) %x) {
init:
  store [4 x i8] { 0, 0, 0, 1 }, ptr @charbuf, align 1
  br label %#0

#0:
  %lhsv = load i32, ptr align(4) %x, align 4
  %.not = icmp eq i32 %lhsv, 16777216
  ret i1 %.not
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source

Example:
ptr align(4) %x = pointer(non-local, block_id=2, offset=0) / Address=#x0c

Source:
  >> Jump to %#0
i32 %call = #x00000001 (1)
i1 %cmpeq0 = #x0 (0)

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: #x00
Block 1 >	size: 4	align: 1	alloc type: 0	alive: true	address: #x08	const
Block 2 >	size: 7	align: 1	alloc type: 4	alive: true	address: #x0c
Contents:
3: poison
*: #x01


Target:
  >> Jump to %#0
i32 %lhsv = poison
i1 %.not = poison

TARGET MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: #x00
Block 1 >	size: 4	align: 1	alloc type: 0	alive: true	address: #x08	const
Block 2 >	size: 7	align: 1	alloc type: 4	alive: true	address: #x0c
Contents:
3: poison
*: #x01

Source value: #x0 (0)
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' '-data-layout=e-n32' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'

Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_CKt8oRjG_h0cl.bc"

------------------- SMT STATS -------------------
Num queries: 31
Num invalid: 0
Num skips:   0
Num trivial: 5 (13.9%)
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:

Transforms/InstCombine/memcmp-constant-fold.ll' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-constant-fold.ll -passes=instcombine -S -data-layout=e-n32 | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-constant-fold.ll --check-prefix=ALL --check-prefix=LE
# executed command: /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S -data-layout=e-n32
# .---command stderr------------
# `-----------------------------
# error: command failed with exit status: 1
# executed command: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-constant-fold.ll --check-prefix=ALL --check-prefix=LE
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/memcmp-constant-fold.ll --check-prefix=ALL --check-prefix=LE
# `-----------------------------
# error: command failed with exit status: 2

--

 

<-- Back