This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
ClosedPublic

Authored by yaxunl on Dec 12 2017, 1:40 PM.

Details

Summary

Two issues were found about machine inst scheduler when compiling ProRender
with -g for amdgcn target:

  1. GCNScheduleDAGMILive::schedule tries to update LiveIntervals for DBG_VALUE, which it

should not since DBG_VALUE is not mapped in LiveIntervals.

  1. when DBG_VALUE is the last instruction of MBB, ScheduleDAGInstrs::buildSchedGraph and

ScheduleDAGMILive::scheduleMI does not move RPTracker properly, which causes assertion.

This patch fixes that.

Diff Detail

Repository
rL LLVM

Event Timeline

yaxunl created this revision.Dec 12 2017, 1:40 PM
This revision is now accepted and ready to land.Dec 12 2017, 1:55 PM
yaxunl updated this revision to Diff 126622.Dec 12 2017, 2:06 PM
yaxunl edited the summary of this revision. (Show Details)

Use a more reduced test as suggested by Matt.

arsenm added inline comments.Dec 12 2017, 2:13 PM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126622)

Typo in cpu

1 ↗(On Diff #126622)

It's overridden by the attribute so it should just be dropped. Also could use -verify-machineinstrs, and should check for the DBG_VALUE

yaxunl added inline comments.Dec 12 2017, 2:28 PM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126622)

How do I check DBG_VALUE? It is not in the ISA assembly.

yaxunl added inline comments.Dec 12 2017, 2:37 PM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126622)

Never mind. I saw it with -O0.

yaxunl updated this revision to Diff 126635.Dec 12 2017, 2:41 PM

Fix the test.

arsenm added inline comments.Dec 13 2017, 7:49 AM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126622)

-O0 will disable the scheduler, breaking the point of the test. It should appear as a comment even with optimizations

yaxunl added inline comments.Dec 13 2017, 1:48 PM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126622)

The test missed some debug info, therefore LiveDebugVariables pass removed the DBG_VALUE. Will fix the test.

yaxunl updated this revision to Diff 126835.Dec 13 2017, 1:56 PM

Fix the test.

arsenm accepted this revision.Dec 13 2017, 2:12 PM

LGTM except for mcpu

test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126835)

The -mcpu should still be dropped because it contradicts the attribute

yaxunl added inline comments.Dec 13 2017, 2:16 PM
test/CodeGen/AMDGPU/debug-value.ll
1 ↗(On Diff #126835)

will drop it when committing.

This revision was automatically updated to reflect the committed changes.