Author: darkbuck Date: 2026-08-31T17:53:41Z New Revision: e297b52ec9d8b5c38042e53ae5650922717970cd
URL: https://github.com/llvm/llvm-project/commit/e297b52ec9d8b5c38042e53ae5650922717970cd DIFF: https://github.com/llvm/llvm-project/commit/e297b52ec9d8b5c38042e53ae5650922717970cd.diff LOG: [CIR] Fix `llvm.mlir.constant` creation (#220022) - After #218887, the constant verification is tightened and requires matching attr and res types. Fix one violation when lowering `cir.not`. Added: Modified: clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp Removed: ################################################################################ diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index 6a5a0b4163f39..6196ff45b7293 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -3211,8 +3211,11 @@ mlir::LogicalResult CIRToLLVMNotOpLowering::matchAndRewrite( if (isVector) { const uint64_t numElements = mlir::cast<cir::VectorType>(op.getType()).getSize(); - SmallVector<int32_t> values(numElements, -1); - mlir::DenseIntElementsAttr denseVec = rewriter.getI32VectorAttr(values); + const unsigned eltWidth = + mlir::cast<cir::IntType>(elementType).getWidth(); + SmallVector<APInt> values(numElements, APInt::getAllOnes(eltWidth)); + mlir::DenseIntElementsAttr denseVec = mlir::DenseIntElementsAttr::get( + mlir::cast<mlir::ShapedType>(llvmType), values); minusOne = mlir::LLVM::ConstantOp::create(rewriter, loc, llvmType, denseVec); } else { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
