[llvm] [VPlan] Extend cse to eliminate redundant widened loads (PR #212543)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 07:27:43 PDT 2026
================
@@ -2304,7 +2330,26 @@ struct VPCSEDenseMapInfo : public DenseMapInfo<VPSingleDefRecipe *> {
};
} // end anonymous namespace
-/// Perform a common-subexpression-elimination of VPSingleDefRecipes on the \p
+/// Return true if no memory-writing recipe between \p From and \p To may alias
+/// \p MemLoc. \p From and \p To must be in the same block.
+static bool noAliasingWriteBetween(const MemoryLocation &MemLoc,
----------------
artagnon wrote:
Sorry, my bad. Consider:
```
store %q
...
load %p // first instance
...
store %r
...
load %p // second instance
...
store %q
```
I think if p doesn't alias with r, but aliases with q, I think you're right, and it's safe to CSE `load %p`. You're right, and I forgot that operands have to match exactly for a CSE: it would be too conservative to re-use canHoistOrSinkWithNoAliasCheck.
https://github.com/llvm/llvm-project/pull/212543
More information about the llvm-commits
mailing list