[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 16:05:40 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:

In this specific line we're replacing one global string with another, so it makes sense to use the original address space. I'll look into other uses within this file.

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


More information about the llvm-commits mailing list