2006-02-12 03:02:43 +01:00
|
|
|
; This file contains various testcases that check to see that instcombine
|
|
|
|
; is narrowing computations when possible.
|
2007-01-13 06:06:52 +01:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
|
2007-04-14 22:13:02 +02:00
|
|
|
; RUN: grep {ret i1 false}
|
2006-02-12 03:02:43 +01:00
|
|
|
|
|
|
|
; test1 - Eliminating the casts in this testcase (by narrowing the AND
|
|
|
|
; operation) allows instcombine to realize the function always returns false.
|
|
|
|
;
|
|
|
|
bool %test1(int %A, int %B) {
|
|
|
|
%C1 = setlt int %A, %B
|
2006-11-27 02:05:10 +01:00
|
|
|
%ELIM1 = zext bool %C1 to uint
|
2006-02-12 03:02:43 +01:00
|
|
|
%C2 = setgt int %A, %B
|
2006-11-27 02:05:10 +01:00
|
|
|
%ELIM2 = zext bool %C2 to uint
|
2006-02-12 03:02:43 +01:00
|
|
|
%C3 = and uint %ELIM1, %ELIM2
|
2006-11-27 02:05:10 +01:00
|
|
|
%ELIM3 = trunc uint %C3 to bool
|
2006-02-12 03:02:43 +01:00
|
|
|
ret bool %ELIM3
|
|
|
|
}
|