This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Check Dest Resgister Liveness in CondOpt pass
ClosedPublic

Authored by zzheng on Oct 30 2014, 4:56 PM.

Details

Summary
CondOpt pass does not check for destination register liveness of subs (alias with cmp) instructions.

Our internal test reveals such case should not be transformed:

  cmp x17, #3
  b.lt .LBB10_15
  ...
  subs x12, x12, #1
  b.gt .LBB10_1

where x12 is a liveout, becomes:

  cmp x17, #2
  b.le .LBB10_15
  ...
  subs x12, x12, #2
  b.ge .LBB10_1

Diff Detail

Event Timeline

zzheng updated this revision to Diff 15594.Oct 30 2014, 4:56 PM
zzheng retitled this revision from to [AArch64] Check Dest Resgister Liveness in CondOpt pass.
zzheng updated this object.
zzheng edited the test plan for this revision. (Show Details)
zzheng added a subscriber: Unknown Object (MLST).
sdmitrouk edited edge metadata.Oct 31 2014, 4:11 AM

Hi,

Somehow from instruction reference and comments I mistakenly assumed that
such instructions won't occur with liveout destinations, but now I see it
should be checked. I tried to make a test-case for a couple hours, but
had no luck here.

Thanks for catching this!

Regards,
Sergey

lib/Target/AArch64/AArch64ConditionOptimizer.cpp
130

There is INITIALIZE_PASS_BEGIN...INITIALIZE_PASS_END above (not full context, by the way), LiveIntervals should be added there as well or just drop lines from namespace llvm { to INITIALIZE_PASS_END (might be preferred).

zzheng updated this revision to Diff 15635.Oct 31 2014, 11:29 AM
zzheng edited edge metadata.

+INITIALIZE_PASS_DEPENDENCY(LiveIntervals)

mcrosier accepted this revision.Oct 31 2014, 12:13 PM
mcrosier added a reviewer: mcrosier.
This revision is now accepted and ready to land.Oct 31 2014, 12:13 PM
mcrosier closed this revision.Oct 31 2014, 12:13 PM

Committed in r220987.