diff options
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(); |