Skip to content

[VectorCombine] miscompilation #114901

Closed
Closed
@bongjunj

Description

@bongjunj

Alive2 report: https://alive2.llvm.org/ce/z/YwSTI4

----------------------------------------
define i1 @icmp_xor_v4i32.2(<4 x i32> %a) {
#0:
  %e1 = extractelement <4 x i32> %a, i32 3
  %e2 = extractelement <4 x i32> %a, i32 1
  %cmp1 = icmp sgt i32 %e1, 42
  %cmp2 = icmp sgt i32 %e2, 4294967288
  %#1 = ashr i1 %cmp1, %cmp2
  ret i1 %#1
}
=>
define i1 @icmp_xor_v4i32.2(<4 x i32> %a) {
#0:
  %#1 = icmp sgt <4 x i32> %a, { poison, 4294967288, poison, 42 }
  %shift = shufflevector <4 x i1> %#1, <4 x i1> poison, 4294967295, 3, 4294967295, 4294967295
  %#2 = ashr <4 x i1> %#1, %shift
  %#3 = extractelement <4 x i1> %#2, i64 1
  ret i1 %#3
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
<4 x i32> %a = < #x00000000 (0), #xfffffff8 (4294967288, -8), #x00000000 (0), #x0000002b (43) >

Source:
i32 %e1 = #x0000002b (43)
i32 %e2 = #xfffffff8 (4294967288, -8)
i1 %cmp1 = #x1 (1)
i1 %cmp2 = #x0 (0)
i1 %#1 = #x1 (1)

Target:
<4 x i1> %#1 = < poison, #x0 (0), poison, #x1 (1) >
<4 x i1> %shift = < poison, #x1 (1), poison, poison >
<4 x i1> %#2 = < poison, poison, poison, poison >
i1 %#3 = poison
Source value: #x1 (1)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions