summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-11-28 19:47:46 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-11-28 19:47:46 +0000
commit46d5bf29820569471399c81caa1870f04223d23f (patch)
treebd3707955c8e3b0e5f685ff2c8cb10234ea4bb13 /llvm/lib/Transforms
parentbc7ba2c7667b8b5b5563b3b1429ca70468d0f251 (diff)
downloadbcm5719-llvm-46d5bf29820569471399c81caa1870f04223d23f.tar.gz
bcm5719-llvm-46d5bf29820569471399c81caa1870f04223d23f.zip
[LICM] Store sink and indirectbr instructions
Loop simplify skips exit-block insertion when exits contain indirectbr instructions. This leads to an assertion in LICM when trying to sink stores out of non-dedicated loop exits containing indirectbr instructions. This patch fix this issue by re-checking for dedicated exits in LICM prior to store sink attempts. Differential Revision: http://reviews.llvm.org/D6414 rdar://problem/18943047 llvm-svn: 222927
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 5f00bb94188..c706248267f 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -810,6 +810,7 @@ void LICM::PromoteAliasSet(AliasSet &AS,
// us to prove better alignment.
unsigned Alignment = 1;
AAMDNodes AATags;
+ bool HasDedicatedExits = CurLoop->hasDedicatedExits();
// Check that all of the pointers in the alias set have the same type. We
// cannot (yet) promote a memory location that is loaded and stored in
@@ -844,6 +845,11 @@ void LICM::PromoteAliasSet(AliasSet &AS,
assert(!store->isVolatile() && "AST broken");
if (!store->isSimple())
return;
+ // Don't sink stores from loops without dedicated block exits. Exits
+ // containing indirect branches are not transformed by loop simplify,
+ // make sure we catch that.
+ if (!HasDedicatedExits)
+ return;
// Note that we only check GuaranteedToExecute inside the store case
// so that we do not introduce stores where they did not exist before
OpenPOWER on IntegriCloud