diff options
author | Sebastian Pop <sebpop@gmail.com> | 2016-08-04 23:49:05 +0000 |
---|---|---|
committer | Sebastian Pop <sebpop@gmail.com> | 2016-08-04 23:49:05 +0000 |
commit | 429740a6c257fd395d99d46ba4598e18c4839d2a (patch) | |
tree | b144ca13f90eaafee3280690915c5a4c65024a7b /llvm/lib/Transforms/Scalar/GVNHoist.cpp | |
parent | 19dd0da153304f7947220141efd517f86406c9b3 (diff) | |
download | bcm5719-llvm-429740a6c257fd395d99d46ba4598e18c4839d2a.tar.gz bcm5719-llvm-429740a6c257fd395d99d46ba4598e18c4839d2a.zip |
GVN-hoist: fix early exit logic
The patch splits a complex && if condition into easier to read and understand
logic. That wrong early exit condition was letting some instructions with not
all operands available pass through when HoistingGeps was true.
Differential Revision: https://reviews.llvm.org/D23174
llvm-svn: 277785
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVNHoist.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 171a8edfee4..c734dfced8e 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -750,12 +750,19 @@ private: Repl = InstructionsToHoist.front(); // We can move Repl in HoistPt only when all operands are available. - // When not HoistingGeps we need to copy the GEPs now. // The order in which hoistings are done may influence the availability // of operands. - if (!allOperandsAvailable(Repl, HoistPt) && !HoistingGeps && - !makeGepOperandsAvailable(Repl, HoistPt, InstructionsToHoist)) - continue; + if (!allOperandsAvailable(Repl, HoistPt)) { + + // When HoistingGeps there is nothing more we can do to make the + // operands available: just continue. + if (HoistingGeps) + continue; + + // When not HoistingGeps we need to copy the GEPs. + if (!makeGepOperandsAvailable(Repl, HoistPt, InstructionsToHoist)) + continue; + } // Move the instruction at the end of HoistPt. Instruction *Last = HoistPt->getTerminator(); |