Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 7, 2025

These can only be instructions

Copy link
Contributor Author

arsenm commented Apr 7, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review April 7, 2025 12:14
@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Apr 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 7, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Matt Arsenault (arsenm)

Changes

These can only be instructions


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

1 Files Affected:

  • (modified) llvm/lib/Analysis/ValueTracking.cpp (+7-2)
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 3b0249f91d6d7..111515e685d61 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -472,8 +472,13 @@ static bool isEphemeralValueOf(const Instruction *I, const Value *E) {
                      !cast<Instruction>(V)->mayHaveSideEffects() &&
                      !cast<Instruction>(V)->isTerminator())) {
        EphValues.insert(V);
-       if (const User *U = dyn_cast<User>(V))
-         append_range(WorkSet, U->operands());
+
+       if (const User *U = dyn_cast<User>(V)) {
+         for (const Use &U : U->operands()) {
+           if (!isa<Constant>(U))
+             WorkSet.push_back(U.get());
+         }
+       }
       }
     }
   }

@arsenm arsenm force-pushed the users/arsenm/valuetracking/do-not-look-at-constant-users-ephemeral-values branch from fbc607f to b4bde69 Compare April 8, 2025 16:13
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

@arsenm arsenm merged commit 258aa65 into main Apr 9, 2025
7 checks passed
@arsenm arsenm deleted the users/arsenm/valuetracking/do-not-look-at-constant-users-ephemeral-values branch April 9, 2025 12:15
AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this pull request Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants