[llvm] [BasicAA] Consider 'nneg' flag when comparing CastedValues (PR #94129)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 2 02:26:15 PDT 2024
================
@@ -333,8 +349,15 @@ struct CastedValue {
}
bool hasSameCastsAs(const CastedValue &Other) const {
- return ZExtBits == Other.ZExtBits && SExtBits == Other.SExtBits &&
- TruncBits == Other.TruncBits;
+ if (ZExtBits == Other.ZExtBits && SExtBits == Other.SExtBits &&
+ TruncBits == Other.TruncBits)
+ return true;
+ // If either CastedValue has a nneg zext then the sext/zext bits are
+ // interchangable for that value.
----------------
nikic wrote:
But doesn't this treat them as interchangeable for *both* values? I.e. if you have `zext nneg` on one side and `zext (sext)` on the other, that's not the same right? The other side has to be just zext or just sext.
https://github.com/llvm/llvm-project/pull/94129
More information about the llvm-commits
mailing list