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

Test source: git

Comments: LLVM bug: memcmp -> load i32 lowering

Log:

Source: <stdin>

----------------------------------------
@charbuf = constant 4 bytes, align 1

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

%0:
  %__constexpr_0 = gep inbounds ptr @charbuf, 4 x i64 0, 1 x i64 0
  %call = memcmp ptr align(4) %x, ptr %__constexpr_0, 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) denormal-fp-math=ieee,ieee {
#init:
  store [4 x i8] { 0, 0, 0, 1 }, ptr @charbuf, align 1
  br label %0

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

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

Source:
  >> Jump to %0
ptr %__constexpr_0 = pointer(non-local, block_id=1, offset=0)
i32 %call = #x00000000 (0)
i1 %cmpeq0 = #x1 (1)

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	address: 0
Block 1 >	size: 4	align: 1	alloc type: 0	address: 2
Block 2 >	size: 11	align: 2	alloc type: 0	address: 8

Target:
  >> Jump to %0
ptr %1 = pointer(non-local, block_id=2, offset=0)
i32 %lhsv = poison
i1 %.not = poison
Source value: #x1 (1)
Target value: poison


------------------- SMT STATS -------------------
Num queries: 5
Num invalid: 0
Num skips:   0
Num trivial: 7 (58.3%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     4 (80.0%)
Num UNSAT:   1 (20.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/build/opt-alive.sh -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

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

 

<-- Back