[llvm] ValueTracking: Do not look at users of constants for ephemeral values (PR #134618)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 05:20:49 PDT 2025


================
@@ -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))
----------------
dtcxzyw wrote:

Can we change the type of `WorkSet` into `SmallVector<const Instruction *, 16>`?
It also eliminates the `isa<Instruction>` check above.


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


More information about the llvm-commits mailing list