[llvm-bugs] [Bug 46662] New: merge truncated stores
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 9 12:04:49 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46662
Bug ID: 46662
Summary: merge truncated stores
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
void i32(long long x, int* p) {
int a = x;
int b = x >> 32;
p[0] = a;
p[1] = b;
}
define void @i32(i64 %0, i32* nocapture %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
store i32 %3, i32* %1, align 4
%6 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %5, i32* %6, align 4
ret void
}
--------------------------------------------------------------------------
Compiles to x86-64:
movl %edi, (%rsi)
shrq $32, %rdi
movl %edi, 4(%rsi)
retq
--------------------------------------------------------------------------
But that could be only:
movq %rdi, (%rsi)
In DAGCombiner, we have MatchStoreCombine(), but it only handles 8-bit; we have
mergeConsecutiveStores(), but it doesn't look at trunc patterns.
https://godbolt.org/z/xMPxT9
--
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/20200709/1eb280ce/attachment.html>
More information about the llvm-bugs
mailing list