[PATCH] D84479: [X86] Detect if EFLAGs is live across XBEGIN pseudo instruction. Add it as livein to the basic blocks created when expanding the pseudo

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 25 00:27:21 PDT 2020


craig.topper added a comment.

In D84479#2173935 <https://reviews.llvm.org/D84479#2173935>, @ivanbaev wrote:

> Yes, check for mi.killsRegister(X86::EFLAGS)) before a def (in backward order).
>  The instructions in mainMBB and fallBB during xbegin() expansion do not deal with EFLAGS. If a subsequent pass makes changes in mainMBB and fallBB that might impact the liveness of EFLAGS, that pass should make proper updates. Having
>
>   mainMBB->addLiveIn(X86::EFLAGS);
>   fallMBB->addLiveIn(X86::EFLAGS);
>
> is good too.


Removing the addLiveIn from mainMBB/fallMBB gives

  *** Bad machine code: Live in register not found to be live out from predecessor. ***
  - function:    wobble.12
  - basic block: %bb.5 bb107 (0x7f8863865bc0)
  EFLAGS not found to be live out from %bb.3
  
  *** Bad machine code: Live in register not found to be live out from predecessor. ***
  - function:    wobble.12
  - basic block: %bb.5 bb107 (0x7f8863865bc0)
  EFLAGS not found to be live out from %bb.4
  LLVM ERROR: Found 2 machine code errors.


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

https://reviews.llvm.org/D84479





More information about the llvm-commits mailing list