This is an archive of the discontinued LLVM Phabricator instance.

[X86] Simplify the interface to getCondNoFromDesc.
ClosedPublic

Authored by craig.topper on Mar 20 2022, 9:45 PM.

Details

Summary

Instead of taking a SkipDefs parameter, rename to getCondSrcNoFromDesc
and have it return the source operand number. Make getCondFromMI
responsible for adding the number of Defs for MI instructions.

While there remove some unneeded casts to unsigned and check for
negative numbers instead of explicitly -1. Less than 0 is easier
for a compiler to codegen.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 20 2022, 9:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2022, 9:45 PM
craig.topper requested review of this revision.Mar 20 2022, 9:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2022, 9:45 PM
skan added inline comments.Mar 20 2022, 9:57 PM
llvm/lib/Target/X86/X86InstrInfo.cpp
2593

Keep the comments here?

2606

Did you get an warning from compiler when removing this static_cast?

Add back comment.

craig.topper added inline comments.Mar 20 2022, 10:07 PM
llvm/lib/Target/X86/X86InstrInfo.cpp
2606

I didn't get any warning and this isn't the only place in tree we pass int to getOperand.

skan accepted this revision.Mar 20 2022, 10:09 PM

Looks great!

This revision is now accepted and ready to land.Mar 20 2022, 10:09 PM
This revision was landed with ongoing or failed builds.Mar 20 2022, 11:03 PM
This revision was automatically updated to reflect the committed changes.