[llvm-bugs] [Bug 51092] New: Duplicate select instruction causing one use check failure
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 14 11:03:10 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51092
Bug ID: 51092
Summary: Duplicate select instruction causing one use check
failure
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
nikita.ppv at gmail.com, spatel+llvm at rotateright.com
https://godbolt.org/z/4avqKsT4x
struct PayLoad
{
unsigned short data[3];
};
void sort(PayLoad* pData, int lo, int hi, int ishi)
{
if (ishi)
{
pData->data[hi]++;
}
else
{
pData->data[lo]++;
}
}
%struct.PayLoad = type { [3 x i16] }
define void @_Z4sortP7PayLoadiii(%struct.PayLoad* nocapture %0, i32 %1, i32 %2,
i32 %3) {
%5 = icmp eq i32 %3, 0
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds %struct.PayLoad, %struct.PayLoad* %0, i64 0, i32
0, i64 %6
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds %struct.PayLoad, %struct.PayLoad* %0, i64 0, i32
0, i64 %8
%10 = select i1 %5, i16* %7, i16* %9
%11 = select i1 %5, i16* %7, i16* %9
%12 = load i16, i16* %10, align 2, !tbaa !3
%13 = add i16 %12, 1
store i16 %13, i16* %11, align 2, !tbaa !3
ret void
}
I'm currently investigating supporting select(gep,gep) folding for geps with >
2 operands, but we fail the one use check on this reduced test case as we end
up with the same select instruction twice which never get merged.
Should these be merged or not?
--
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/20210714/359f1708/attachment.html>
More information about the llvm-bugs
mailing list