[PATCH] D131642: [LegalizeTypes][NFC] Use getConstantOperandVal instead of cast constant getvalue.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 02:53:34 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2367
 
-    uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
+    uint64_t IdxVal = N->getConstantOperandVal(1);
 
----------------
craig.topper wrote:
> Not sure that I like that we repeated the "1" here when we already have `Idx`. It's potentially more code too since we need to dereference N again.
+1 We've tended to avoid using getConstantOperand helpers when we're also accessing the raw getOperand() variant - probably just do this in cases where we can then remove the getOperand call


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131642



More information about the llvm-commits mailing list