28 lines · plain
1; RUN: opt -passes=instcombine -S < %s | FileCheck %s2 3; This vscale udiv with a power-of-2 spalt on the rhs should not crash opt4 5; CHECK: define <vscale x 2 x i32> @udiv_pow2_vscale(<vscale x 2 x i32> %lhs)6define <vscale x 2 x i32> @udiv_pow2_vscale(<vscale x 2 x i32> %lhs) {7 %splatter = insertelement <vscale x 2 x i32> poison, i32 2, i32 08 %rhs = shufflevector <vscale x 2 x i32> %splatter,9 <vscale x 2 x i32> undef,10 <vscale x 2 x i32> zeroinitializer11 %res = udiv <vscale x 2 x i32> %lhs, %rhs12 ret <vscale x 2 x i32> %res13}14 15; This fixed width udiv with a power-of-2 splat on the rhs should also not16; crash, and instcombine should eliminate the udiv17 18; CHECK-LABEL: define <2 x i32> @udiv_pow2_fixed(<2 x i32> %lhs)19; CHECK-NOT: udiv20define <2 x i32> @udiv_pow2_fixed(<2 x i32> %lhs) {21 %splatter = insertelement <2 x i32> poison, i32 2, i32 022 %rhs = shufflevector <2 x i32> %splatter,23 <2 x i32> undef,24 <2 x i32> zeroinitializer25 %res = udiv <2 x i32> %lhs, %rhs26 ret <2 x i32> %res27}28