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

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 18:12:44 PST 2024


================
@@ -3357,7 +3362,9 @@ Value *LibCallSimplifier::optimizePrintFString(CallInst *CI, IRBuilderBase &B) {
     // Create a string literal with no \n on it.  We expect the constant merge
     // pass to be run after this pass, to merge duplicate strings.
     FormatStr = FormatStr.drop_back();
-    Value *GV = B.CreateGlobalString(FormatStr, "str");
+    Value *GV = B.CreateGlobalString(
+        FormatStr, "str",
+        CI->getArgOperand(0)->getType()->getPointerAddressSpace());
----------------
resistor wrote:

Split off into https://github.com/llvm/llvm-project/pull/118729

Writing the test for this exposed more places where we were failing to propagate address spaces correctly, which are addressed in that PR as well.

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


More information about the llvm-commits mailing list