[llvm-dev] tool options to generate spill code
Priyanka Panigrahi via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 12 02:35:56 PST 2020
Hello,
For the following test case, reg.c
#include <stdio.h>
int getinput()
{
static int u=10;
return u++;
}
int main()
{
int a,b,c,d,e,f,g;
a=getinput();
b=getinput();
c=getinput();
d=getinput();
e=getinput();
f=getinput();
g=getinput();
printf("%d %d %d %d %d %d %d\n",a,b,c,d,e,f,g);
a=b=c=d=e=f=g=0;
return 0;
}
*1. $clang reg.c -Xclang -disable-O0-optnone -S -emit-llvm -o reg.ll && opt
-mem2reg -S reg.ll -o reg.ll && llc --regalloc=greedy reg.ll -o reg.s*
*2. $clang reg.c -Xclang -disable-llvm-passes -S -emit-llvm -o reg.ll &&
opt -mem2reg -S reg.ll -o reg.ll && llc --regalloc=greedy reg.ll -o reg.s*
*3. $clang reg.c -S -emit-llvm -o reg.ll && opt -mem2reg -S reg.ll -o
reg.ll && llc --regalloc=greedy reg.ll -o reg.s*
Only 1. gives the spill code but it deletes the dead stores., 2 and 3 give
only allocas. Why so??
How -mem2reg works and what it depends on?
How to generate the spill code with dead stores?
Thank you.
Regards,
Priyanka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200212/f7bdcec1/attachment.html>
More information about the llvm-dev
mailing list