llvm.org GIT mirror llvm / 9d51722
[InstSimplify] add test to demonstrate undef matching differences; NFC This is a baseline test for D54631. Patch by: @nikic (Nikita Popov) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347055 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 11 months ago
1 changed file(s) with 25 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt < %s -instsimplify -S | FileCheck %s
2
3 ; This tests checks optimization consistency for scalar and vector code.
4 ; If m_Zero() is able to match a vector undef, but not a scalar undef,
5 ; the two cases will simplify differently.
6
7 define i32 @test_scalar(i32 %a, i1 %b) {
8 ; CHECK-LABEL: @test_scalar(
9 ; CHECK-NEXT: ret i32 undef
10 ;
11 %c = sext i1 %b to i32
12 %d = ashr i32 undef, %c
13 ret i32 %d
14 }
15
16 define <2 x i32> @test_vector(<2 x i32> %a, <2 x i1> %b) {
17 ; CHECK-LABEL: @test_vector(
18 ; CHECK-NEXT: ret <2 x i32> zeroinitializer
19 ;
20 %c = sext <2 x i1> %b to <2 x i32>
21 %d = ashr <2 x i32> undef, %c
22 ret <2 x i32> %d
23 }
24