1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

1457 Commits

Author SHA1 Message Date
Chris Lattner
39a31b56ac Now that dominator tree children are built in determinstic order, this horrible code
can go away

llvm-svn: 14254
2004-06-19 20:23:35 +00:00
Chris Lattner
ef8a52f263 This will hopefully fix a heisenbug that Vladimir Merzliakov is running
into valiantly trying to compile stuff on freebsd.

llvm-svn: 14251
2004-06-19 19:01:26 +00:00
Chris Lattner
3d68124555 Fix a nasty bug, noticed by Reid
llvm-svn: 14249
2004-06-19 18:15:50 +00:00
Chris Lattner
185f2b060b Fix one source of nondeterminism in the -licm pass: the hoist pass
was processing blocks in whatever order they happened to end up in the
dominator tree data structure.  Force an ordering.

llvm-svn: 14248
2004-06-19 08:56:43 +00:00
Chris Lattner
d2720878ec Change to use the StableBasicBlockNumbering class
llvm-svn: 14247
2004-06-19 08:42:40 +00:00
Chris Lattner
3aed3a8bf2 Do not let the numbering of PHI nodes placed in the function depend on
non-deterministic things like the ordering of blocks in the dominance
frontier of a BB.  Unfortunately, I don't know of a better way to solve
this problem than to explicitly sort the BB's in function-order before
processing them.  This is guaranteed to slow the pass down a bit, but
is absolutely necessary to get usable diffs between two different tools
executing the mem2reg or scalarrepl pass.

Before this, bazillions of spurious diff failures occurred all over the
place due to the different order of processing PHIs:

-       %tmp.111 = getelementptr %struct.Connector_struct* %upcon.0.0, uint 0, uint 0
+       %tmp.111 = getelementptr %struct.Connector_struct* %upcon.0.1, uint 0, uint 0

Now, the diffs match.

llvm-svn: 14244
2004-06-19 07:40:14 +00:00
Chris Lattner
6e7b76ce94 Do not sort by the address of LLVM ConstantInt* objects. This produces
nondeterministic results that depend on where these objects land in memory.
Instead, sort by the value of the constant, which is stable.

Before this patch, the -simplifycfg pass run from two different compilers
could cause different code to be generated, though it was semantically the
same:

@@ -12258,8 +12258,8 @@
        %s_addr.1 = phi sbyte* [ %s, %entry ], [ %inc.0, %no_exit ]             ; <sbyte*> [#uses=5]
        %tmp.1 = load sbyte* %s_addr.1          ; <sbyte> [#uses=1]
        switch sbyte %tmp.1, label %no_exit [
-                sbyte 0, label %loopexit
                 sbyte 46, label %loopexit
+                sbyte 0, label %loopexit
        ]

We need to stomp all of this stuff out.

llvm-svn: 14243
2004-06-19 07:02:14 +00:00
Chris Lattner
5b4da6dd16 Do not loop over uses as we delete them. This causes iterators to be
invalidated out from under us.  This bug goes back to revision 1.1: scary.

llvm-svn: 14242
2004-06-19 02:02:22 +00:00
Chris Lattner
91b27e01b3 Implement Transforms/InstCombine/and.ll:test17, a common case that
occurs due to unordered comparison macros in math.h

llvm-svn: 14221
2004-06-18 06:07:51 +00:00
Chris Lattner
8f9fb1d2ea Do not function resolve intrinsics. This prevents warnings and possible bad
things from happening due to

declare bool %llvm.isunordered(double, double)
declare bool %llvm.isunordered(float, float)

llvm-svn: 14219
2004-06-18 05:50:48 +00:00
Brian Gaeke
4a904bfdcc I love the smell of a freshly broken PowerPC build in the morning.
llvm-svn: 14206
2004-06-17 22:27:04 +00:00
Chris Lattner
13cea4ef6f Fix compilation problem on freebsd. Problem noted by Vladimir Merzliakov in
PR371

llvm-svn: 14203
2004-06-17 21:20:52 +00:00
Chris Lattner
0cd29ae2cd Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner
00b0a866dd Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
Delete two functions that are now methods on the Type class

llvm-svn: 14200
2004-06-17 18:16:02 +00:00
Brian Gaeke
a46100448f Fix typo in DEBUG printout.
llvm-svn: 14196
2004-06-17 07:26:52 +00:00
Brian Gaeke
cf3cb8944a Um, did someone make a typo or something?
llvm-svn: 14192
2004-06-15 23:09:50 +00:00
Chris Lattner
1adcf0441d Remove support for the isnan intrinsic
llvm-svn: 14186
2004-06-15 21:37:54 +00:00
Brian Gaeke
a4353cabab Quick hack to get this file compiling again on Mac OS X. The right thing to do
is write an autoconf macro that checks whether __isnan or isnan actually works
**using the C++ compiler after #include <cmath>**, instead of doing it the easy
way with AC_CHECK_FUNCS().

llvm-svn: 14171
2004-06-14 06:33:19 +00:00
Alkis Evlogimenos
dd550dc9cd Add constant folding capabilities to the isunordered intrinsic.
llvm-svn: 14168
2004-06-13 01:23:56 +00:00
Chris Lattner
66790212ba Constant fold the isnan intrinsic
llvm-svn: 14150
2004-06-11 06:16:23 +00:00
Chris Lattner
52654bf072 Fix a bug in my checkin from last night that caused miscompilations of
186.crafty, fhourstones and 132.ijpeg.

Bugpoint makes really nasty miscompilations embarassingly easy to find.  It
narrowed it down to the instcombiner and this testcase (from fhourstones):

bool %l7153_l4706_htstat_loopentry_2E_4_no_exit_2E_4(int* %i, [32 x int]* %works, int* %tmp.98.out) {
newFuncRoot:
        %tmp.96 = load int* %i          ; <int> [#uses=1]
        %tmp.97 = getelementptr [32 x int]* %works, long 0, int %tmp.96         ; <int*> [#uses=1]
        %tmp.98 = load int* %tmp.97             ; <int> [#uses=2]
        %tmp.99 = load int* %i          ; <int> [#uses=1]
        %tmp.100 = and int %tmp.99, 7           ; <int> [#uses=1]
        %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=2]
        %tmp.102 = cast bool %tmp.101 to int            ; <int> [#uses=0]
        br bool %tmp.101, label %codeRepl4.exitStub, label %codeRepl3.exitStub

codeRepl4.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool true

codeRepl3.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool false
}

... which only has one combination performed on it:

$ llvm-as < t.ll | opt -instcombine -debug | llvm-dis
IC: Old =       %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=1]
    New =       setne int %tmp.100, 0           ; <bool>:<badref> [#uses=0]
IC: MOD =       br bool %tmp.101, label %codeRepl3.exitStub, label %codeRepl4.exitStub
IC: MOD =       %tmp.97 = getelementptr [32 x int]* %works, uint 0, int %tmp.96         ; <int*> [#uses=1]

It doesn't get much better than this.  :)

llvm-svn: 14109
2004-06-10 02:33:20 +00:00
Chris Lattner
18cab818db More minor cleanups
llvm-svn: 14108
2004-06-10 02:12:35 +00:00
Chris Lattner
ba89f54271 Eliminate many occurrances of Instruction::
llvm-svn: 14107
2004-06-10 02:07:29 +00:00
Chris Lattner
b2434f1222 Implement InstCombine/select.ll:test15*
llvm-svn: 14095
2004-06-09 07:59:58 +00:00
Chris Lattner
90a2bbc74c Be more careful about the order we put stuff onto the worklist. This allow us to
collapse this:
bool %le(int %A, int %B) {
        %c1 = setgt int %A, %B
        %tmp = select bool %c1, int 1, int 0
        %c2 = setlt int %A, %B
        %result = select bool %c2, int -1, int %tmp
        %c3 = setle int %result, 0
        ret bool %c3
}

into:

bool %le(int %A, int %B) {
        %c3 = setle int %A, %B          ; <bool> [#uses=1]
        ret bool %c3
}

which is handy, because the Java FE makes these sequences all over the place.

This is tested as: test/Regression/Transforms/InstCombine/JavaCompare.ll

llvm-svn: 14086
2004-06-09 05:08:07 +00:00
Chris Lattner
a7b01d4467 Implement select.ll:test14*
llvm-svn: 14083
2004-06-09 04:24:29 +00:00
Brian Gaeke
68eb7345df Expand head-of-file comment.
llvm-svn: 13982
2004-06-03 05:03:02 +00:00
Brian Gaeke
56ae0e9023 Use new form of unconditional branch constructor.
llvm-svn: 13930
2004-06-01 20:06:10 +00:00
Chris Lattner
d702e10ea0 Fix one of the major things that is causing the C Backend to infinite loop
llvm-svn: 13872
2004-05-28 05:02:13 +00:00
John Criswell
e56868d266 Fix a bug in the -deadtypeelim pass. The SymbolTable re-write changed it
to eliminate the wrong type.

llvm-svn: 13855
2004-05-27 21:16:46 +00:00
Chris Lattner
97bd391386 Fix InstCombine/load.ll & PR347.
This code hadn't been updated after the "structs with more than 256 elements"
related changes to the GEP instruction.  Also it was not handling the
ConstantAggregateZero class.

Now it does!

llvm-svn: 13834
2004-05-27 17:30:27 +00:00
Chris Lattner
c65ff058f3 Implement constant folding of fmod, which is used a lot in povray
llvm-svn: 13823
2004-05-27 07:25:00 +00:00
Chris Lattner
e91dc2545c Restructure call constant folding code a bit to make it simpler
Add support for acos/asin/atan.  188.ammp contains three calls to acos with
constant arguments.  Constant folding it allows elimination of those 3 calls
and three FP divisions of the results.

llvm-svn: 13821
2004-05-27 06:26:28 +00:00
Alkis Evlogimenos
7542a978fc Do not pass a null pointer if this instruction is not prepended or
appended anywhere.

llvm-svn: 13798
2004-05-26 22:50:28 +00:00
Alkis Evlogimenos
3c45e590c5 Use one destination constructor for the unconditional branch.
llvm-svn: 13792
2004-05-26 21:38:14 +00:00
Reid Spencer
fec48b0d9d Convert to SymbolTable's new iteration interface.
llvm-svn: 13754
2004-05-25 08:53:40 +00:00
Reid Spencer
08e75b22a5 Convert to SymbolTable's new lookup and iteration interfaces.
llvm-svn: 13751
2004-05-25 08:52:20 +00:00
Reid Spencer
09c1dbce28 Remove unused header file.
llvm-svn: 13750
2004-05-25 08:51:36 +00:00
Reid Spencer
169865d831 Make this pass simply invoke SymbolTable::strip().
llvm-svn: 13749
2004-05-25 08:51:25 +00:00
Chris Lattner
66f55c8e78 Implement InstCombine:shift.ll:test16, which turns (X >> C1) & C2 != C3
into (X & (C2 << C1)) != (C3 << C1), where the shift may be either left or
right and the compare may be any one.

This triggers 1546 times in 176.gcc alone, as it is a common pattern that
occurs for bitfield accesses.

llvm-svn: 13740
2004-05-25 06:32:08 +00:00
Chris Lattner
b8fb5e789b Implement instcombine/cast.ll:test16:
Canonicalize cast X to bool into a setne instruction

llvm-svn: 13736
2004-05-25 04:29:21 +00:00
Chris Lattner
79409ebc27 Fix a bug in my previous checkin
llvm-svn: 13717
2004-05-24 06:24:46 +00:00
Chris Lattner
52e7345268 Spelling people's names right is kinda important
llvm-svn: 13702
2004-05-23 21:27:29 +00:00
Chris Lattner
fbdf40f86a Fix cases where we missed inlining some more obvious candidates because the
caller was in an SCC.

llvm-svn: 13693
2004-05-23 21:22:17 +00:00
Chris Lattner
bf8b81252f Simplify the interface and remove an unneeded #include
llvm-svn: 13692
2004-05-23 21:21:35 +00:00
Chris Lattner
fee8ce6131 Fairly substantial changes to update the alias analysis we are querying as
we make the transformation.  This allows us to use interprocedural alias
analyses successfully.

llvm-svn: 13691
2004-05-23 21:21:17 +00:00
Chris Lattner
cf81f974b8 Adjust to the changes in the AliasSetTracker interface
llvm-svn: 13690
2004-05-23 21:20:19 +00:00
Chris Lattner
33de90e8c6 Add support for replacement of formal arguments with simpler expressions.
llvm-svn: 13689
2004-05-23 21:19:55 +00:00
Chris Lattner
f113f6a630 Implement the -lowergc pass which is used by code generators (like the CBE)
that do not have builtin support for garbage collection.

llvm-svn: 13688
2004-05-23 21:19:22 +00:00
Brian Gaeke
16bd3c5d34 Add CloneTraceInto(), which is based on (and has mostly the same
effects as) CloneFunctionInto().

llvm-svn: 13601
2004-05-19 09:08:14 +00:00