This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Improve hazard checks for inline asm statements
ClosedPublic

Authored by msearles on Nov 15 2017, 1:11 PM.

Details

Summary

[AMDGPU] Add GCNHazardRecognizer::checkInlineAsmHazards() and GCNHazardRecognizer::checkVALUHazardsHelper(). checkInlineAsmHazards() checks INLINEASM for hazards that we particularly care about (so not exhaustive); this patch adds a check for INLINEASM that defs vregs that hold data-to-be stored by immediately preceding store of more than 8 bytes. If the instr were not within an INLINEASM, this scenario would be handled by checkVALUHazard(). Add checkVALUHazardsHelper(), which will be called by both checkVALUHazards() and checkInlineAsmHazards().

Diff Detail

Repository
rL LLVM

Event Timeline

msearles created this revision.Nov 15 2017, 1:11 PM
arsenm added inline comments.Nov 16 2017, 7:37 PM
lib/Target/AMDGPU/GCNHazardRecognizer.cpp
577 ↗(On Diff #123075)

Should this check every instruction type hazard?

msearles marked an inline comment as done.Nov 20 2017, 5:34 PM
msearles added inline comments.
lib/Target/AMDGPU/GCNHazardRecognizer.cpp
577 ↗(On Diff #123075)

Probably. I'm fine to add a FIXME to checkInlineAsmHazards() to not forget that more work needs to be done and fine to do that work. However, I'd like to push the fix for this bug, since it is being hit and add the additional code in a follow-on patch.

msearles marked an inline comment as done.Nov 29 2017, 12:27 PM

Ping

arsenm accepted this revision.Nov 30 2017, 11:53 AM

LGTM with formatting fixed

lib/Target/AMDGPU/GCNHazardRecognizer.cpp
519 ↗(On Diff #123075)

This looks like it goes over 80 lines

548 ↗(On Diff #123075)

MF.getRegInfo()

This revision is now accepted and ready to land.Nov 30 2017, 11:53 AM
msearles updated this revision to Diff 125047.Nov 30 2017, 4:01 PM

Adjusted per reviewer comments.

msearles marked 2 inline comments as done.Nov 30 2017, 4:03 PM
msearles added inline comments.
lib/Target/AMDGPU/GCNHazardRecognizer.cpp
519 ↗(On Diff #123075)

Fixed

548 ↗(On Diff #123075)

Fixed this instance as well as a few others.

This revision was automatically updated to reflect the committed changes.
msearles marked 2 inline comments as done.