[PATCH] D137108: Implement support for AArch64ISD::MOVI in computeKnownBits

Adrian Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 07:45:05 PDT 2022


adriantong1024 added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:1976
+  case AArch64ISD::MOVI: {
+    ConstantSDNode *CN = cast<ConstantSDNode>(Op->getOperand(0));
+    assert(CN && "Expect MOVI operand to be ConstantSDNode");
----------------
foad wrote:
> tschuett wrote:
> > tschuett wrote:
> > > Could you you change it to `dyn_cast` with if to get the correct assert and error message?
> > I still believe that you need and `if` to check in Release mode whether it really is a constant node.
> No, just use cast<> and remove the assert.
Thanks for the comment. I went back to check "The cast<> operator is a “checked cast” operation. It converts a pointer or reference from a base class to a derived class, causing an assertion failure if it is not really an instance of the right type." This seems to be what we want. 

Let me know if there are other concerns! 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137108



More information about the llvm-commits mailing list