[PATCH] D61671: X86WinAllocaExpander: Drop code looking through register copies (PR41786)

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 11:11:54 PDT 2019


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, too



================
Comment at: llvm/lib/Target/X86/X86WinAllocaExpander.cpp:91-94
   if (!Def ||
       (Def->getOpcode() != X86::MOV32ri && Def->getOpcode() != X86::MOV64ri) ||
       !Def->getOperand(1).isImm())
     return -1;
----------------
As a follow-up, I think it would be reasonable for WIN_ALLOCA_* to accept either reg or imm operands so we won't need this code at all. Right now we emit this MI:
  %12:gr32 = MOV32ri 12
  WIN_ALLOCA_32 %12:gr32, implicit-def dead $eax, implicit-def dead $esp, implicit-def dead $eflags, implicit $esp

But it's not really necessary, since in the end we're going to make SUB64ri instructions with the immediate.

I think the instruction wasn't designed this way because most truly dynamic allocas do not use a fixed size. It's only inalloca that introduces them.


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

https://reviews.llvm.org/D61671





More information about the llvm-commits mailing list