1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

170 Commits

Author SHA1 Message Date
Owen Anderson
cc287b28c9 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
00b05492f1 Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.

Remove a few optimizations that depended on this flag.

llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Dan Gohman
754bb5e64a Fix this accidentally inverted condition.
llvm-svn: 76278
2009-07-18 00:58:38 +00:00
Dan Gohman
e45061eefe Convert more code to use Operator instead of explicitly handling both
ConstantExpr and Instruction. This involves duplicating some code
between GetElementPtrInst and GEPOperator, but it's not a lot.

llvm-svn: 76265
2009-07-17 23:55:56 +00:00
Dan Gohman
93cbd452ed Make BasicAliasAnalysis and Value::getUnderlyingObject use
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.

llvm-svn: 76252
2009-07-17 22:25:10 +00:00
Dan Gohman
67f2b7d376 Add a SubclassOptionalData field to Value. See the doxygen comment for
details.

llvm-svn: 76189
2009-07-17 17:16:59 +00:00
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Jeffrey Yasskin
3d0b6f8aa7 Fix the AssertingVH unittests.
llvm-svn: 75060
2009-07-08 22:09:00 +00:00
Torok Edwin
358888da3a Implement changes from Chris's feedback.
Finish converting lib/Target.

llvm-svn: 75043
2009-07-08 20:53:28 +00:00
Torok Edwin
ad3be984b7 Start converting to new error handling API.
cerr+abort -> llvm_report_error
assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included)

llvm-svn: 75018
2009-07-08 18:01:40 +00:00
Owen Anderson
75f0f1cc6c Have scoped mutexes take referenes instead of pointers.
llvm-svn: 74931
2009-07-07 18:33:04 +00:00
Owen Anderson
844cf0aa3f Simplify by using no-op-when-not-multithreaded locks.
llvm-svn: 73719
2009-06-18 20:36:21 +00:00
Owen Anderson
a59f91c08d Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
d7312aff32 Protect the ValueHandle table.
llvm-svn: 73620
2009-06-17 17:36:57 +00:00
Dan Gohman
f8f167320d Use true instead of 1 for a boolean value. And fix a copy+pasto
in a comment.

llvm-svn: 70882
2009-05-04 17:25:21 +00:00
Dan Gohman
dc96a23780 Apply Jeffrey Yasskin's CallbackVH patch, with minor tweaks from me
to make the copy constructor and destructor protected, and corresponding
adjustments to the unittests.

llvm-svn: 70644
2009-05-02 21:10:48 +00:00
Nick Lewycky
e9597399f0 Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine.

llvm-svn: 69151
2009-04-15 06:23:41 +00:00
Chris Lattner
939313c44a Add two new classes: WeakVH and AssertingVH. These are both "ValueHandles",
which are effectively smart pointers to Value*'s.  They are both very light
weight and simple, and react to values being destroyed or being RAUW'd.

WeakVN does a best effort to follow a value around, including through RAUW 
operations and will get nulled out of the value is destroyed.  This is useful
for the eventual "metadata that references a value" work, because it is a
reference to a value that does not show up on its use_* list.

AssertingVH is a pointer that compiles down to a dumb raw pointer when 
assertions are disabled.  When enabled, it emits an assertion if the 
pointed-to value is destroyed while it is still being referenced.  This
is very useful for Maps and other things, and should have caught the recent
bugs in CallGraph and Reassociate, for example.

llvm-svn: 68149
2009-03-31 22:11:05 +00:00
Gabor Greif
037f4dc1a4 Rearrange operands of the BranchInst, to be able to
access each with a fixed negative index from op_end().

This has two important implications:
- getUser() will work faster, because there are less iterations
  for the waymarking algorithm to perform. This is important
  when running various analyses that want to determine callers
  of basic blocks.
- getSuccessor() now runs faster, because the indirection via OperandList
  is not necessary: Uses corresponding to the successors are at fixed
  offset to "this".

The price we pay is the slightly more complicated logic in the operator
User::delete, as it has to pick up the information whether it has to free
the memory of an original unconditional BranchInst or a BranchInst that
was originally conditional, but has been shortened to unconditional.
I was not able to come up with a nicer solution to this problem. (And
rest assured, I tried *a lot*).

Similar reorderings will follow for InvokeInst and CallInst. After that
some optimizations to pred_iterator and CallSite will fall out naturally.

llvm-svn: 66815
2009-03-12 18:34:49 +00:00
Duncan Sands
f7fb4d197c Make stripPointerCasts and getUnderlyingObject
non-recursive.

llvm-svn: 61479
2008-12-29 21:06:19 +00:00
Chris Lattner
0be74c4208 These messages should always be emitted when NDEBUG is unset, not when
NDEBUG is unset and -debug is passed.

llvm-svn: 60986
2008-12-13 18:37:58 +00:00
Chris Lattner
2f766df51f Comment typeo fix, thanks Duncan!
llvm-svn: 60429
2008-12-02 18:33:11 +00:00
Chris Lattner
90d1a3c343 add a little helper function that does PHI translation.
llvm-svn: 60405
2008-12-02 07:16:45 +00:00
Duncan Sands
88d8323743 Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject.  The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.

llvm-svn: 56922
2008-10-01 15:25:41 +00:00
Bill Wendling
8b4fecfb09 Make pointer parameter const for isUsedInBasicBlock.
llvm-svn: 56625
2008-09-25 22:42:01 +00:00
Gabor Greif
984ba5a313 backing out my last commit, it was not intended to go on the trunk
llvm-svn: 56349
2008-09-19 15:13:20 +00:00
Gabor Greif
67fa076542 first shot at removing Use::Val
untested, Use::swap() is definitely not done yet

llvm-svn: 56348
2008-09-19 15:03:57 +00:00
Evan Cheng
e91c8c4508 Rename instance variables, parameter argument names to eliminate a bunch of compilation warnings with -Wshadow.
llvm-svn: 53970
2008-07-24 00:08:56 +00:00
Chris Lattner
96b3955e9b fix some warnings when assertions are disabled.
llvm-svn: 52587
2008-06-21 19:47:03 +00:00
Evan Cheng
5897328890 Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
llvm-svn: 52244
2008-06-12 21:15:59 +00:00
Nate Begeman
253fc69ff3 Move the operator new and operator delete out of line. This fixes an issue with
operator new() referring to the static initTags function, which has to be in the 
same linkage unit as any file including User.h.

llvm-svn: 51136
2008-05-15 01:23:11 +00:00
Anton Korobeynikov
ddb93e7a02 Turn StripPointerCast() into a method
llvm-svn: 50836
2008-05-07 22:54:15 +00:00
Anton Korobeynikov
90ee6d6616 Make StripPointerCast a common function (should we mak it method of Value instead?)
llvm-svn: 50775
2008-05-06 22:52:30 +00:00
Chris Lattner
757d7d318a fix a bug in my previous patch, a classic =/== bug.
llvm-svn: 50483
2008-04-30 15:27:09 +00:00
Chris Lattner
710d05695f add a method for comparing to see if a value has a specified name.
llvm-svn: 50465
2008-04-30 03:55:40 +00:00
Nick Lewycky
c0b361a17c Print the name, not a pointer.
llvm-svn: 47796
2008-03-01 17:20:55 +00:00
Devang Patel
e60ebc7744 Let invoke return aggregate value.
llvm-svn: 47425
2008-02-21 02:14:01 +00:00
Devang Patel
702c4a60a6 Let function call return aggregate.
Now, we have very first multiple return value testcase!

llvm-svn: 47424
2008-02-21 01:54:02 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Gordon Henriksen
8430f1ff9a Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

llvm-svn: 44760
2007-12-10 02:14:30 +00:00
Chris Lattner
11bc69b3c8 fix some warnings.
llvm-svn: 44756
2007-12-10 01:51:22 +00:00
Chris Lattner
3d939a50a5 Fix a big problem in the recent dtor refactoring work, now it passes 2007-11-19-InlineAsm.ll
llvm-svn: 44755
2007-12-10 01:48:29 +00:00
Gordon Henriksen
a18a78e6e5 Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
llvm-svn: 44747
2007-12-09 22:46:10 +00:00
Dan Gohman
30ba45b569 Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().

llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Chris Lattner
14442c9a4d Make Value::getNameLen not crash on an empty name, fixing PR1712.
llvm-svn: 42444
2007-09-28 20:09:40 +00:00
Chris Lattner
07ac73b539 simplify code, improve a comment.
llvm-svn: 41205
2007-08-21 00:21:07 +00:00
Chris Lattner
de900e3b6c add Value::getNameStart/getNameLen() accessors.
llvm-svn: 40989
2007-08-10 15:34:35 +00:00
Chris Lattner
6dbed4d4ca Fix a nasty memory leak, caused by my revamp of the value symbol table.
llvm-svn: 35195
2007-03-20 00:18:10 +00:00
Jeff Cohen
98c99a3a02 Unbreak VC++ build.
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Chris Lattner
9084bb5471 rewrite Value::takeName to take advantage of the new symtab stuff. This
causes it to require no allocations and no symtab lookups in the common
case.  This speeds up instcombine 9.2% on 447.dealII.

llvm-svn: 34324
2007-02-15 20:01:43 +00:00
Chris Lattner
fbd6928545 Add a new Value::getNameStr method, which is preferred over getName.
llvm-svn: 34310
2007-02-15 18:53:54 +00:00
Chris Lattner
cc543b031e add a setName variant that takes a null-terminated string. This can be
used to avoid std::string allocations in common cases.

llvm-svn: 34232
2007-02-13 07:53:34 +00:00
Chris Lattner
a48bf1bdbf Add new setName accessor which doesn't require creating a string.
llvm-svn: 34197
2007-02-12 18:52:59 +00:00
Chris Lattner
5a58a65c10 Switch ValueSymbolTable to use StringMap<Value*> instead of std::map<std::string, Value*>
as its main datastructure.  There are many improvements yet to be made, but
this speeds up opt --std-compile-opts on 447.dealII by 7.3%.

llvm-svn: 34193
2007-02-12 05:18:08 +00:00
Chris Lattner
676ffe699d fix uninitialized variable
llvm-svn: 34182
2007-02-11 19:12:18 +00:00
Chris Lattner
50ea7bc913 add an optimization for the case where the src has no name
llvm-svn: 34174
2007-02-11 01:04:09 +00:00
Chris Lattner
e8dd3c90f1 add a helper method: Value::takeName
llvm-svn: 34171
2007-02-11 00:37:27 +00:00
Chris Lattner
a1455127ae eliminate ValueSymbolTable::rename, it has no advantage over using remove+insert.
Make insert/remove assert if used incorrectly instead of returning a bool.

llvm-svn: 33988
2007-02-07 06:13:49 +00:00
Reid Spencer
6af21b3029 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer
cdaf88ff9d For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Bill Wendling
1838be30c7 Removed iostream #includes. Replaced std::cerr with DOUT.
llvm-svn: 31814
2006-11-17 08:03:48 +00:00
Chris Lattner
e2a54ddd33 Change the signature of replaceUsesOfWithOnConstant. The bool was always
true dynamically.  Finally, pass the Use* that replaceAllUsesWith has into
the method for future use.

llvm-svn: 23626
2005-10-04 18:13:04 +00:00
Misha Brukman
53e199440e Remove trailing whitespace
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner
ffa96dc848 This fixes PR531, a crash when running the CBE on a bytecode file.
The problem is that Function::renameLocalSymbols is iterating through
the symbol table planes, occasionally calling setName to rename a value
(which used to do a symbol table remove/insert pair).

The problem is that if there is only a single value in a particular type
plane that the remove will nuke the symbol table plane, and the insert
will create and insert a new one.  This hoses Function::renameLocalSymbols
because it has an iterator to the old plane, under the (very reasonable)
assumption that simply renaming a value won't cause the type plane to
disappear.

This patch fixes the bug by making the rename operation a single atomic
operation, which has a side effect of making the whole thing faster too. :)

llvm-svn: 20469
2005-03-06 02:14:28 +00:00
Chris Lattner
b177010d51 remove all of the various setName implementations, consolidating them into
Value::setName, which is no longer virtual.

llvm-svn: 20464
2005-03-05 19:51:50 +00:00
Chris Lattner
a91c25c69b new method
llvm-svn: 20288
2005-02-23 16:51:11 +00:00
Chris Lattner
d73939a8ed Initialize new field.
llvm-svn: 20044
2005-02-05 01:37:58 +00:00
Chris Lattner
839b0ef616 Updates for new use list changes.
llvm-svn: 19961
2005-02-01 01:24:21 +00:00
Misha Brukman
209f5ea32b Add a space between the type and name of value when printing error message
llvm-svn: 17022
2004-10-15 23:08:50 +00:00
Reid Spencer
c4abcbefb1 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Alkis Evlogimenos
d4ef731684 Use name.empty() instead of testing against equality with the empty
string.

llvm-svn: 15191
2004-07-25 06:16:52 +00:00
Alkis Evlogimenos
d5f5b018e9 Disallow creation of named values of type void.
llvm-svn: 15190
2004-07-25 06:07:15 +00:00
Reid Spencer
27b74ad249 bug 122:
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14933
2004-07-18 00:01:50 +00:00
Chris Lattner
6c5e26142c Fix regressions in these testcases:
Regression.Assembler.2002-01-24-BadSymbolTableAssert
 Regression.Assembler.2002-01-24-ValueRefineAbsType

Found through the nightly tester :)

llvm-svn: 14671
2004-07-07 18:07:46 +00:00
Chris Lattner
5c1abfecfe Find bugs sooner rather than later. In this case, don't allow the creation
of instructions that don't have a first-class or void type.

llvm-svn: 14646
2004-07-06 17:44:17 +00:00
Reid Spencer
d02e1dc90d - #include <iostream> since its not in Value.h any more.
llvm-svn: 14617
2004-07-04 11:55:37 +00:00
Chris Lattner
56d4c0c8b2 User ctor is now inline
llvm-svn: 14431
2004-06-27 18:01:38 +00:00
Chris Lattner
476eace8f4 Instancevar was renamed
llvm-svn: 14428
2004-06-26 20:33:39 +00:00
Chris Lattner
a1da49a55c Finegrainify namespacification
llvm-svn: 10131
2003-11-21 20:23:48 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
530eb1ffb5 If we're not checking, don't check!
llvm-svn: 9732
2003-11-05 19:09:40 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
09ef1749f7 Completely rewrite support for the Value::use_* list. Now, all operations on
this list (except use_size()) are constant time.  Before the killUse method
(used whenever something stopped using a value) was linear time, and thus
very very slow for large programs.

This speeds GCCAS up _substantially_ on large programs: almost 2x for 176.gcc:

176.gcc:     77.07s -> 37.38s
177.mesa:     7.59s ->  5.57s
252.eon:     21.02s -> 19.52s (*)
253.perlbmk: 11.40s -> 13.05s
254.gap:      7.25s -> 7.42s

252.eon would speed up a whole lot more, but optimization time is being
dominated by the inlining pass, which needs to be fixed.

llvm-svn: 9160
2003-10-16 16:53:07 +00:00
Chris Lattner
6f939cc824 Users can never be null
llvm-svn: 8895
2003-10-06 17:33:39 +00:00
Chris Lattner
83856d0df1 There is no reason for Value to be an AbstractTypeUser. This just makes things
significantly more complete.  Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.

llvm-svn: 8828
2003-10-02 19:44:40 +00:00
Chris Lattner
b60bfd904c Fix bug: Linker/2003-08-28-TypeResolvesGlobal3.ll
Use new replaceAllUsesWith stuff in a way that works even though types have not yet been propagated

llvm-svn: 8210
2003-08-29 05:37:22 +00:00
Chris Lattner
a2a7b891e5 Refactor code to make it useful outside of Constants.cpp
llvm-svn: 8205
2003-08-29 05:09:37 +00:00
Chris Lattner
ade75cea50 Make assertion more descriptive
llvm-svn: 6889
2003-06-24 22:20:19 +00:00
Chris Lattner
c4affd76ec This speeds up processing LLVM a _lot_, 17% in the case of loading and destroying "vortex"
llvm-svn: 5553
2003-02-13 19:46:22 +00:00
Chris Lattner
266bacb650 - Make Value::replaceAllUsesWith work with constants correctly. This fixes
bug FuncResolve/2002-08-19-ResolveGlobalVars.ll and gzip looks better.

llvm-svn: 4103
2002-10-09 23:12:59 +00:00
Chris Lattner
a8dd29787b - Remove Value::use_remove
llvm-svn: 4090
2002-10-09 00:25:05 +00:00
Chris Lattner
88de60dd26 Fix NASTY N^2 behavior that was causing the gzip benchmark to take forever to
assemble.  Now we scan the use-list from the back when removing users instead
of from the front.

llvm-svn: 4086
2002-10-08 23:46:55 +00:00
Chris Lattner
3d630b954f Enable "garbage detection" of LLVM objects. Now users should be obnoxious
warnings.  If they accidentally leak LLVM Value's.

llvm-svn: 3620
2002-09-08 18:59:35 +00:00
Chris Lattner
5f11498859 *** empty log message ***
llvm-svn: 3065
2002-07-24 22:08:53 +00:00
Chris Lattner
a590093513 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
62f8f85b50 changes for 64bit gcc
llvm-svn: 2801
2002-06-25 22:07:38 +00:00
Chris Lattner
38e114c016 The contents of the SymTabValue class have been incorporated into the
Module and Function classes directly.

llvm-svn: 2356
2002-04-28 04:52:28 +00:00
Chris Lattner
8584e40a86 Fix pure virtual function called exception!
llvm-svn: 2229
2002-04-12 18:19:45 +00:00
Chris Lattner
7083f2bcf0 Move include/llvm/ValueHolderImpl.h to lib/VMCore/ValueHolderImpl.h
llvm-svn: 2156
2002-04-08 00:15:29 +00:00