[llvm] [DAG] SDPatternMatch m_Zero/m_One/m_AllOnes have inconsistent undef h… (PR #147044)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 05:00:35 PDT 2025


================
@@ -12569,6 +12569,18 @@ bool llvm::isAllOnesOrAllOnesSplat(SDValue N, bool AllowUndefs) {
   return C && C->isAllOnes() && C->getValueSizeInBits(0) == BitWidth;
 }
 
+bool llvm::isOnesOrOnesSplat(SDValue N, bool AllowUndefs) {
+  N = peekThroughBitcasts(N);
----------------
woruyu wrote:

Done! understand! And modify `C->getAPIntValue() == 1` to `APInt::isSameValue(C->getAPIntValue(), APInt(C->getAPIntValue().getBitWidth(), 1))` to avoid bit > 64 corner case

https://github.com/llvm/llvm-project/pull/147044


More information about the llvm-commits mailing list