[LLVMdev] argpromotion not working

Eli Friedman eli.friedman at gmail.com
Fri Jun 18 14:01:19 PDT 2010


On Fri, Jun 18, 2010 at 1:21 PM, Arvind Sudarsanam
<A.Sudarsanam at cputech.com> wrote:
> Hi all,
>
> I have the following C code.
>
> static int addp(int *c, int a,int b)
> {
> int x = *c + a + b;
> return(x);
> }
>
> I want to replace *c with a scalar. So I tried the -argpromotion pass.
> However, it fails to do anything to the resulting llvm file.

I assume this isn't the complete file.

> List of commands:
> clang add.c -c -o add.bc
> clang add.c -S -o add.ll
> opt -argpromotion -stats add.bc -o add_a.bc
> llvm-dis < add_a.bc > add_a.ll

argpromotion won't work without running mem2reg first for normal clang output.

-Eli



More information about the llvm-dev mailing list