Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 9, 2025

Theoretically this does a worse job with globals but this is not
covered by existing tests

Copy link
Contributor Author

arsenm commented Apr 9, 2025

@arsenm arsenm marked this pull request as ready for review April 9, 2025 14:04
@llvmbot
Copy link
Member

llvmbot commented Apr 9, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Matt Arsenault (arsenm)

Changes

Theoretically this does a worse job with globals but this is not
covered by existing tests


Full diff: https://github.com/llvm/llvm-project/pull/135019.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/IROutliner.cpp (+2-1)
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 8c5946fb07c65..eec869d57a6db 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1126,7 +1126,8 @@ static void analyzeExitPHIsForOutputUses(
     // outside of the single PHINode we should not skip over it.
     for (unsigned Idx : IncomingVals) {
       Value *V = PN.getIncomingValue(Idx);
-      if (outputHasNonPHI(V, Idx, PN, PotentialExitsFromRegion, RegionBlocks)) {
+      if (!isa<Constant>(V) &&
+          outputHasNonPHI(V, Idx, PN, PotentialExitsFromRegion, RegionBlocks)) {
         OutputsWithNonPhiUses.insert(V);
         OutputsReplacedByPHINode.erase(V);
         continue;

Base automatically changed from users/arsenm/ir-outliner/use-valuemapper-to-replace-constants to main April 10, 2025 20:31
Theoretically this does a worse job with globals but this is not
covered by existing tests
@arsenm arsenm force-pushed the users/arsenm/ir-outliner/ignore-constant-phi-inputs-uselist branch from 6e92bcd to 4d6e748 Compare April 10, 2025 20:32
Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@arsenm arsenm merged commit beac727 into main Apr 13, 2025
11 checks passed
@arsenm arsenm deleted the users/arsenm/ir-outliner/ignore-constant-phi-inputs-uselist branch April 13, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ipo Interprocedural optimizations llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants