[llvm] ValueTracking: Do not look at users of constants for ephemeral values (PR #134618)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 05:14:17 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/134618
These can only be instructions
>From fbc607fac033872b2ccc81f12d1c4bfa183ac134 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 7 Apr 2025 18:44:40 +0700
Subject: [PATCH] ValueTracking: Do not look at users of constants for
ephemeral values
These can only be instructions
---
llvm/lib/Analysis/ValueTracking.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
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());
+ }
+ }
}
}
}
More information about the llvm-commits
mailing list