[llvm] [VPlan] Introduce CSE pass (PR #151872)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 04:37:15 PDT 2025
================
@@ -122,6 +122,49 @@ void VPDef::dump() const {
}
#endif
+bool VPValue::isIdenticalTo(const VPValue *Other) const {
+ if (getVPValueID() != Other->getVPValueID() ||
+ hasDefiningRecipe() != Other->hasDefiningRecipe() ||
+ !getUnderlyingValue() != !Other->getUnderlyingValue())
+ return false;
+
+ auto *I = dyn_cast_or_null<Instruction>(getUnderlyingValue());
+ auto *OtherI = dyn_cast_or_null<Instruction>(Other->getUnderlyingValue());
+ if (I && OtherI)
+ return I->isIdenticalTo(OtherI);
----------------
fhahn wrote:
We should not look at the underlying instruction here. There are multiple cases where this will lead to incorrect results:
* recipe operands have been modified
* multiple recipes can have the same underlying instruction after unrolling, recipes for all parts will have the same underlying instruction, but produce values for different parts
https://github.com/llvm/llvm-project/pull/151872
More information about the llvm-commits
mailing list