[DAG] canCreateUndefOrPoison - add freeze(insert_subvector(x,y,c)) -> insert_subvecto...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 3 Sep 2022 12:41:33 +0000 (13:41 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 3 Sep 2022 12:41:33 +0000 (13:41 +0100)
We already have plenty of assertions in place to ensure that the insertion index is constant and inrange

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/freeze-vector.ll

index 711bd92..cffdc3a 100644 (file)
@@ -4603,6 +4603,7 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
   case ISD::AssertSext:
   case ISD::AssertZext:
   case ISD::FREEZE:
+  case ISD::INSERT_SUBVECTOR:
   case ISD::AND:
   case ISD::OR:
   case ISD::XOR:
index 0275d25..af34e56 100644 (file)
@@ -5,9 +5,7 @@
 define <4 x i32> @freeze_insert_subvector(<8 x i32> %a0) nounwind {
 ; CHECK-LABEL: freeze_insert_subvector:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    vmovaps %xmm0, %xmm0
-; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm0
-; CHECK-NEXT:    vzeroupper
+; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
 ; CHECK-NEXT:    ret{{[l|q]}}
   %x = shufflevector <8 x i32> %a0, <8 x i32> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
   %y = freeze <8 x i32> %x