[llvm] c953a83 - [TargetLowering] Use getBoolConstant instead of assuming zero or one for boolean contents.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 00:27:17 PST 2021


Author: Craig Topper
Date: 2021-01-22T00:26:14-08:00
New Revision: c953a8334707951d172e8061c8dc9054eb0c5c3f

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

LOG: [TargetLowering] Use getBoolConstant instead of assuming zero or one for boolean contents.

Noticed while I was touching other nearby code. I don't have a
test where this matters because the targets I work on
use zero or one boolean contents. And the tests cases I've seen
this fire on happen before type legalization where the result type
is MVT::i1 so the distinction doesn't matter.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 3d1d257ae54c..b0b4a6ae9227 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -3745,7 +3745,7 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
       // If the constant doesn't fit into the number of bits for the source of
       // the sign extension, it is impossible for both sides to be equal.
       if (C1.getMinSignedBits() > ExtSrcTyBits)
-        return DAG.getConstant(Cond == ISD::SETNE, dl, VT);
+        return DAG.getBoolConstant(Cond == ISD::SETNE, dl, VT, OpVT);
 
       assert(ExtDstTy == N0.getOperand(0).getValueType() &&
              ExtDstTy != ExtSrcTy && "Unexpected types!");


        


More information about the llvm-commits mailing list