[llvm] [GVN] MemorySSA for GVN: embed the memory state in symbolic expressions (PR #123218)
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 12:51:29 PDT 2025
================
@@ -595,15 +608,48 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
return V;
}
+ if (MSSA && AA->onlyReadsMemory(C)) {
+ Expression Exp = createExpr(C);
+ addMemoryStateToExp(C, Exp);
+ auto [V, _] = assignExpNewValueNum(Exp);
+ ValueNumbering[C] = V;
+ return V;
+ }
+
ValueNumbering[C] = NextValueNumber;
return NextValueNumber++;
}
+/// Returns the value number for the specified load or store instruction.
+uint32_t GVNPass::ValueTable::lookupOrAddLoadStore(Instruction *I) {
----------------
alinas wrote:
Why is this called `lookupOrAddLoadStore`? AFAICT, the "default" (no MSSA) will always reassign to the next value number, not do a lookup. Should it do a lookup in that case or, if not, why not?
I am missing the reasoning here.
https://github.com/llvm/llvm-project/pull/123218
More information about the llvm-commits
mailing list