LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 28142 - RegScavenger (as used by BranchFolding) pessimises liveness
Summary: RegScavenger (as used by BranchFolding) pessimises liveness
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-15 10:13 PDT by Ahmed Bougacha
Modified: 2016-07-11 12:16 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Bougacha 2016-06-15 10:13:50 PDT
This came up in http://reviews.llvm.org/D21085; on the original testcase:
  Looks like BranchFolding, when merging tails, indiscriminately marks every register defined but not killed (it might really be live, but not necessarily) before the tail as live-in the new tail block. It queries the RegisterScavenger, which walks the original block forward, using kill flags; maybe it should walk the tail block backward instead?

That patch adds forward liveness computation to X86FixupBWInsts (using flags, via LivePhysRegs) as a stopgap.

Instead, seems like we should:
- teach RegScavenger to compute liveness backwards (or replace it with something else)
- fix the various users; in this case, BranchFolding
- remove the X86FixupBWInsts workaround, and probably more
Comment 1 Matthias Braun 2016-07-06 21:38:44 PDT
This looks like a duplicate of http://llvm.org/PR28295 to me.
Comment 2 Matthias Braun 2016-07-06 21:45:16 PDT
Unfortunately the testcase of r272797 just codifies the bad live-in list in a .mir test so I cannot use it to whether the revision is not necessary any longer after http://reviews.llvm.org/D22027 any tips in reproducing the problem?

(I am on a question to kill the kill flags which means we cannot use forward liveness simulation any longer).
Comment 3 Matthias Braun 2016-07-08 19:51:04 PDT
I proposed http://reviews.llvm.org/D22083 which in my tests produces identical code for the llvm test-suite including all externals.
Comment 4 Ahmed Bougacha 2016-07-11 11:19:10 PDT
I think Kevin said this was seen on SPEC, so no difference in the test-suite is perfect.
Comment 5 Matthias Braun 2016-07-11 12:16:20 PDT
the test-suite optionally allows to plug in Spec95, spec2000 and spec2006 in the Externals directory which I did.