[llvm] [NVPTX] Don't use stack memory when bitcasting to/from v2i8 (PR #113928)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 16:40:50 PDT 2024


================
@@ -2311,6 +2322,31 @@ NVPTXTargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const {
   return DAG.getBuildVector(Node->getValueType(0), dl, Ops);
 }
 
+SDValue NVPTXTargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const {
+  // Handle bitcasting from v2i8 without hitting the default promotion
+  // strategy which goes through stack memory.
+  SDLoc DL(Op);
+
+  EVT ToVT = Op->getValueType(0);
+  EVT FromVT = Op->getOperand(0)->getValueType(0);
+
+  if (FromVT == MVT::v2i8) {
----------------
justinfargnoli wrote:

Prefer early returns: https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code

https://github.com/llvm/llvm-project/pull/113928


More information about the llvm-commits mailing list