blob: 75a78a3f8b75647639d53bdf2ac8f9f1ae5a9ea3 [file] [log] [blame]
Chris Lattnerecd96532006-02-12 02:02:43 +00001; This file contains various testcases that check to see that instcombine
2; is narrowing computations when possible.
3
Chris Lattnereaee5f52006-05-07 18:16:31 +00004; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret bool false'
Chris Lattnerecd96532006-02-12 02:02:43 +00005
6; test1 - Eliminating the casts in this testcase (by narrowing the AND
7; operation) allows instcombine to realize the function always returns false.
8;
9bool %test1(int %A, int %B) {
10 %C1 = setlt int %A, %B
Reid Spencer3da59db2006-11-27 01:05:10 +000011 %ELIM1 = zext bool %C1 to uint
Chris Lattnerecd96532006-02-12 02:02:43 +000012 %C2 = setgt int %A, %B
Reid Spencer3da59db2006-11-27 01:05:10 +000013 %ELIM2 = zext bool %C2 to uint
Chris Lattnerecd96532006-02-12 02:02:43 +000014 %C3 = and uint %ELIM1, %ELIM2
Reid Spencer3da59db2006-11-27 01:05:10 +000015 %ELIM3 = trunc uint %C3 to bool
Chris Lattnerecd96532006-02-12 02:02:43 +000016 ret bool %ELIM3
17}