[llvm-bugs] [Bug 49832] New: InstCombine incorrectly folds select of vector
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 4 06:45:04 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49832
Bug ID: 49832
Summary: InstCombine incorrectly folds select of vector
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: juneyoung.lee at sf.snu.ac.kr
CC: llvm-bugs at lists.llvm.org
```
$ cat src.ll
define void @src(<2 x i32> %input) {
%cond = icmp eq <2 x i32> %input, zeroinitializer
%.14 = extractelement <2 x i32> %input, i32 1
%.15 = insertelement <2 x i32> poison, i32 %.14, i32 0
%.16 = extractelement <2 x i32> %input, i32 0
%.17 = insertelement <2 x i32> %.15, i32 %.16, i32 1
%.18 = select <2 x i1> %cond, <2 x i32> %.17, <2 x i32> %input
%x = extractelement <2 x i32> %.18, i32 0
%y = extractelement <2 x i32> %.18, i32 1
call void @f(i32 %x, i32 %y)
ret void
}
declare void @f(i32, i32)
$ opt -instcombine -S -o - src.ll
define void @src(<2 x i32> %input) {
%x = extractelement <2 x i32> %input, i32 0
%y = extractelement <2 x i32> %input, i32 1
call void @f(i32 %x, i32 %y)
ret void
}
declare void @f(i32, i32)
```
This is incorrect: https://alive2.llvm.org/ce/z/8X-4kR
If input is <0, 2>, (%x, %y) is (2, 2) in src, but it becomes (0, 2) in tgt.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210404/9fb19dc1/attachment.html>
More information about the llvm-bugs
mailing list