Commit Graph

41 Commits

Author SHA1 Message Date
Evan Cheng
4e56ab2cf4 Clean up previous cast optimization a bit. Also make zext elimination a bit more aggressive: if it's not necessary to emit an AND (i.e. high bits are already zero), it's profitable to evaluate the operand at a different type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 02:11:43 +00:00
Chris Lattner
a80d668215 Implement rdar://6480391, extending of equality icmp's to avoid a truncation.
I noticed this in the code compiled for a routine using std::map, which produced
this code:
	%25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly
	%.lobit.i = lshr i32 %25, 31		; <i32> [#uses=1]
	%tmp.i = trunc i32 %.lobit.i to i8		; <i8> [#uses=1]
	%toBool = icmp eq i8 %tmp.i, 0		; <i1> [#uses=1]
	br i1 %toBool, label %bb3, label %bb4
which compiled to:

	call	L_memcmp$stub
	shrl	$31, %eax
	testb	%al, %al
	jne	LBB1_11	## 

with this change, we compile it to:

	call	L_memcmp$stub
	testl	%eax, %eax
	js	LBB1_11

This triggers all the time in common code, with patters like this:

	%169 = and i32 %ply, 1		; <i32> [#uses=1]
	%170 = trunc i32 %169 to i8		; <i8> [#uses=1]
	%toBool = icmp ne i8 %170, 0		; <i1> [#uses=1]

 	%7 = lshr i32 %6, 24		; <i32> [#uses=1]
	%9 = trunc i32 %7 to i8		; <i8> [#uses=1]
	%10 = icmp ne i8 %9, 0		; <i1> [#uses=1]

etc



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 07:47:06 +00:00
Tanya Lattner
6f729d601c Byebye llvm-upgrade!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 04:26:08 +00:00
Reid Spencer
7c65d4345e For PR1319:
Make use of the END. facility on all files > 1K so that we aren't wasting CPU
cycles searching for RUN: lines that we'll never find.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36059 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-15 07:38:21 +00:00
Reid Spencer
2b544beda3 For PR1319:
Upgrade tests to work with new llvm.exp version of llvm_runtest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36013 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-14 20:13:02 +00:00
Reid Spencer
e4d87aa2de For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Reid Spencer
69ccadd753 Use the llvm-upgrade program to upgrade llvm assembly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32115 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-02 04:23:10 +00:00
Chris Lattner
6478b2fcd1 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32010 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-29 07:17:32 +00:00
Chris Lattner
41e2103133 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32008 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-29 07:03:00 +00:00
Reid Spencer
3da59db637 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-27 01:05:10 +00:00
Chris Lattner
537cf962d1 new testcase, malloc should be promoted to [2 x double].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30681 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-01 19:39:45 +00:00
Chris Lattner
e04deb9914 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30455 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-18 05:25:10 +00:00
Chris Lattner
5250bae5ee New testcase for instcombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28272 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-13 02:00:07 +00:00
Chris Lattner
a0771b8020 New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28125 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-05 06:38:40 +00:00
Chris Lattner
23405aa73d These casts should turn into gep instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27618 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-12 18:07:41 +00:00
Chris Lattner
6b8800d6a6 Add a new testcase for an eliminable cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25451 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 07:39:20 +00:00
Chris Lattner
0f991191eb New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19952 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 05:51:18 +00:00
Chris Lattner
2a73a0bbb1 Rename these to start with %c, as they are the only ones that are checked.
No change to the tests themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19948 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 05:17:31 +00:00
Chris Lattner
296fcbaf2c Add a bunch of tests for cases that should be eliminated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19217 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:13:43 +00:00
Chris Lattner
b5ddea5d24 More testcases for recent instcombine patches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16569 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:18:20 +00:00
Chris Lattner
6c08892814 Testcases missed by the instruction combiner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 00:57:21 +00:00
Chris Lattner
2e13cea896 Add a new test16 and fix some other tests that were not properly written
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 04:28:43 +00:00
Chris Lattner
efd74a0159 The instruction combining pass removes dead instructions, there is no need
to run the die pass after it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11942 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 05:26:06 +00:00
Chris Lattner
3c4de7fbe0 Add tests for casts that should be eliminated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 07:16:03 +00:00
Chris Lattner
0ca4418b95 Test that the instruction combiner can fold away a cast in a GEP instruction.
This occurs in 164.gzip, as a result of it declaring arrays extern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11701 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:24:09 +00:00
Chris Lattner
fc424c39de Add test for instcombine transmogrifying allocation instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9653 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-02 05:56:58 +00:00
Chris Lattner
d1c5ea1071 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8953 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 22:53:46 +00:00
Misha Brukman
e78760e179 Renamed as' => llvm-as', dis' => llvm-dis', link' => llvm-link'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8558 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-16 15:29:54 +00:00
Chris Lattner
545513918a Reorganize tests because we no longer cannonicalize X != 0 -> cast X to bool
In fact, we plan to eliminate cast to bool entirely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7805 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 05:27:57 +00:00
Chris Lattner
a73fede714 New testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7240 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22 21:44:06 +00:00
Chris Lattner
060c1f816c Remove usage of grep-not script
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6966 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 23:32:04 +00:00
Chris Lattner
c6cab24151 Convert scripts from using explicit control flow to use the new grep-not script
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6955 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 22:44:42 +00:00
Chris Lattner
8c1ab94bae Fix comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6872 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 21:52:59 +00:00
Chris Lattner
d9fa6a331e Yet another testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6871 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 21:49:25 +00:00
Chris Lattner
8186a94e08 Test cases for when casts to bool can be eliminated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6870 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 21:48:26 +00:00
Chris Lattner
a30b70f381 Add some more testcases for things to get optimized away
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3896 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-23 23:39:17 +00:00
Chris Lattner
8decbcbbfe Add a bunch of testcases for cast-of-casts that should be removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3345 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 16:13:29 +00:00
Chris Lattner
8360d0922a Fix testcase to actually test what we think we are
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3338 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 23:01:19 +00:00
Chris Lattner
4a6e4b30b4 These tests should not run -dce pass to cleanup instcombine.
If instcombine is making dead instructions, ALL that should be used is -die


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3221 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-02 19:27:58 +00:00
Chris Lattner
c7f9637a9d Add another testcase that isn't failing because of another bug in instcombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3220 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-02 18:48:09 +00:00
Chris Lattner
fa49f810c2 Intitial checkin of cast tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2427 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:01:39 +00:00