[clang] 731b3d7 - [clang] Use Constant::getAllOnesValue helper. NFCI.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 12 07:16:58 PST 2021


Author: Simon Pilgrim
Date: 2021-03-12T15:16:36Z
New Revision: 731b3d766420ce05726174ff0e1527dca8a63791

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

LOG: [clang] Use Constant::getAllOnesValue helper. NFCI.

Avoid -1ULL which MSVC tends to complain about

Added: 
    

Modified: 
    clang/lib/CodeGen/CGExprScalar.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 4774f92a2eed..ef3e27ecec99 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -3125,7 +3125,7 @@ void ScalarExprEmitter::EmitUndefinedBehaviorIntegerDivAndRemCheck(
 
     llvm::Value *IntMin =
       Builder.getInt(llvm::APInt::getSignedMinValue(Ty->getBitWidth()));
-    llvm::Value *NegOne = llvm::ConstantInt::get(Ty, -1ULL);
+    llvm::Value *NegOne = llvm::Constant::getAllOnesValue(Ty);
 
     llvm::Value *LHSCmp = Builder.CreateICmpNE(Ops.LHS, IntMin);
     llvm::Value *RHSCmp = Builder.CreateICmpNE(Ops.RHS, NegOne);


        


More information about the cfe-commits mailing list