[PATCH] D14596: [SROA] Choose more profitable type in findCommonType
Guozhi Wei via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 9 15:53:07 PST 2016
Carrot updated this revision to Diff 50211.
Carrot added a comment.
Please take another look.
I updated the patch a little to avoid change volatile memory access instructions, since volatile ld/st with bitcast can't be combined.
The changes compared to last version is:
Index: lib/Transforms/InstCombine/InstCombineCasts.cpp
======================================================
- lib/Transforms/InstCombine/InstCombineCasts.cpp (revision 262910)
+++ lib/Transforms/InstCombine/InstCombineCasts.cpp (working copy)
@@ -1815,8 +1815,9 @@
if (isa<Constant>(IncValue))
continue;
- if (isa<LoadInst>(IncValue)) {
- if (IncValue->hasOneUse())
+ auto *LI = dyn_cast<LoadInst>(IncValue);
+ if (LI) {
+ if (LI->hasOneUse() && LI->isSimple())
continue;
// If a LoadInst has more than one use, changing the type of loaded
// value may create another bitcast.
@@ -1875,7 +1876,7 @@
// If there is a store with type B, change it to type A.
for (User *U : PN->users()) {
auto *SI = dyn_cast<StoreInst>(U);
- if (SI && SI->getOperand(0) == PN) {
+ if (SI && SI->isSimple() && SI->getOperand(0) == PN) {
Builder->SetInsertPoint(SI);
SI->setOperand(0, Builder->CreateBitCast(NewPNodes[PN], SrcTy));
}
http://reviews.llvm.org/D14596
Files:
lib/Transforms/InstCombine/InstCombineCasts.cpp
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/pr25342.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14596.50211.patch
Type: text/x-patch
Size: 8874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160309/1bd0694b/attachment.bin>
More information about the llvm-commits
mailing list