[llvm] SimplifyLibCalls: Use the correct address space when computing integer widths. (PR #118586)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 08:58:58 PST 2024


================
@@ -590,26 +588,35 @@ Value *LibCallSimplifier::optimizeStrCmp(CallInst *CI, IRBuilderBase &B) {
   if (Len1 && Len2) {
     return copyFlags(
         *CI, emitMemCmp(Str1P, Str2P,
-                        ConstantInt::get(DL.getIntPtrType(CI->getContext()),
-                                         std::min(Len1, Len2)),
+                        ConstantInt::get(
+                            DL.getIntPtrType(
+                                CI->getContext(),
+                                Str1P->getType()->getPointerAddressSpace()),
+                            std::min(Len1, Len2)),
----------------
nikic wrote:

If you're going to change this, please change it to use the correct value -- which is TLI::getSizeTSize().

https://github.com/llvm/llvm-project/pull/118586


More information about the llvm-commits mailing list