summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-12-02 14:22:34 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-12-02 14:22:34 +0000
commitd035fbb96f58df15964fa6f0cef0110656de678f (patch)
treef4296ff4129d6d4d007a260fd859314618bdfcb2 /llvm/lib/Transforms
parent7f43266778cffe586899c326a778de2497a6e22c (diff)
downloadbcm5719-llvm-d035fbb96f58df15964fa6f0cef0110656de678f.tar.gz
bcm5719-llvm-d035fbb96f58df15964fa6f0cef0110656de678f.zip
[LICM] Avoind store sinking if no preheader is available
Load instructions are inserted into loop preheaders when sinking stores and later removed if not used by the SSA updater. Avoid sinking if the loop has no preheader and avoid crashes. This fixes one more side effect of not handling indirectbr instructions properly on LoopSimplify. llvm-svn: 223119
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index c706248267f..99725b5f738 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -847,8 +847,10 @@ void LICM::PromoteAliasSet(AliasSet &AS,
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)
+ // make sure we catch that. An additional load may be generated in the
+ // preheader for SSA updater, so also avoid sinking when no preheader
+ // is available.
+ if (!HasDedicatedExits || !Preheader)
return;
// Note that we only check GuaranteedToExecute inside the store case
OpenPOWER on IntegriCloud