[PATCH] D104409: GlobalISel/Utils: Refactor integer/float constant match functions

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 15:33:13 PDT 2021


arsenm added a comment.

Do we even really need G_FCONSTANT? I've always thought having a separate node/opcode for these was just pointless complexity that can just as well be tracked with an APInt



================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:354-356
+bool isGConstant(const MachineInstr *MI) {
+  return MI->getOpcode() == TargetOpcode::G_CONSTANT;
+}
----------------
Petar.Avramovic wrote:
> I thought to make this public. There are many opcode checks like this, most often in asserts.
> Do you find it useful?
I think a function to check a single case is just noise


================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:354-356
+bool isGConstant(const MachineInstr *MI) {
+  return MI->getOpcode() == TargetOpcode::G_CONSTANT;
+}
----------------
paquette wrote:
> arsenm wrote:
> > Petar.Avramovic wrote:
> > > I thought to make this public. There are many opcode checks like this, most often in asserts.
> > > Do you find it useful?
> > I think a function to check a single case is just noise
> I don't know if it really improves on the existing opcode checks all too much.
> 
> (This would also probably need a check for nullptr or an assert?)
Or just use a reference, shouldn't handle null


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

https://reviews.llvm.org/D104409



More information about the llvm-commits mailing list