[llvm] [NVPTX] pull in v2i32 build_vector through v2f32 bitcast (PR #153478)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 13 13:02:26 PDT 2025


================
@@ -5334,6 +5335,26 @@ static SDValue PerformANDCombine(SDNode *N,
   return SDValue();
 }
 
+static SDValue combineBitcast(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
+  const SDValue &Input = N->getOperand(0);
+  const MVT FromVT = Input.getSimpleValueType();
+  const MVT ToVT = N->getSimpleValueType(0);
+  const SDLoc DL(N);
+
+  if (Input.getOpcode() != ISD::BUILD_VECTOR || ToVT != MVT::v2f32 ||
+      !(FromVT.isVector() &&
+        FromVT.getVectorNumElements() == ToVT.getVectorNumElements()))
+    return SDValue();
----------------
AlexMaclean wrote:

In case we ever want to add any other combines for bitcast, lets refactor this to invert this if and return a SDValue() as a fall through. That way other potential combinations could be easily inserted below in the future. 

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


More information about the llvm-commits mailing list