[PATCH] D104410: GlobalISel/Utils: Refactor constant splat match functions

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 16:12:36 PDT 2021


aemerson added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:367
 
+bool isGImplicitDef(const MachineInstr *MI) {
+  return MI->getOpcode() == TargetOpcode::G_IMPLICIT_DEF;
----------------
paquette wrote:
> This will need a nullptr check.
> 
> I'm not sure about how I feel about adding functions for generic opcode checks, since I think it could end up being confusing if we don't add them for every opcode. :/
> 
> That being said, these do look nicer than using `MI->getOpcode()` everywhere.
> 
> (Maybe someone else can give a stronger opinion here.)
I don't think alone this helper has much benefit. I think it would be nice to have some wrapper classes around MachineInstr to do some of that while also proving some abstractions over operand accessors etc. I haven't got around to it but was on my todo list.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104410/new/

https://reviews.llvm.org/D104410



More information about the llvm-commits mailing list