================
@@ -5616,6 +5616,89 @@ Value *llvm::simplifyExtractElementInst(Value *Vec,
Value *Idx,
return ::simplifyExtractElementInst(Vec, Idx, Q, RecursionLimit);
}
+/// Return true if accessing the bit range of type Ty at Offset in a value of
+/// type SrcTy is poison.
+static bool isPoisonBitRange(Value *Offset, Type *Ty, Type *SrcTy,
+ const SimplifyQuery &Q) {
+ // A poison offset makes the result poison. An undef offset can be chosen to
+ // be out of range, which also makes the result poison.
+ if (isa<PoisonValue>(Offset) || Q.isUndefValue(Offset))
+ return true;
+
+ // Accessing bits past the end of the value is poison.
+ const APInt *Off;
+ return match(Offset, m_APInt(Off)) &&
----------------
dtcxzyw wrote:
Use `m_ConstantInt`.
https://github.com/llvm/llvm-project/pull/229125
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits