This is an archive of the discontinued LLVM Phabricator instance.

[MIR][NFC] Introduce a new method to check a MachineInstr contains implicit register
AbandonedPublic

Authored by lkail on Apr 14 2021, 12:52 AM.

Details

Summary

The motivation of adding this method is suggestion from @shchenz when reviewing https://reviews.llvm.org/D85288.

When performing peephole optimization, after calling MI.setDesc the boundary between explicit operands and implicit operands might be changed, it's not feasible to call MI.implicit_operands().empty() to check if the MI contains any implicit operand in the mid of constructing a new MI.

Diff Detail

Event Timeline

lkail requested review of this revision.Apr 14 2021, 12:52 AM
lkail created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2021, 12:52 AM

I don't think a helper that's only useful in the middle of a partial instruction modification is useful to generally expose

arsenm requested changes to this revision.Apr 14 2021, 5:42 AM
This revision now requires changes to proceed.Apr 14 2021, 5:42 AM

This is also further confused by the two types of implicit operands. There are implicit physical register uses as present in the instruction definition, but also implicit uses that code can arbitrarily append to an instruction

llvm/include/llvm/CodeGen/MachineInstr.h
1864

This would early out earlier if you check from the back too

lkail abandoned this revision.May 27 2021, 6:06 AM