[llvm-dev] Break nested instructions?

Irini Stavrakantonaki via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 16 04:21:03 PDT 2015



On 16/10/15 14:09, mats petersson wrote:
> I think it's important to understand that this is not ALWAYS the case. 
> The operands can be either a constant expression or an instruction.
>
> For example:
>
>      char *a;
>      int x;
>
>      if(cond) a = "%d";
>      else a = "%x";
>      printf(a, x);
>
> In this case, the compiler may still be able to convert to constant 
> expression for `a`, depending on if it's able to deduce `cond`. But if 
> `cond` is not "constant", `a` will be a GEP instruction, not a 
> constant expression.
> (Of course, the compiler will probably also warn that passing a 
> variable to printf is a bad idea, but that's a different matter)
>
> --
> Mats
Does this mean that we can have a nested instruction into an 
instruction?! Wouldn't that lead having a LLVM IR language without 
terminals?


--istavrak


More information about the llvm-dev mailing list