Page MenuHomePhabricator

D55974.id179206.diff
No OneTemporary

File Metadata

Created
Fri, Aug 23, 9:44 AM

D55974.id179206.diff

Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -2195,7 +2195,9 @@
// It is not safe to do PRE when P->CurrentBlock is a loop backedge, and
// when CurInst has operand defined in CurrentBlock (so it may be defined
// by phi in the loop header).
- if (BlockRPONumber[P] >= BlockRPONumber[CurrentBlock] &&
+ const auto PNum = BlockRPONumber[P];
+ const auto CNum = BlockRPONumber[CurrentBlock];
+ if (PNum >= CNum &&
llvm::any_of(CurInst->operands(), [&](const Use &U) {
if (auto *Inst = dyn_cast<Instruction>(U.get()))
return Inst->getParent() == CurrentBlock;

Event Timeline