[PATCH] D125212: [GlobalISel] Implement the HasNoUse builtin predicate

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 04:53:12 PDT 2022


foad added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h:390
+      const MachineInstr *MI = State.MIs[InsnID];
+      assert(MI != nullptr && "Used insn before defined");
+      assert(MI->getNumDefs() > 0 && "No defs");
----------------
abinavpp wrote:
> foad wrote:
> > Don't need `== nullptr`.
> Don't we need to make sure that State.MIs[InsnID] is not a nullptr here?
I just meant you could write it as `assert(MI && "Used insn before defined")` - you don't need the `!= nullptr` part. (And I mistyped `==` instead of `!=`.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125212



More information about the llvm-commits mailing list