[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:51 PDT 2024


================
@@ -6128,6 +6166,26 @@ SDValue NVPTXTargetLowering::PerformDAGCombine(SDNode *N,
   return SDValue();
 }
 
+static void ReplaceBITCAST(SDNode *Node, SelectionDAG &DAG,
+                           SmallVectorImpl<SDValue> &Results) {
+  // Handle bitcasting to v2i8 without hitting the default promotion
+  // strategy which goes through stack memory.
+  SDValue Op(Node, 0);
+  SDLoc DL(Node);
+
+  EVT ToVT = Op->getValueType(0);
+  if (ToVT == 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