[DAGCombiner] Use APInt directly in (shl (ext (shl x, c1)), c2) combine
Fix failure to detect out of range shift constants leading to assert in ConstantSDNode::getZExtValue()
Followup to D23007
llvm-svn: 281354
diff --git a/llvm/test/CodeGen/X86/shift-i128.ll b/llvm/test/CodeGen/X86/shift-i128.ll
index aef923f..1de99b1 100644
--- a/llvm/test/CodeGen/X86/shift-i128.ll
+++ b/llvm/test/CodeGen/X86/shift-i128.ll
@@ -116,3 +116,21 @@
store <2 x i128> %1, <2 x i128>* %r, align 16
ret void
}
+
+;
+; Combines
+;
+
+define <2 x i256> @shl_sext_shl_outofrange(<2 x i128> %a0) {
+ %1 = shl <2 x i128> %a0, <i128 -1, i128 -1>
+ %2 = sext <2 x i128> %1 to <2 x i256>
+ %3 = shl <2 x i256> %2, <i256 128, i256 128>
+ ret <2 x i256> %3
+}
+
+define <2 x i256> @shl_zext_shl_outofrange(<2 x i128> %a0) {
+ %1 = shl <2 x i128> %a0, <i128 -1, i128 -1>
+ %2 = zext <2 x i128> %1 to <2 x i256>
+ %3 = shl <2 x i256> %2, <i256 128, i256 128>
+ ret <2 x i256> %3
+}