[PATCH] D133747: Address feedback in https://reviews.llvm.org/D133637

YongKang Zhu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 13:29:03 PDT 2022


yozhu added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineOperand.cpp:396
+
+    assert(0 && "MachineOperand not associated with any MachineFunction");
+    return hash_combine(MO.getType(), MO.getTargetFlags());
----------------
ellis wrote:
> I find it a bit strange that we are failing an assert but still returning something. Is this better suited for `llvm_unreachable()`?
The assert() is mainly to get people's attention if a machine operand is hashed when it is not associated with any machine function (since later when it gets associated with a machine function, the hash value, if calculated again, would be different).  But we are not sure if the above scenario is absolutely invalid or no one is actually using this, so we made the code still return something (at least the Release build will work if the scenario does exist).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133747



More information about the llvm-commits mailing list