[PATCH] D128911: Emit table lookup from TargetLowering::expandCTTZ()
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 9 12:34:06 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7860
+ ConstantSDNode *IndexNode = dyn_cast<ConstantSDNode>(Index);
+ ConstantInt *temp = const_cast<ConstantInt *>(IndexNode->getConstantIntValue());
+ Constant *ConstantData = dyn_cast<Constant >(temp);
----------------
`dyn_cast` should only be used if the cast can fail. Otherwise use `cast`
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7862
+ Constant *ConstantData = dyn_cast<Constant >(temp);
+ Elt.push_back(ConstantData);
+ }
----------------
Same comment about `dyn_cast`
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7865
+ ArrayRef<Constant *> Elts = Elt;
+ auto *FPTy = Elts[0]->getType();
+ const DataLayout &TD = DAG.getDataLayout();
----------------
Why do we need to create an explicit ArrayRef here?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128911/new/
https://reviews.llvm.org/D128911
More information about the llvm-commits
mailing list