[clang] [llvm] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 4 11:04:43 PST 2023
topperc wrote:
@nikic is something like this the right fix
```
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 8c29c242215d..b03a56c922de 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -235,8 +235,11 @@ bool llvm::haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
"LHS and RHS should be integers");
if (haveNoCommonBitsSetSpecialCases(LHS, RHS) ||
- haveNoCommonBitsSetSpecialCases(RHS, LHS))
- return true;
+ haveNoCommonBitsSetSpecialCases(RHS, LHS)) {
+ if (isGuaranteedNotToBeUndefOrPoison(LHS, SQ.AC, SQ.CxtI, SQ.DT) &&
+ isGuaranteedNotToBeUndefOrPoison(RHS, SQ.AC, SQ.CxtI, SQ.DT))
+ return true;
+ }
return KnownBits::haveNoCommonBitsSet(LHSCache.getKnownBits(SQ),
RHSCache.getKnownBits(SQ));
```
https://github.com/llvm/llvm-project/pull/72912
More information about the cfe-commits
mailing list