xref: /llvm-project/llvm/test/Transforms/InstCombine/assume-inseltpoison.ll (revision 05670b42f5b45710bfdba48dcb7e8c30c8c7478f)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7; A copy of assume.ll, with undef at insertelement/shufflevector replaced with
8; poison.
9declare void @llvm.assume(i1) #1
10
11; This would crash.
12; Does it ever make sense to peek through a bitcast of the icmp operand?
13
14define i32 @PR40940(<4 x i8> %x) {
15; CHECK-LABEL: @PR40940(
16; CHECK-NEXT:    [[SHUF:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> poison, <4 x i32> <i32 1, i32 1, i32 2, i32 3>
17; CHECK-NEXT:    [[T2:%.*]] = bitcast <4 x i8> [[SHUF]] to i32
18; CHECK-NEXT:    [[T3:%.*]] = icmp ult i32 [[T2]], 65536
19; CHECK-NEXT:    call void @llvm.assume(i1 [[T3]])
20; CHECK-NEXT:    ret i32 [[T2]]
21;
22  %shuf = shufflevector <4 x i8> %x, <4 x i8> poison, <4 x i32> <i32 1, i32 1, i32 2, i32 3>
23  %t2 = bitcast <4 x i8> %shuf to i32
24  %t3 = icmp ult i32 %t2, 65536
25  call void @llvm.assume(i1 %t3)
26  ret i32 %t2
27}
28