[llvm] SimplifyLibCalls: Use the correct address space when computing integer widths. (PR #118586)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 16:14:14 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());
----------------
efriedma-quic wrote:
getConstantStringInfo looks through addrspacecasts, so `CI->getArgOperand(0)->getType()->getPointerAddressSpace()` isn't necessarily the "original" address-space.
https://github.com/llvm/llvm-project/pull/118586
More information about the llvm-commits
mailing list