This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Ensure the forwarded AVL register is alive
ClosedPublic

Authored by loralb on May 19 2022, 6:56 AM.

Details

Summary

When the AVL value does not fit in 5 bits, the register in which this value is stored may be dead when we want to forward it. This patch ensure the kill flags on the register are cleared before forwarding.

Diff Detail

Event Timeline

loralb created this revision.May 19 2022, 6:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 6:56 AM
loralb requested review of this revision.May 19 2022, 6:56 AM

Oh, good catch!

We have the same bug in several places in this code, would you mind updating the fix to include all three? I tagged them inline.

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1218

Here

1265

Here

craig.topper added inline comments.May 19 2022, 10:07 PM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1218

I'm pretty sure this one is always X0, since that's the only register hasNonZeroAVL/hasZeroAVL work for. But we should assert to be safe.

1265

This one is always X0. I don't think MRI knows about the uses of X0 to find kill flags to clear.

reames accepted this revision.May 20 2022, 7:09 AM

Craig is correct on both points. Given that, LGTM to the original patch unmodified.

This revision is now accepted and ready to land.May 20 2022, 7:09 AM
This revision was landed with ongoing or failed builds.May 24 2022, 3:08 PM
This revision was automatically updated to reflect the committed changes.