[PATCH] D28408: Fix LoopLoadElimination to keep original alignment on the inital hoisted store
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 13:17:46 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291281: Fix LoopLoadElimination to keep original alignment on the inital hoisted store (authored by mehdi_amini).
Changed prior to commit:
https://reviews.llvm.org/D28408?vs=83402&id=83414#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28408
Files:
llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/trunk/test/Transforms/LoopLoadElim/forward.ll
Index: llvm/trunk/test/Transforms/LoopLoadElim/forward.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopLoadElim/forward.ll
+++ llvm/trunk/test/Transforms/LoopLoadElim/forward.ll
@@ -16,8 +16,8 @@
; CHECK-NOT: %found.conflict{{.*}} =
entry:
-; for.body.ph:
-; CHECK: %load_initial = load i32, i32* %A
+; Make sure the hoisted load keeps the alignment
+; CHECK: %load_initial = load i32, i32* %A, align 1
br label %for.body
for.body: ; preds = %for.body, %entry
@@ -34,7 +34,7 @@
%a_p1 = add i32 %b, 2
store i32 %a_p1, i32* %Aidx_next, align 4
- %a = load i32, i32* %Aidx, align 4
+ %a = load i32, i32* %Aidx, align 1
; CHECK: %c = mul i32 %store_forwarded, 2
%c = mul i32 %a, 2
store i32 %c, i32* %Cidx, align 4
Index: llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -415,7 +415,9 @@
Value *InitialPtr = SEE.expandCodeFor(PtrSCEV->getStart(), Ptr->getType(),
PH->getTerminator());
Value *Initial =
- new LoadInst(InitialPtr, "load_initial", PH->getTerminator());
+ new LoadInst(InitialPtr, "load_initial", /* isVolatile */ false,
+ Cand.Load->getAlignment(), PH->getTerminator());
+
PHINode *PHI = PHINode::Create(Initial->getType(), 2, "store_forwarded",
&L->getHeader()->front());
PHI->addIncoming(Initial, PH);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28408.83414.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/e17dcc93/attachment.bin>
More information about the llvm-commits
mailing list