This is an archive of the discontinued LLVM Phabricator instance.

[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs
ClosedPublic

Authored by reames on May 5 2022, 12:50 PM.

Details

Summary

This assertion should hold for any reasonable data flow algorithm, but is known not to in several cases today. I'd like to go ahead and land this off-by-default, so that we can collaborate on fixes and have a common definition of success.

Diff Detail

Unit TestsFailed

Event Timeline

reames created this revision.May 5 2022, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 12:50 PM
reames requested review of this revision.May 5 2022, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 12:50 PM
reames planned changes to this revision.May 5 2022, 1:28 PM

When I split this out of another patch set, I apparently missed updating the assert. This assert only holds if we encountered an instruction which needs a state, otherwise we have an uninitialized current state. Updated diff forthcoming.

reames updated this revision to Diff 427433.May 5 2022, 1:45 PM

Allow uninitialized current state.

frasercrmck added inline comments.May 6 2022, 4:41 AM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1188

printMBBReference might be better since getName returns an empty string if there's no IR BB?

reames updated this revision to Diff 427653.May 6 2022, 8:51 AM

Address review comment.

frasercrmck added inline comments.May 6 2022, 8:54 AM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1193

Sorry - last minute comment. Maybe an assertion message would help people report issues to us more easily.

reames updated this revision to Diff 427657.May 6 2022, 8:58 AM

Address review comment

(If you want particular wording on the assert message, include it in a comment and I'll change before landing.)

frasercrmck accepted this revision.May 6 2022, 8:59 AM

LGTM, thanks

This revision is now accepted and ready to land.May 6 2022, 8:59 AM
reames closed this revision.May 6 2022, 2:20 PM

This has landed. I got the tag wrong in the commit message so the auto-close didn't kick in.

commit f486119ce94573793c1569f1542c09fae74a0d1d
Author: Philip Reames <preames@rivosinc.com>
Date: Thu May 5 12:50:47 2022 -0700

[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs

This assertion should hold for any reasonable data flow algorithm, but is known not to in several cases today. I'd like to go ahead and land this off-by-default, so that we can collaborate on fixes and have a common definition of success.

Differential: https://reviews.llvm.org/D125035