[llvm] 72fd10a - [X86] getTargetConstantBitsFromNode - don't support partial undefs by default.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 28 09:13:44 PST 2024


Author: Simon Pilgrim
Date: 2024-01-28T17:13:30Z
New Revision: 72fd10adcbf8194a08141e38a95e11f4f1a8d7c2

URL: https://github.com/llvm/llvm-project/commit/72fd10adcbf8194a08141e38a95e11f4f1a8d7c2
DIFF: https://github.com/llvm/llvm-project/commit/72fd10adcbf8194a08141e38a95e11f4f1a8d7c2.diff

LOG: [X86] getTargetConstantBitsFromNode - don't support partial undefs by default.

Noticed by inspection - as undef bits are seen as zero, we could be matching in places where we require a zero but end up referencing an undef that could then get changed in a later fold.

Creating a test case has proven difficult as multi-use limits usually saves us, but really we shouldn't be allowing partial undefs for anything but constant folding.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1be8d4699e99bb8..4ae27d9f46bb975 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4596,7 +4596,7 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits,
                                           APInt &UndefElts,
                                           SmallVectorImpl<APInt> &EltBits,
                                           bool AllowWholeUndefs = true,
-                                          bool AllowPartialUndefs = true) {
+                                          bool AllowPartialUndefs = false) {
   assert(EltBits.empty() && "Expected an empty EltBits vector");
 
   Op = peekThroughBitcasts(Op);


        


More information about the llvm-commits mailing list