Author: Nikita Popov Date: 2021-12-23T14:58:47+01:00 New Revision: bf2b5551f9192106b1997f7c9c3bdc36be2dc381
URL: https://github.com/llvm/llvm-project/commit/bf2b5551f9192106b1997f7c9c3bdc36be2dc381 DIFF: https://github.com/llvm/llvm-project/commit/bf2b5551f9192106b1997f7c9c3bdc36be2dc381.diff LOG: [CodeGen] Use CreateConstInBoundsGEP() in one more place This does exactly what this code manually implemented. Added: Modified: clang/lib/CodeGen/CGExprCXX.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index ca4450a8cf1c..0571c498c377 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1052,13 +1052,8 @@ void CodeGenFunction::EmitNewArrayInitializer( InitListElements = cast<ConstantArrayType>(ILE->getType()->getAsArrayTypeUnsafe()) ->getSize().getZExtValue(); - CurPtr = - Address(Builder.CreateInBoundsGEP(CurPtr.getElementType(), - CurPtr.getPointer(), - Builder.getSize(InitListElements), - "string.init.end"), - CurPtr.getAlignment().alignmentAtOffset(InitListElements * - ElementSize)); + CurPtr = Builder.CreateConstInBoundsGEP( + CurPtr, InitListElements, "string.init.end"); // Zero out the rest, if any remain. llvm::ConstantInt *ConstNum = dyn_cast<llvm::ConstantInt>(NumElements); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits