summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSebastian Pop <sebpop@gmail.com>2016-07-21 23:32:39 +0000
committerSebastian Pop <sebpop@gmail.com>2016-07-21 23:32:39 +0000
commitc107a4875e40d0aceb6f542803fc71e0cfe86e46 (patch)
tree8e8655146c3fdf5e287c9fd787a40fcc11d13939 /llvm
parentfa522ca3b3fa55ca4c20d1b5a0e52af0b679b898 (diff)
downloadbcm5719-llvm-c107a4875e40d0aceb6f542803fc71e0cfe86e46.tar.gz
bcm5719-llvm-c107a4875e40d0aceb6f542803fc71e0cfe86e46.zip
GVN-hoist: add missing check for all GEP operands available
llvm-svn: 276364
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/GVNHoist.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
index ad373ba542e..c420089cc6d 100644
--- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -613,6 +613,9 @@ public:
// Also copy Val when it is a GEP.
if (Val && isa<GetElementPtrInst>(Val)) {
+ // Check whether we can compute the GEP at HoistPt.
+ if (!allOperandsAvailable(Val, HoistPt))
+ return false;
Instruction *ClonedVal = Val->clone();
ClonedVal->insertBefore(HoistPt->getTerminator());
// Conservatively discard any optimization hints, they may differ on the
OpenPOWER on IntegriCloud