[llvm] [PowerPC] Fix assert exposed by PR 95931 in LowerBITCAST (PR #108062)

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 10:56:31 PDT 2024


================
@@ -9470,12 +9470,13 @@ SDValue PPCTargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const {
   SDLoc dl(Op);
   SDValue Op0 = Op->getOperand(0);
 
+  if ((Op.getValueType() != MVT::f128) || (Op0.getOpcode() != ISD::BUILD_PAIR))
+    return SDValue();
+
   SDValue Lo = Op0.getOperand(0);
   SDValue Hi = Op0.getOperand(1);
-
-  if ((Op.getValueType() != MVT::f128) ||
-      (Op0.getOpcode() != ISD::BUILD_PAIR) || (Lo.getValueType() != MVT::i64) ||
-      (Hi.getValueType() != MVT::i64) || !Subtarget.isPPC64())
+  if ((Lo.getValueType() != MVT::i64) || (Hi.getValueType() != MVT::i64) ||
+      !Subtarget.isPPC64())
----------------
lei137 wrote:

nit: maybe good to move `!Subtarget.isPPC64()` to begining of cond on line 9473.

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


More information about the llvm-commits mailing list