Test Failure: Transforms/InstCombine/bswap.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i32 @test1(i32 %i) {
%0:
  %tmp1 = lshr i32 %i, 24
  %tmp3 = lshr i32 %i, 8
  %tmp4 = and i32 %tmp3, 65280
  %tmp5 = or i32 %tmp1, %tmp4
  %tmp7 = shl i32 %i, 8
  %tmp8 = and i32 %tmp7, 16711680
  %tmp9 = or i32 %tmp5, %tmp8
  %tmp11 = shl i32 %i, 24
  %tmp12 = or i32 %tmp9, %tmp11
  ret i32 %tmp12
}
=>
define i32 @test1(i32 %i) {
%0:
  %tmp12 = bswap i32 %i
  ret i32 %tmp12
}
Transformation seems to be correct!


----------------------------------------
define i32 @test2(i32 %arg) {
%0:
  %tmp2 = shl i32 %arg, 24
  %tmp4 = shl i32 %arg, 8
  %tmp5 = and i32 %tmp4, 16711680
  %tmp6 = or i32 %tmp2, %tmp5
  %tmp8 = lshr i32 %arg, 8
  %tmp9 = and i32 %tmp8, 65280
  %tmp10 = or i32 %tmp6, %tmp9
  %tmp12 = lshr i32 %arg, 24
  %tmp14 = or i32 %tmp10, %tmp12
  ret i32 %tmp14
}
=>
define i32 @test2(i32 %arg) {
%0:
  %tmp14 = bswap i32 %arg
  ret i32 %tmp14
}
Transformation seems to be correct!


----------------------------------------
define i16 @test3(i16 %s) {
%0:
  %tmp2 = lshr i16 %s, 8
  %tmp4 = shl i16 %s, 8
  %tmp5 = or i16 %tmp2, %tmp4
  ret i16 %tmp5
}
=>
define i16 @test3(i16 %s) {
%0:
  %tmp5 = bswap i16 %s
  ret i16 %tmp5
}
Transformation seems to be correct!


----------------------------------------
define i16 @test4(i16 %s) {
%0:
  %tmp2 = lshr i16 %s, 8
  %tmp4 = shl i16 %s, 8
  %tmp5 = or i16 %tmp4, %tmp2
  ret i16 %tmp5
}
=>
define i16 @test4(i16 %s) {
%0:
  %tmp5 = bswap i16 %s
  ret i16 %tmp5
}
Transformation seems to be correct!


----------------------------------------
define i16 @test5(i16 %a) {
%0:
  %tmp = zext i16 %a to i32
  %tmp1 = and i32 %tmp, 65280
  %tmp2 = ashr i32 %tmp1, 8
  %tmp2.upgrd.1 = trunc i32 %tmp2 to i16
  %tmp4 = and i32 %tmp, 255
  %tmp5 = shl i32 %tmp4, 8
  %tmp5.upgrd.2 = trunc i32 %tmp5 to i16
  %tmp.upgrd.3 = or i16 %tmp2.upgrd.1, %tmp5.upgrd.2
  %tmp6 = bitcast i16 %tmp.upgrd.3 to i16
  %tmp6.upgrd.4 = zext i16 %tmp6 to i32
  %retval = trunc i32 %tmp6.upgrd.4 to i16
  ret i16 %retval
}
=>
define i16 @test5(i16 %a) {
%0:
  %tmp.upgrd.3 = bswap i16 %a
  ret i16 %tmp.upgrd.3
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @test6(i32 %x) {
%0:
  %tmp = shl i32 %x, 16
  %x.mask = and i32 %x, 65280
  %tmp1 = lshr i32 %x, 16
  %tmp2 = and i32 %tmp1, 255
  %tmp3 = or i32 %x.mask, %tmp
  %tmp4 = or i32 %tmp3, %tmp2
  %tmp5 = shl i32 %tmp4, 8
  %tmp6 = lshr i32 %x, 24
  %tmp7 = or i32 %tmp5, %tmp6
  ret i32 %tmp7
}
=>
define i32 @test6(i32 %x) {
%0:
  %tmp7 = bswap i32 %x
  ret i32 %tmp7
}
Transformation seems to be correct!


----------------------------------------
define i32 @bswap32_and_first(i32 %x) {
%0:
  %shl = shl i32 %x, 16
  %shr = lshr i32 %x, 16
  %swaphalf = or i32 %shl, %shr
  %t = and i32 %swaphalf, 16711935
  %tshl = shl nuw i32 %t, 8
  %b = lshr i32 %swaphalf, 8
  %band = and i32 %b, 16711935
  %bswap = or i32 %tshl, %band
  ret i32 %bswap
}
=>
define i32 @bswap32_and_first(i32 %x) {
%0:
  %bswap = bswap i32 %x
  ret i32 %bswap
}
Transformation seems to be correct!


----------------------------------------
define i32 @bswap32_and_first_extra_use(i32 %x) {
%0:
  %shl = shl i32 %x, 16
  %shr = lshr i32 %x, 16
  %swaphalf = or i32 %shl, %shr
  %t = and i32 %swaphalf, 16711935
  %tshl = shl nuw i32 %t, 8
  %b = lshr i32 %swaphalf, 8
  %band = and i32 %b, 16711935
  %bswap = or i32 %tshl, %band
  call void @extra_use(i32 %t)
  ret i32 %bswap
}
=>
define i32 @bswap32_and_first_extra_use(i32 %x) {
%0:
  %shl = shl i32 %x, 16
  %shr = lshr i32 %x, 16
  %swaphalf = or i32 %shl, %shr
  %t = and i32 %swaphalf, 16711935
  %bswap = bswap i32 %x
  call void @extra_use(i32 %t)
  ret i32 %bswap
}
Transformation seems to be correct!


----------------------------------------
define i32 @bswap32_shl_first(i32 %x) {
%0:
  %shl = shl i32 %x, 16
  %shr = lshr i32 %x, 16
  %swaphalf = or i32 %shl, %shr
  %t = shl i32 %swaphalf, 8
  %tand = and i32 %t, 4278255360
  %b = lshr i32 %swaphalf, 8
  %band = and i32 %b, 16711935
  %bswap = or i32 %tand, %band
  ret i32 %bswap
}
=>
define i32 @bswap32_shl_first(i32 %x) {
%0:
  %bswap = bswap i32 %x
  ret i32 %bswap
}
Transformation seems to be correct!


----------------------------------------
define i32 @bswap32_shl_first_extra_use(i32 %x) {
%0:
  %shl = shl i32 %x, 16
  %shr = lshr i32 %x, 16
  %swaphalf = or i32 %shl, %shr
  %t = shl i32 %swaphalf, 8
  %tand = and i32 %t, 4278255360
  %b = lshr i32 %swaphalf, 8
  %band = and i32 %b, 16711935
  %bswap = or i32 %tand, %band
  call void @extra_use(i32 %t)
  ret i32 %bswap
}
=>
define i32 @bswap32_shl_first_extra_use(i32 %x) {
%0:
  %shr = lshr i32 %x, 16
  %1 = shl i32 %x, 24
  %2 = shl nsw nuw i32 %shr, 8
  %t = or i32 %1, %2
  %bswap = bswap i32 %x
  call void @extra_use(i32 %t)
  ret i32 %bswap
}
Transformation seems to be correct!


----------------------------------------
define i16 @test8(i16 %a) {
%0:
  %conv = zext i16 %a to i32
  %shr = lshr i16 %a, 8
  %shl = shl i32 %conv, 8
  %conv1 = zext i16 %shr to i32
  %or = or i32 %conv1, %shl
  %conv2 = trunc i32 %or to i16
  ret i16 %conv2
}
=>
define i16 @test8(i16 %a) {
%0:
  %rev = bswap i16 %a
  ret i16 %rev
}
Transformation seems to be correct!


----------------------------------------
define i16 @test9(i16 %a) {
%0:
  %conv = zext i16 %a to i32
  %shr = lshr i32 %conv, 8
  %shl = shl i32 %conv, 8
  %or = or i32 %shr, %shl
  %conv2 = trunc i32 %or to i16
  ret i16 %conv2
}
=>
define i16 @test9(i16 %a) {
%0:
  %rev = bswap i16 %a
  ret i16 %rev
}
Transformation seems to be correct!


----------------------------------------
define i16 @test10(i32 %a) {
%0:
  %shr1 = lshr i32 %a, 8
  %and1 = and i32 %shr1, 255
  %and2 = shl i32 %a, 8
  %shl1 = and i32 %and2, 65280
  %or = or i32 %and1, %shl1
  %conv = trunc i32 %or to i16
  ret i16 %conv
}
=>
define i16 @test10(i32 %a) {
%0:
  %trunc = trunc i32 %a to i16
  %rev = bswap i16 %trunc
  ret i16 %rev
}
Transformation seems to be correct!


----------------------------------------
define i32 @shuf_4bytes(<4 x i8> %x) {
%0:
  %bswap = shufflevector <4 x i8> %x, <4 x i8> undef, 3, 2, 1, 0
  %cast = bitcast <4 x i8> %bswap to i32
  ret i32 %cast
}
=>
define i32 @shuf_4bytes(<4 x i8> %x) {
%0:
  %1 = bitcast <4 x i8> %x to i32
  %cast = bswap i32 %1
  ret i32 %cast
}
Transformation seems to be correct!


----------------------------------------
define i32 @shuf_load_4bytes(* %p) {
%0:
  %x = load <4 x i8>, * %p, align 4
  %bswap = shufflevector <4 x i8> %x, <4 x i8> undef, 3, 2, 4294967295, 0
  %cast = bitcast <4 x i8> %bswap to i32
  ret i32 %cast
}
=>
define i32 @shuf_load_4bytes(* %p) {
%0:
  %1 = bitcast * %p to *
  %x1 = load i32, * %1, align 4
  %cast = bswap i32 %x1
  ret i32 %cast
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source

Example:
* %p = pointer(non-local, block_id=1, offset=0)

Source:
<4 x i8> %x = < #x00 (0), poison, #x00 (0), #x00 (0) >
<4 x i8> %bswap = < #x00 (0), #x00 (0), undef, #x00 (0) >
i32 %cast = #x00000000 (0)	[based on undef value]

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 32	alloc type: 0
Block 1 >	size: 8	align: 0	alloc type: 0

Target:
* %1 = pointer(non-local, block_id=1, offset=0)
i32 %x1 = poison
i32 %cast = poison
Source value: #x00000000 (0)
Target value: poison


------------------- SMT STATS -------------------
Num queries: 40
Num invalid: 0
Num skips:   0
Num trivial: 49 (55.1%)
Num timeout: 1 (2.5%)
Num errors:  0 (0.0%)
Num SAT:     17 (42.5%)
Num UNSAT:   22 (55.0%)

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/scripts/opt-alive.sh -instcombine -S
+ /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/bswap.ll

Alive2: Transform doesn't verify; aborting!
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/bswap.ll

 

<-- Back