This is an archive of the discontinued LLVM Phabricator instance.

[framelowering] Improve tracking of first CS pop instruction.
ClosedPublic

Authored by fhahn on Dec 2 2016, 7:03 AM.

Details

Summary

This patch makes sure FirstCSPop and MBBI never point to DBG_VALUE instructions, which affected the code generated.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn updated this revision to Diff 80067.Dec 2 2016, 7:03 AM
fhahn retitled this revision from to [framelowering] Improve tracking of first CS pop instruction. .
fhahn updated this object.
fhahn added a reviewer: mkuper.
fhahn added reviewers: MatzeB, aprantl.
fhahn added a subscriber: llvm-commits.
MatzeB edited edge metadata.Dec 2 2016, 5:50 PM

The change itself looks good to me, but would be nice to simplify/cleanup the testcase.

lib/Target/X86/X86FrameLowering.cpp
1559–1565 ↗(On Diff #80067)

You could use this to avoid code duplication:
`
if (Opc != DBG_VALUE && !Termiantor) {

if (Opc != Pop32 && Opc != Pop64)
  break;
FirstCSPop = PI;

}
`

test/CodeGen/X86/frame-lowering-debug-intrinsic.ll
4 ↗(On Diff #80067)

The test seems bigger than necessary. Some things that could be simplified:

  • Remove the ; preds = comments
  • Simplify float constants to 0x0? Or use integer math in the first place?
  • Do you need the calls to fmod, fabs?
  • The nounwind, readnone attributes should not be necessary
  • I don't know much about debuginfo, but if there is a way to reduce the amount of metadata at the end...
23 ↗(On Diff #80067)

Use CHECK-LABEL noDebug: to improve FileCheck output in case of errors.

46 ↗(On Diff #80067)

CHECK-LABEL

fhahn updated this revision to Diff 80330.Dec 5 2016, 2:54 PM
fhahn edited edge metadata.

Thanks for the review. I've updated the patch and hope I addressed all comments.

fhahn marked 3 inline comments as done.Dec 5 2016, 2:56 PM
fhahn added inline comments.
test/CodeGen/X86/frame-lowering-debug-intrinsic.ll
4 ↗(On Diff #80067)

I've reduced the test case quite a bit. AFAIK the debug data in the test case is the minimum required.

MatzeB accepted this revision.Dec 5 2016, 2:58 PM
MatzeB edited edge metadata.

Thanks, LGTM. Nitpick below.

test/CodeGen/X86/frame-lowering-debug-intrinsic.ll
3 ↗(On Diff #80330)

Nitpick: I prefer llc -o - %s over llc < %s because the former can be prefixed with lldb -- and still works as expected.

This revision is now accepted and ready to land.Dec 5 2016, 2:58 PM
fhahn updated this revision to Diff 80336.Dec 5 2016, 3:17 PM
fhahn edited edge metadata.
fhahn marked an inline comment as done.

Test run line nitpick.

MatzeB added a comment.Dec 5 2016, 3:29 PM

The LGTM still stands. I often accept a review even with outstanding nitpicks when I trust that the author can fix the remaining items without the need for another review round.

This revision was automatically updated to reflect the committed changes.