[Lldb-commits] [PATCH] D113498: [lldb] Constant-resolve operands to `getelementptr`

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 9 07:58:59 PST 2022


werat added a comment.

In D113498#3305973 <https://reviews.llvm.org/D113498#3305973>, @shafik wrote:

> I believe this a program like this
>
>   int main() {
>     int arr[2]{0};
>   
>     return arr[1];
>   } 
>
> and an expression like this `expr arr[0]` will give us the constant expression `getelementptr` at least my testing seems to show that.

This example produces the following code for me:

  %4 = load [2 x i32]*, [2 x i32]** %1, align 8
  %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
  store i32* %arrayidx, i32** %3, align 8
  br label %init.end

This is successfully interpreted via IRInterpreter with the current patch (i.e. all arguments seem to be `ConstantInt`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113498/new/

https://reviews.llvm.org/D113498



More information about the lldb-commits mailing list