================ @@ -1583,7 +1583,7 @@ static void printConstant(const Constant *COp, unsigned BitWidth, bool IsInteger = EltTy->isIntegerTy(); bool IsFP = EltTy->isHalfTy() || EltTy->isFloatTy() || EltTy->isDoubleTy(); unsigned EltBits = EltTy->getPrimitiveSizeInBits(); - unsigned E = std::min(BitWidth / EltBits, CDS->getNumElements()); + unsigned E = std::min(BitWidth / EltBits, (unsigned)CDS->getNumElements()); ---------------- pzzp wrote:
Thank you very much for your meticulous review. I update the test to this `gen_large_string.sh` ```bash #!/bin/bash cat << EOF target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" EOF # generate @S = constant [4294967303 x i8] c"......", align 1 for (( i = 0; i<128; i++)); do S_1K+='abcdefgh' done for (( i = 0; i<1024; i++)); do S_1M+=$S_1K done echo -n "@S = constant [$((1024 * 1024 * 1024 * 4 + 7)) x i8] c\"" for (( i = 0; i<$((1024 * 4)); i++)); do echo -n $S_1M done echo -n 'last7ch' echo '", align 1' cat << EOF !llvm.module.flags = !{!0, !1, !2, !3} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} EOF ``` ```bash bash gen_large_string.sh > a.ll llc a.ll ``` It generate right result, with last 7 char are 'last7ch'.   https://github.com/llvm/llvm-project/pull/126481 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits