[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

Ivan Baev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 21:38:59 PDT 2020


ivanbaev requested changes to this revision.
ivanbaev added a comment.
This revision now requires changes to proceed.

Hi Craig, thank you for working on this bug.

1. *** IR Dump Before Finalize ISel and expand pseudo-instructions ***:
2. Machine code for function wobble.12: IsSSA, TracksLiveness

bb.0.bb107:

  successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%)
  
  %0:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load 4 from %fixed-stack.0, align 16)
  %1:gr32 = SUB32ri8 %0:gr32(tied-def 0), 1, implicit-def $eflags
  %2:gr32 = XBEGIN
  JCC_1 %bb.2, 5, implicit $eflags
  JMP_1 %bb.1

...

-----------------------------------------------------------------------------

Given the IR above for the test, an alternative liveness check for eflags is to iterate backward. 
Look for a def of eflag, and if we reach the start of the basic block: check BB->isLiveIn(X86::EFLAGS)) and avoid iterating over successors of BB as in the proposed fix.

As optimization add EFLAGS only to sinkMBB
sinkMBB->addLiveIn(X86::EFLAGS);

The proposed is fine too.


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

https://reviews.llvm.org/D84479





More information about the llvm-commits mailing list