[llvm] [GVN] Add code to disable scalar PRE (PR #190386)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 04:16:31 PDT 2026
================
@@ -2029,12 +2037,15 @@ bool GVNPass::processNonLocalLoad(LoadInst *Load) {
}
bool Changed = false;
- // If this load follows a GEP, see if we can PRE the indices before analyzing.
- if (GetElementPtrInst *GEP =
- dyn_cast<GetElementPtrInst>(Load->getOperand(0))) {
- for (Use &U : GEP->indices())
- if (Instruction *I = dyn_cast<Instruction>(U.get()))
- Changed |= performScalarPRE(I);
+ // This is a limited form of scalar PRE for load indices. If this load follows
+ // a GEP, see if we can PRE the indices before analyzing.
+ if (isPREEnabled() && isScalarPREEnabled()) {
----------------
antoniofrighetto wrote:
Hmm, I believe this should be land as an independent fix; not sure why this code was not guarded by isPREEnabled() before.
https://github.com/llvm/llvm-project/pull/190386
More information about the llvm-commits
mailing list