1*9880d681SAndroid Build Coastguard Worker; This file contains various testcases that check to see that instcombine 2*9880d681SAndroid Build Coastguard Worker; is narrowing computations when possible. 3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | \ 4*9880d681SAndroid Build Coastguard Worker; RUN: grep "ret i1 false" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; test1 - Eliminating the casts in this testcase (by narrowing the AND 7*9880d681SAndroid Build Coastguard Worker; operation) allows instcombine to realize the function always returns false. 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Workerdefine i1 @test1(i32 %A, i32 %B) { 10*9880d681SAndroid Build Coastguard Worker %C1 = icmp slt i32 %A, %B ; <i1> [#uses=1] 11*9880d681SAndroid Build Coastguard Worker %ELIM1 = zext i1 %C1 to i32 ; <i32> [#uses=1] 12*9880d681SAndroid Build Coastguard Worker %C2 = icmp sgt i32 %A, %B ; <i1> [#uses=1] 13*9880d681SAndroid Build Coastguard Worker %ELIM2 = zext i1 %C2 to i32 ; <i32> [#uses=1] 14*9880d681SAndroid Build Coastguard Worker %C3 = and i32 %ELIM1, %ELIM2 ; <i32> [#uses=1] 15*9880d681SAndroid Build Coastguard Worker %ELIM3 = trunc i32 %C3 to i1 ; <i1> [#uses=1] 16*9880d681SAndroid Build Coastguard Worker ret i1 %ELIM3 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19