[llvm-dev] Access to undefined local variables in IR

Tobias Grosser via llvm-dev llvm-dev at lists.llvm.org
Sun Aug 16 04:33:01 PDT 2015


On 08/16/2015 01:26 PM, Thomas Ströder via llvm-dev wrote:
> define i32 @f(i32 %i) nounwind {
>    %1 = add i32 %i, 1
>    ret i32 %1
> }
>
> define i32 @g() nounwind {
>    %1 = add i32 %i, 1
>    ret i32 %1
> }
>
> define i32 @main() nounwind {
>    %1 = call i32 @g()
>    ret i32 %1
> }

No, this is not valid.

$opt /tmp/test.ll
opt: /tmp/test.ll:8:16: error: use of undefined value '%i'
   %1 = add i32 %i, 1

Tobias


More information about the llvm-dev mailing list