[llvm-dev] Corresponding register of stack variables after mem2reg pass

Riyad Parvez via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 6 11:23:20 PDT 2015


Hi,

mem2reg promotes scalar stack variables to registers. Is it possible to
find the name of

int f(int a, int b) {
  int x = a - b;

After mem2reg pass eliminating alloca, load and stores for stack variables,
the IR:

define i32 @f(i32 %a, i32 %b) #0 {
entry:
  call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !27, metadata
!28), !dbg !29
  call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !30, metadata
!28), !dbg !31
  %sub = sub nsw i32 %a, %b, !dbg !32

Here %sub is the corresponding register for variable "x". My question is
after "mem2reg" pass is it possible to know these corresponding registers?

Thanks,
Riyad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151006/65388a5f/attachment.html>


More information about the llvm-dev mailing list