[PATCH] D154064: [InstructionSimplify] Limit threadCmpOverPHI recursion depth to 1
Dhruv Chawla via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 04:36:04 PDT 2023
0xdc03 created this revision.
0xdc03 added a reviewer: nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
0xdc03 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Other places in the compiler (such as ValueTracking) only allow
recursing one level into phi nodes, however in InstructionSimplify the
limit is 3.
By reducing it to 1, there is a slight reduction in compile times (0.1%):
https://llvm-compile-time-tracker.com/compare.php?from=47a4331cd79ff63b13e369e28ccca268773cf9f2&to=20d987ab937caf22929f0c5790f0a8197b53b447&stat=instructions:u
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154064
Files:
llvm/lib/Analysis/InstructionSimplify.cpp
Index: llvm/lib/Analysis/InstructionSimplify.cpp
===================================================================
--- llvm/lib/Analysis/InstructionSimplify.cpp
+++ llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4011,7 +4011,8 @@
// If the comparison is with the result of a phi instruction, check whether
// doing the compare with each incoming phi value yields a common result.
if (isa<PHINode>(LHS) || isa<PHINode>(RHS))
- if (Value *V = threadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse))
+ if (Value *V = threadCmpOverPHI(Pred, LHS, RHS, Q,
+ MaxRecurse > 1 ? 1 : MaxRecurse))
return V;
return nullptr;
@@ -4232,7 +4233,8 @@
// If the comparison is with the result of a phi instruction, check whether
// doing the compare with each incoming phi value yields a common result.
if (isa<PHINode>(LHS) || isa<PHINode>(RHS))
- if (Value *V = threadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse))
+ if (Value *V = threadCmpOverPHI(Pred, LHS, RHS, Q,
+ MaxRecurse > 1 ? 1 : MaxRecurse))
return V;
return nullptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154064.535720.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/623fd865/attachment.bin>
More information about the llvm-commits
mailing list