[PATCH] D107362: GlobalISel: Fix matchEqualDefs for instructions with multiple defs

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 03:00:33 PDT 2021


Petar.Avramovic added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2732
+    // %1 and %6 are same, %1 and %7 are not the same value.
+    return I1->findRegisterDefOperandIdx(InstAndDef1->Reg) ==
+           I2->findRegisterDefOperandIdx(InstAndDef2->Reg);
----------------
foad wrote:
> If findRegisterDefOperandIdx is slow then it might be worth adding a fast case like: "if I1 only has 1 def, return true". But I'm not sure if it's worth it.
findRegisterDefOperandIdx simply loops through operands, if it is only one def it will match it in first try. Num operands is already calculated so it is probably a little bit faster in theory but I don't think it is worth it.


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

https://reviews.llvm.org/D107362



More information about the llvm-commits mailing list