[PATCH] D94712: Do not traverse ConstantData use-list in LookInterchange
Anton Rapetov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 14 12:32:52 PST 2021
willir created this revision.
willir added a reviewer: dexonsmith.
Herald added a subscriber: hiraditya.
willir requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Walking the use list of a Constant (particularly, ConstantData)
is not scalable, since a given constant may be used by many
instructinos in many functions in many modules.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94712
Files:
llvm/lib/Transforms/Scalar/LoopInterchange.cpp
Index: llvm/lib/Transforms/Scalar/LoopInterchange.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -661,15 +661,12 @@
// Check V's users to see if it is involved in a reduction in L.
static PHINode *findInnerReductionPhi(Loop *L, Value *V) {
- for (Value *User : V->users()) {
- if (PHINode *PHI = dyn_cast<PHINode>(User)) {
- if (PHI->getNumIncomingValues() == 1)
- continue;
- RecurrenceDescriptor RD;
- if (RecurrenceDescriptor::isReductionPHI(PHI, L, RD))
- return PHI;
- return nullptr;
- }
+ for (PHINode &PHI : L->getHeader()->phis()) {
+ if (PHI.getNumIncomingValues() == 1 ||
+ !llvm::is_contained(PHI.incoming_values(), V))
+ continue;
+ RecurrenceDescriptor RD;
+ return RecurrenceDescriptor::isReductionPHI(&PHI, L, RD) ? &PHI : nullptr;
}
return nullptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94712.316746.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210114/da1d8079/attachment.bin>
More information about the llvm-commits
mailing list