[InstCombine] update test to use FileCheck and auto-generate checks; NFC

llvm-svn: 288261
This commit is contained in:
Sanjay Patel 2016-11-30 18:49:56 +00:00
parent 7b75e3266c
commit c41d0c8a9b
1 changed files with 15 additions and 14 deletions

View File

@ -1,18 +1,19 @@
; This file contains various testcases that check to see that instcombine ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; is narrowing computations when possible. ; RUN: opt < %s -instcombine -S | FileCheck %s
; RUN: opt < %s -instcombine -S | \
; RUN: grep "ret i1 false" ; Eliminating the casts in this testcase (by narrowing the AND operation)
; allows instcombine to realize the function always returns false.
; test1 - Eliminating the casts in this testcase (by narrowing the AND
; operation) allows instcombine to realize the function always returns false.
;
define i1 @test1(i32 %A, i32 %B) { define i1 @test1(i32 %A, i32 %B) {
%C1 = icmp slt i32 %A, %B ; <i1> [#uses=1] ; CHECK-LABEL: @test1(
%ELIM1 = zext i1 %C1 to i32 ; <i32> [#uses=1] ; CHECK-NEXT: ret i1 false
%C2 = icmp sgt i32 %A, %B ; <i1> [#uses=1] ;
%ELIM2 = zext i1 %C2 to i32 ; <i32> [#uses=1] %C1 = icmp slt i32 %A, %B
%C3 = and i32 %ELIM1, %ELIM2 ; <i32> [#uses=1] %ELIM1 = zext i1 %C1 to i32
%ELIM3 = trunc i32 %C3 to i1 ; <i1> [#uses=1] %C2 = icmp sgt i32 %A, %B
%ELIM2 = zext i1 %C2 to i32
%C3 = and i32 %ELIM1, %ELIM2
%ELIM3 = trunc i32 %C3 to i1
ret i1 %ELIM3 ret i1 %ELIM3
} }