This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add the DebugLoc parameter to getVLENFactoredAmount().
ClosedPublic

Authored by HsiangKai on May 12 2021, 11:34 PM.

Details

Summary

The MachineBasicBlock::iterator is continuously changing during
generating the frame handling instructions. We should use the DebugLoc
from the caller, instead of getting it from the changing iterator.

Diff Detail

Event Timeline

HsiangKai created this revision.May 12 2021, 11:34 PM
HsiangKai requested review of this revision.May 12 2021, 11:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2021, 11:34 PM

Maybe you could pre-commit the test case to easier demonstrate the change of this patch?

HsiangKai added a comment.EditedMay 13 2021, 1:01 AM

Maybe you could pre-commit the test case to easier demonstrate the change of this patch?

The test case will crash without this patch. The point is all the prologue instructions located in a basic block without other instructions at the end. As generating these prologue instructions, the iterator will be updated to the boundary of the basic block and it is invalid to use the iterator to access DebugLoc.

frasercrmck accepted this revision.May 13 2021, 1:10 AM

LGTM but if this (also) fixes a crash I think the description could be updated to reflect that. I inferred from the description that this was just about improving the debug information.

This revision is now accepted and ready to land.May 13 2021, 1:10 AM

LGTM but if this (also) fixes a crash I think the description could be updated to reflect that. I inferred from the description that this was just about improving the debug information.

It makes sense. I will do it. Thanks.