[llvm] [IR] `replaceUsesWith` when aliasing a GV and the use is `dso_local_equivalent` (PR #220336)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 13:53:30 PDT 2026
================
@@ -2130,34 +2130,25 @@ Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
assert(From == getGlobalValue() && "Changing value does not match operand.");
assert(isa<Constant>(To) && "Can only replace the operands with a constant");
- // The replacement is with another global value.
- if (const auto *ToObj = dyn_cast<GlobalValue>(To)) {
- if (DSOLocalEquivalent *NewEquiv =
- getContext().pImpl->DSOLocalEquivalents.lookup(ToObj))
- return llvm::ConstantExpr::getBitCast(NewEquiv, getType());
- }
-
// If the argument is replaced with a null value, just replace this constant
// with a null value.
if (isa<ConstantPointerNull>(To))
return To;
- // The replacement could be a bitcast or an alias to another function. We can
- // replace it with a bitcast to the dso_local_equivalent of that function.
- auto *Func = cast<Function>(To->stripPointerCastsAndAliases());
+ GlobalValue *GV = cast<GlobalValue>(To->stripPointerCasts());
----------------
teresajohnson wrote:
Is the key change here that we'd now do this for GlobalValues and not just Functions, or that we're no longer looking through aliases?
https://github.com/llvm/llvm-project/pull/220336
More information about the llvm-commits
mailing list