diff options
author | Sebastian Pop <sebpop@gmail.com> | 2016-07-21 23:32:39 +0000 |
---|---|---|
committer | Sebastian Pop <sebpop@gmail.com> | 2016-07-21 23:32:39 +0000 |
commit | c107a4875e40d0aceb6f542803fc71e0cfe86e46 (patch) | |
tree | 8e8655146c3fdf5e287c9fd787a40fcc11d13939 /llvm/lib/Transforms | |
parent | fa522ca3b3fa55ca4c20d1b5a0e52af0b679b898 (diff) | |
download | bcm5719-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/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 3 |
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 |