Author: Nikita Popov Date: 2025-12-17T12:48:50+01:00 New Revision: 857748d4afbfe383f473e9e01455a717b7938aa6
URL: https://github.com/llvm/llvm-project/commit/857748d4afbfe383f473e9e01455a717b7938aa6 DIFF: https://github.com/llvm/llvm-project/commit/857748d4afbfe383f473e9e01455a717b7938aa6.diff LOG: [PatternInit] Explicitly allow implicit truncation It's okay if the pattern value gets truncated here, it's a splat. Added: Modified: clang/lib/CodeGen/PatternInit.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/PatternInit.cpp b/clang/lib/CodeGen/PatternInit.cpp index 4400bc4436882..b5716e72d678d 100644 --- a/clang/lib/CodeGen/PatternInit.cpp +++ b/clang/lib/CodeGen/PatternInit.cpp @@ -37,7 +37,8 @@ llvm::Constant *clang::CodeGen::initializationPatternFor(CodeGenModule &CGM, unsigned BitWidth = cast<llvm::IntegerType>(Ty->getScalarType())->getBitWidth(); if (BitWidth <= 64) - return llvm::ConstantInt::get(Ty, IntValue); + return llvm::ConstantInt::get(Ty, IntValue, /*IsSigned=*/false, + /*ImplicitTrunc=*/true); return llvm::ConstantInt::get( Ty, llvm::APInt::getSplat(BitWidth, llvm::APInt(64, IntValue))); } @@ -48,7 +49,8 @@ llvm::Constant *clang::CodeGen::initializationPatternFor(CodeGenModule &CGM, if (PtrWidth > 64) llvm_unreachable("pattern initialization of unsupported pointer width"); llvm::Type *IntTy = llvm::IntegerType::get(CGM.getLLVMContext(), PtrWidth); - auto *Int = llvm::ConstantInt::get(IntTy, IntValue); + auto *Int = llvm::ConstantInt::get(IntTy, IntValue, /*IsSigned=*/false, + /*ImplicitTrunc=*/true); return llvm::ConstantExpr::getIntToPtr(Int, PtrTy); } if (Ty->isFPOrFPVectorTy()) { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
