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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 16:03:12 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());
----------------
arsenm wrote:

Generally should try to use a context address space. For a newly synthesized global, there's DL.getDefaultGlobalsAddressSpace 

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


More information about the llvm-commits mailing list