Debian Codegraph @

external/llvm/releases/12.0.0/patches_external/Backport-When-creating-a-stack-space-for-inlined-byv.patch

raw
1 From 4e236ccb14eb5c0678323066e89efaa9eb28c508 Mon Sep 17 00:00:00 2001
2 From: Victor Mustya <[email protected]>
3 Date: Mon, 31 Oct 2022 13:27:02 -0700
4 Subject: =?UTF-8?q?[Backport]=20When=20creating=20a=20stack=20space=20for?=
5 =?UTF-8?q?=20inlined=20byval=20args,=0A=20use=20the=20same=20addrspace=20?=
6 =?UTF-8?q?as=20the=20original=20argument.?=
7
8 From: Chang-Sun Lin Jr <[email protected]>
9 ---
10 llvm/lib/Transforms/Utils/InlineFunction.cpp | 6 ++++++
11 1 file changed, 6 insertions(+)
12
13 diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
14 index fb271a2118ba..c74ff5f881c1 100644
15 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
16 +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
17 @@ -1423,6 +1423,12 @@ static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
18 Arg->getName(), &*Caller->begin()->begin());
19 IFI.StaticAllocas.push_back(cast<AllocaInst>(NewAlloca));
20
21 + // If the byval was in a different address space, add a cast.
22 + if (DL.getAllocaAddrSpace() != ArgTy->getAddressSpace()) {
23 + NewAlloca = new AddrSpaceCastInst(
24 + NewAlloca, ArgTy, "",
25 + cast<Instruction>(NewAlloca)->getNextNonDebugInstruction());
26 + }
27 // Uses of the argument in the function should use our new alloca
28 // instead.
29 return NewAlloca;
30 --
31 2.34.1
32