1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

1252 Commits

Author SHA1 Message Date
Chris Lattner
9c5aa00411 Implement an efficient and fully general SSA update mechanism that
works on unstructured CFGs.  This implements PR217, our oldest open PR.

llvm-svn: 83705
2009-10-10 09:04:27 +00:00
Chris Lattner
317eb8ff20 random tidying
llvm-svn: 83701
2009-10-10 06:22:45 +00:00
Dale Johannesen
7691b73da0 Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially
those used in more than one file).  No functional change.

llvm-svn: 83675
2009-10-09 21:42:02 +00:00
Eric Christopher
e6bebc66a7 Add FreeInst to the "is a call" check for Insts that are calls, but
not intrinsics.

llvm-svn: 83441
2009-10-07 00:54:08 +00:00
Eric Christopher
8720c9ca69 While we still have a MallocInst treat it as a call like any other
for inlining.

When MallocInst goes away this code will be subsumed as part of
calls and work just fine...

llvm-svn: 83434
2009-10-07 00:02:18 +00:00
Duncan Sands
2400ad7236 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Dan Gohman
176e47a413 Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.

llvm-svn: 83311
2009-10-05 16:36:26 +00:00
Owen Anderson
412df08b59 Do away with the strange use of BitVectors in SSI, and just use normal sets. This makes the code much more C++/LLVM-ish.
llvm-svn: 83286
2009-10-04 18:49:55 +00:00
Owen Anderson
cadab85644 Fix a typo in the comment.
llvm-svn: 83283
2009-10-04 17:52:13 +00:00
Owen Anderson
18cecec6a0 SSI needs to require DT and DF transitively, since it uses them outside of its runOnFunction.
Similarly, it can be marked setPreservesAll, since it does no work in its runOnFunction.

llvm-svn: 83282
2009-10-04 17:47:39 +00:00
Dan Gohman
2ecc146f0c Fix this code so that it doesn't try to iterate through a std::vector
while calling changeImmediateDominator, which removes elements from the
vector. This fixes PR5097.

llvm-svn: 83166
2009-09-30 20:54:16 +00:00
Dan Gohman
9776ad2192 Remove a redundant #ifndef and add an assertion string.
llvm-svn: 82991
2009-09-28 14:38:19 +00:00
Dan Gohman
f31dae3931 Convert LoopSimplify and LoopExtractor from FunctionPass to LoopPass.
llvm-svn: 82990
2009-09-28 14:37:51 +00:00
Chris Lattner
bb29bb4e16 calls are already handled, malloc doesn't need a special case.
llvm-svn: 82931
2009-09-27 21:33:46 +00:00
Nick Lewycky
d21c325f09 Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.

llvm-svn: 82889
2009-09-27 07:38:41 +00:00
Dale Johannesen
1b76c2ca48 A minor improvment in accuracy to inline cost
computation, and some cosmetics.

llvm-svn: 82660
2009-09-23 22:05:24 +00:00
Chris Lattner
f5afe18457 tidy up
llvm-svn: 82488
2009-09-21 22:26:02 +00:00
Victor Hernandez
fe5347d782 Enhance transform passes so that they apply the same tranforms to malloc calls as to MallocInst.
Reviewed by Dan Gohman.

llvm-svn: 82300
2009-09-18 22:35:49 +00:00
Victor Hernandez
065bc44d01 Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.

Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.

Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.

Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.

Add verification for malloc calls.

Reviewed by Dan Gohman.

llvm-svn: 82257
2009-09-18 19:20:02 +00:00
Andreas Neustifter
3c9b4c4c75 Preserve ProfileInfo during CodeGenPrepare.
llvm-svn: 82034
2009-09-16 09:26:52 +00:00
Nick Lewycky
d347108b4d Correctly handle the case where a comparison is created in one BasicBlock and
used by a terminator in another.

llvm-svn: 81437
2009-09-10 07:02:09 +00:00
Evan Cheng
78182244f1 Add malloc call utility functions. Patch by Victor Hernandez.
llvm-svn: 81426
2009-09-10 04:36:43 +00:00
Dan Gohman
0357e0117e Fix SplitCriticalEdge to properly update LCSSA form when splitting a
loop exit edge -- new PHIs may be needed not only for the additional
splits that are made to preserve LoopSimplify form, but also for the
original split. Factor out the code that inserts new PHIs so that it
can be used for both. Remove LoopRotation.cpp's code for manually
updating LCSSA form, as it is now redundant. This fixes PR4934.

llvm-svn: 81363
2009-09-09 18:18:18 +00:00
Andreas Neustifter
e4a3a33579 Preserve ProfileInfo.
llvm-svn: 81360
2009-09-09 17:53:39 +00:00
Dan Gohman
cdaa08e706 Re-apply r80926, with fixes: keep the domtree informed of new blocks
that get created during loop unswitching, and fix SplitBlockPredecessors'
LCSSA updating code to create new PHIs instead of trying to just move
existing ones.

Also, optimize Loop::verifyLoop, since it gets called a lot. Use
searches on a sorted list of blocks instead of calling the "contains"
function, as is done in other places in the Loop class, since "contains"
does a linear search. Also, don't call verifyLoop from LoopSimplify or
LCSSA, as the PassManager is already calling verifyLoop as part of
LoopInfo's verifyAnalysis.

llvm-svn: 81221
2009-09-08 15:45:00 +00:00
Eric Christopher
6acdc39b86 Fix comment.
llvm-svn: 81138
2009-09-06 22:20:54 +00:00
Evan Cheng
a191202da5 Revert r80926. It causes loop unswitch assertion and slow down some JIT tests significantly.
llvm-svn: 81101
2009-09-06 02:26:10 +00:00
Dan Gohman
7296225414 Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
that these passes are properly preserved.

Fix several transformation passes that claimed to preserve LoopSimplify
form but weren't.

llvm-svn: 80926
2009-09-03 16:31:42 +00:00
Dan Gohman
66c853f17f Change PHINode::hasConstantValue to have a DominatorTree argument
instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.

llvm-svn: 80920
2009-09-03 15:34:35 +00:00
Gabor Greif
4604e0739b back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
llvm-svn: 80871
2009-09-03 02:02:59 +00:00
Gabor Greif
68c4f27e59 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
llvm-svn: 80858
2009-09-03 00:18:58 +00:00
Chris Lattner
e4173b39bd remove a bunch of explicit code previously needed to update the
callgraph.  This is now dead because RAUW does the job.

llvm-svn: 80703
2009-09-01 18:44:06 +00:00
Chris Lattner
53698d7fd7 Change CallGraphNode to maintain it's Function as an AssertingVH
for sanity.  This didn't turn up any bugs.

Change CallGraphNode to maintain its "callsite" information in the 
call edges list as a WeakVH instead of as an instruction*.  This fixes
a broad class of dangling pointer bugs, and makes CallGraph have a number
of useful invariants again.  This fixes the class of problem indicated
by PR4029 and PR3601.

llvm-svn: 80663
2009-09-01 06:31:31 +00:00
Devang Patel
fbaeda732e Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Chris Lattner
61d49fed23 unbreak the build, yay for symlinks + makefiles. :(
llvm-svn: 80205
2009-08-27 04:43:05 +00:00
Chris Lattner
becb2e9534 enhance InlineFunction to be able to optionally return
a the list of static allocas that it inlined.

llvm-svn: 80203
2009-08-27 04:20:52 +00:00
Chris Lattner
7fbde3dedf smallvectorize the list of returns built by CloneAndPruneFunctionInto.
llvm-svn: 80202
2009-08-27 04:02:30 +00:00
Chris Lattner
8b277ab324 remove CloneTrace, which appears to be dead since 2004.
llvm-svn: 80201
2009-08-27 03:56:43 +00:00
Chris Lattner
71e787d93b reduce inlining factor some stuff out to a static helper function,
and other code cleanups.  No functionality change.

llvm-svn: 80199
2009-08-27 03:51:50 +00:00
Devang Patel
10c075a316 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Dan Gohman
4d20610e6e Eliminate the unused Context argument on one of the ICmpInst and FCmpInst
constructors.

llvm-svn: 80049
2009-08-25 23:17:54 +00:00
Dan Gohman
cce6c79d6d Rename Instruction::isIdenticalTo to Instruction::isIdenticalToWhenDefined,
and introduce a new Instruction::isIdenticalTo which tests for full
identity, including the SubclassOptionalData flags. Also, fix the
Instruction::clone implementations to preserve the SubclassOptionalData
flags. Finally, teach several optimizations how to handle
SubclassOptionalData correctly, given these changes.

This fixes the counterintuitive behavior of isIdenticalTo not comparing
the full value, and clone not returning an identical clone, as well as
some subtle bugs that could be caused by these.

Thanks to Nick Lewycky for reporting this, and for an initial patch!

llvm-svn: 80038
2009-08-25 22:11:20 +00:00
Owen Anderson
2f84faae31 Comment-ify.
llvm-svn: 80009
2009-08-25 17:42:07 +00:00
Owen Anderson
fe7348b43e Switch to SmallVector.
llvm-svn: 80007
2009-08-25 17:35:37 +00:00
Owen Anderson
66ea4dea86 Pull out this predicate loop into a helper function.
llvm-svn: 80006
2009-08-25 17:26:32 +00:00
Devang Patel
7d42bfab6c Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Owen Anderson
af732792b7 Handle a corner case when extracing code regions where one of the immediate successor
of an extracted block contains a PHI using a value defined in the extracted region.

With this patch, the partial inliner now passes MultiSource/Applications.

llvm-svn: 79963
2009-08-25 00:54:39 +00:00
Owen Anderson
7113af190c When extracting SEME regions of code, the extractor needs to update the dominator tree for split return blocks.
llvm-svn: 79957
2009-08-24 23:32:14 +00:00
Daniel Dunbar
40ba5f6f58 Fix -Asserts warnings.
llvm-svn: 79849
2009-08-23 10:29:55 +00:00
Chris Lattner
1c0452caeb Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Chris Lattner
01dae858b6 eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.

llvm-svn: 79819
2009-08-23 04:37:46 +00:00
Nick Lewycky
47bc7e0bd0 Fix up PHI nodes correctly in the presence of unreachable BBs, part two. Also
delete a newed pointer, and improve readability a little bit.

llvm-svn: 79411
2009-08-19 07:16:57 +00:00
Nick Lewycky
ed3dcdbdb8 Be more careful when modifying PHI nodes. Patch by Andre Tavares.
llvm-svn: 79407
2009-08-19 06:24:33 +00:00
Dan Gohman
e78d27bcf9 Update comments to new-style syntax.
llvm-svn: 79263
2009-08-17 18:45:31 +00:00
Nick Lewycky
afaae7957e Don't crash on critical edge. Patch by Andre Tavares.
llvm-svn: 79252
2009-08-17 17:00:57 +00:00
Eli Friedman
ca19f19760 Fix for PR3016: detect the tricky case, where there are
unfoldable references to a PHI node in the block being folded, and disable
the transformation in that case.  The correct transformation of such PHI
nodes depends on whether BB dominates Succ, and dominance is expensive 
to compute here.  (Alternatively, it's possible to check whether any 
uses are live, but that's also essentially a dominance calculation. 
Another alternative is to use reg2mem, but it probably isn't a good idea to
use that in simplifycfg.)

Also, remove some incorrect code from CanPropagatePredecessorsForPHIs 
which is made unnecessary with this patch: it didn't consider the case 
where a PHI node in BB has multiple uses.

llvm-svn: 79174
2009-08-16 04:23:49 +00:00
Nick Lewycky
de61ef6c5e SSI construction should just go ahead and ignore instructions in unreachable
blocks.

llvm-svn: 79132
2009-08-15 20:12:18 +00:00
Owen Anderson
dc11fe967d Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman
9a6b2f19e5 Remove a bunch more now-unnecessary Context arguments.
llvm-svn: 78809
2009-08-12 16:23:25 +00:00
Dan Gohman
e3fa540e7a Remove unnecessary casts.
llvm-svn: 78664
2009-08-11 15:15:10 +00:00
Dan Gohman
1c41d60c4a Fix a bunch of namespace pollution.
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Owen Anderson
3d0e1b855d Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Owen Anderson
1dc40e205b Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
93ccaf5c60 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Daniel Dunbar
81f704c26a Twines: Don't allow implicit conversion from integers, this is too tricky.
llvm-svn: 77605
2009-07-30 17:37:43 +00:00
Daniel Dunbar
4d07efb3c4 Switch obvious clients to Twine instead of utostr (when they were already using
a Twine, e.g., for names).
 - I am a little ambivalent about this; we don't want the string conversion of
   utostr, but using overload '+' mixed with string and integer arguments is
   sketchy. On the other hand, this particular usage is something of an idiom.

llvm-svn: 77579
2009-07-30 04:20:37 +00:00
Owen Anderson
881d928f9b Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Benjamin Kramer
da986c3fc9 Remove now unused Context variables.
llvm-svn: 77495
2009-07-29 19:14:17 +00:00
Owen Anderson
0ce2151b36 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Devang Patel
cb23671431 Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.

llvm-svn: 77370
2009-07-28 21:49:47 +00:00
Owen Anderson
390e9778d4 Return ConstantVector to 2.5 API.
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson
aa8c94b051 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Mike Stump
8902846c69 Fix a small little typo.
llvm-svn: 77289
2009-07-28 01:35:34 +00:00
Mike Stump
6cc3ea28df Fix a release-asserts warning. Debug functions should be marked used,
if there are no other uses.  If people don't need this routine
anymore, if should be deleted.

llvm-svn: 77274
2009-07-27 23:33:34 +00:00
Mike Stump
be4029ff76 Avoid build warnings.
llvm-svn: 77271
2009-07-27 23:14:11 +00:00
Owen Anderson
d729f993b8 Move ConstantStruct back to 2.5 API.
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Devang Patel
dfa0528df7 Do not seed mstadata into the value map.
llvm-svn: 77208
2009-07-27 17:17:04 +00:00
Daniel Dunbar
4a36d5dcfd Remove Value::getName{Start,End}, the last of the old Name APIs.
llvm-svn: 77152
2009-07-26 09:48:23 +00:00
Daniel Dunbar
038a7f0d35 Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.

llvm-svn: 77098
2009-07-25 23:55:21 +00:00
Dan Gohman
fdf1a11a27 Convert a few more uses of llvm/Support/Streams.h to raw_ostream.
llvm-svn: 77033
2009-07-25 01:13:51 +00:00
Dan Gohman
acc5d6eaae Make AliasAnalysis and related classes use
getAnalysisIfAvailable<TargetData>().

llvm-svn: 77028
2009-07-25 00:48:42 +00:00
Daniel Dunbar
8496064116 More migration to raw_ostream, the water has dried up around the iostream hole.
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
   "magic" DOUT behavior which avoided calling printing functions when the
   statement was disabled. In addition to being unnecessary magic, it had the
   downside of leaving code in -Asserts builds, and of hiding potentially
   unnecessary computations.

llvm-svn: 77019
2009-07-25 00:23:56 +00:00
Owen Anderson
cc33e89571 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Dan Gohman
b895f668cc AliasAnalysis wants sizes in address-units, not bits.
llvm-svn: 77009
2009-07-24 23:01:30 +00:00
Daniel Dunbar
339c88008f Move more to raw_ostream, provide support for writing MachineBasicBlock,
LiveInterval, etc to raw_ostream.

llvm-svn: 76965
2009-07-24 10:36:58 +00:00
Daniel Dunbar
e3fea713f1 Switch to getNameStr().
llvm-svn: 76962
2009-07-24 08:24:36 +00:00
Eli Friedman
ca2e01b721 Don't give a massive inlining cost bonus to available_externally
functions with a single use; eliminating the single use may eliminate 
the function from the current module, but usually doesn't eliminate 
it from the final program.

llvm-svn: 76730
2009-07-22 08:12:59 +00:00
Owen Anderson
cc287b28c9 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Ted Kremenek
60d0ab4838 Update CMake files.
llvm-svn: 76595
2009-07-21 17:43:20 +00:00
Chris Lattner
ffd009f039 add a fixme
llvm-svn: 76324
2009-07-18 18:49:04 +00:00
Eli Friedman
b5b88b60b3 Fix the inline cost calculation to take into account instructions
which cannot be folded even if they have constant operands. Significantly
helps if_spppsubr.c attached to PR4573.

llvm-svn: 76285
2009-07-18 05:26:06 +00:00
Daniel Dunbar
8ce5e03431 Initialize another Context, in the hopes of unbreaking CBE.
llvm-svn: 76184
2009-07-17 16:20:23 +00:00
Eli Friedman
b56b3ca224 Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what 
the callers actually care about in that it rejects more things callers 
don't want.  It also adds more precise handling for integer 
division, and unifies code for analyzing the legality of a speculative 
load.

llvm-svn: 76150
2009-07-17 04:28:42 +00:00
Owen Anderson
21d2d69727 Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here

llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Owen Anderson
4483fbda5e Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Dan Gohman
81885d5b80 Make makeLoopInvariant report whether it made any changes or not,
and use this to simplify more code.

llvm-svn: 75722
2009-07-15 01:25:43 +00:00
Owen Anderson
8c85061ee6 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +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
Dan Gohman
493855541b Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariant
function.

llvm-svn: 75584
2009-07-14 01:37:59 +00:00
Owen Anderson
1e5155161a Move more functionality over to LLVMContext.
llvm-svn: 75497
2009-07-13 20:58:05 +00:00
Owen Anderson
393d8b0a0c Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Chris Lattner
edf6f031d8 silence a vc++ warning.
llvm-svn: 75393
2009-07-11 22:31:59 +00:00
Torok Edwin
ae8a3ff177 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Torok Edwin
9b41a5faf2 Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
and abort()/exit() -> llvm_report_error().

llvm-svn: 75363
2009-07-11 13:10:19 +00:00
Owen Anderson
7076f1ffb7 Push LLVMContext through the PatternMatch API.
llvm-svn: 75255
2009-07-10 17:35:01 +00:00
Owen Anderson
49226b1075 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Nick Lewycky
c707d9c60d There's no need to consider PHI nodes in the same block as the instruction
we're inserting sigma/phi functions for. Patch by Andre Tavares.

llvm-svn: 75138
2009-07-09 15:59:27 +00:00
Nick Lewycky
02ee56adb2 Add some statistics to SSI so we can see what it's up to.
Add an -ssi-everything pass which calls createSSI on everything in the function.

llvm-svn: 75135
2009-07-09 15:33:14 +00:00
Owen Anderson
332aae685b Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Owen Anderson
7a1f69e433 Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson
121f736d9c "LLVMContext* " --> "LLVMContext *"
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
ad3229d281 Thread LLVMContext through the constant folding APIs, which touches a lot of files.
llvm-svn: 74844
2009-07-06 18:42:36 +00:00
Owen Anderson
977aa11bc6 More LLVMContext-ification.
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Mike Stump
78ecb66f56 Fix build.
llvm-svn: 74782
2009-07-03 22:11:58 +00:00
Nick Lewycky
b01a2dc7ba Add Static Single Information construction pass written by André Tavares!
Use it by requiring it through the pass manager, then calling its createSSI
method on the variables that you want in SSI form.

llvm-svn: 74780
2009-07-03 19:28:36 +00:00
Owen Anderson
81b8dabb53 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner
4bdaace06e improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!

llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Dan Gohman
49c397bf4b Minor code simplification.
llvm-svn: 74491
2009-06-30 01:24:43 +00:00
Dan Gohman
fcd5eedead Remove the block from the LoopInfo, rather than just the Loop.
LoopInfo will handle removing it from the Loop, as well as updating
its own tables.

llvm-svn: 74398
2009-06-27 22:32:36 +00:00
Dan Gohman
8d2a45fadb Teach LoopSimplify how to merge multiple loop exits into a single exit,
when one of them can be converted to a trivial icmp and conditional
branch.

This addresses what is essentially a phase ordering problem.
SimplifyCFG knows how to do this transformation, but it doesn't do so
if the primary block has any instructions in it other than an icmp and
a branch. In the given testcase, the block contains other instructions,
however they are loop-invariant and can be hoisted. SimplifyCFG doesn't
have LoopInfo though, so it can't hoist them. And, it's important that
the blocks be merged before LoopRotation, as it doesn't support
multiple-exit loops.

llvm-svn: 74396
2009-06-27 21:30:38 +00:00
Devang Patel
4f5d296df0 Remove unused routines.
llvm-svn: 74351
2009-06-26 22:53:22 +00:00
Douglas Gregor
6d9b0e8c19 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
llvm-svn: 74285
2009-06-26 15:37:00 +00:00
Dan Gohman
ba8760719f Fix LCSSA to avoid emitting a PHI node for the unwind destination of
an invoke instruction, since the value isn't really live across that
edge.

llvm-svn: 74242
2009-06-26 00:31:13 +00:00
Chris Lattner
574c5de9f8 Generalize instcombine's isSafeToLoadUnconditionally() function
to ignore readonly calls, and factor it out of instcombine so
that it can be used by other passes.  Patch by Frits van Bommel!

llvm-svn: 73506
2009-06-16 17:23:12 +00:00
Dale Johannesen
2d0be306fb Fix the crash in this test. This is basically the same
problem addressed in 31284, but the patch there only
addressed the case where an invoke is the first thing in
a block.

llvm-svn: 73416
2009-06-15 20:59:27 +00:00
Dan Gohman
111f127d23 Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Dan Gohman
5f6f8101d5 Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Nick Lewycky
a9de2f1c81 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Torok Edwin
beb86bd0b4 available_externall linkage is not local, this was confusing the codegenerator,
and it wasn't generating calls through @PLT for these functions.
hasLocalLinkage() is now false for available_externally,
I attempted to fix the inliner and dce to handle available_externally properly.
It passed make check.

llvm-svn: 72328
2009-05-23 14:06:57 +00:00
Dan Gohman
922033d119 Teach SCEVExpander to expand arithmetic involving pointers into GEP
instructions. It attempts to create high-level multi-operand GEPs,
though in cases where this isn't possible it falls back to casting
the pointer to i8* and emitting a GEP with that. Using GEP instructions
instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that
don't use ScalarEvolution, such as BasicAliasAnalysis.

Also, make the AddrModeMatcher more aggressive in handling GEPs.
Previously it assumed that operand 0 of a GEP would require a register
in almost all cases. It now does extra checking and can do more
matching if operand 0 of the GEP is foldable. This fixes a problem
that was exposed by SCEVExpander using GEPs.

llvm-svn: 72093
2009-05-19 02:15:55 +00:00
Dale Johannesen
8bd6fc810a Reuse existing getUnderlyingObject instead of
adding another copy.

llvm-svn: 71783
2009-05-14 18:41:18 +00:00
Dale Johannesen
d0e1e29fb7 Handle some additonal cases of external weak globals.
llvm-svn: 71717
2009-05-13 20:55:30 +00:00
Dale Johannesen
a3b4fb31a1 Don't generate a select whose operand is load of a weak
external.  These may have address 0 and are not safe
to execute unconditionally.

llvm-svn: 71688
2009-05-13 18:25:07 +00:00
Duncan Sands
f7af13b2d4 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.

llvm-svn: 71349
2009-05-09 07:06:46 +00:00
Eli Friedman
a280375b23 PR4123: don't crash when inlining a call which uses its own result.
llvm-svn: 71199
2009-05-08 00:22:04 +00:00
Dan Gohman
33e1f0fcb5 Simplify code by using SmallVector's pop_back_val() instead of
separate back() and pop_back() calls.

llvm-svn: 71089
2009-05-06 17:22:41 +00:00
Duncan Sands
880eaf5278 Allow readonly functions to unwind exceptions. Teach
the optimizers about this.  For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.

llvm-svn: 71071
2009-05-06 06:49:50 +00:00
Dan Gohman
00c4ac3add Re-apply 70645, converting ScalarEvolution to use
CallbackVH, with fixes. allUsesReplacedWith need to
walk the def-use chains and invalidate all users of a
value that is replaced. SCEVs of users need to be
recalcualted even if the new value is equivalent. Also,
make forgetLoopPHIs walk def-use chains, since any
SCEV that depends on a PHI should be recalculated when
more information about that PHI becomes available.

llvm-svn: 70927
2009-05-04 22:30:44 +00:00
Chris Lattner
b07d558841 Factor loop backedge finding out of CodeGenPrepare into a new
FindFunctionBackedges function.

llvm-svn: 70819
2009-05-04 02:25:58 +00:00
Dan Gohman
8e4b9e586b Revert r70645 for now; it's causing a variety of regressions.
llvm-svn: 70661
2009-05-03 05:46:20 +00:00
Dan Gohman
7d98736ca6 Convert ScalarEvolution to use CallbackVH for its internal map. This
makes ScalarEvolution::deleteValueFromRecords, and it's code that
subtly needed to be called before ReplaceAllUsesWith, unnecessary.

It also makes ValueDeletionListener unnecessary.

llvm-svn: 70645
2009-05-02 21:19:20 +00:00
Dan Gohman
a79cce4aef Previously, RecursivelyDeleteDeadInstructions provided an option
of returning a list of pointers to Values that are deleted. This was
unsafe, because the pointers in the list are, by nature of what
RecursivelyDeleteDeadInstructions does, always dangling. Replace this
with a simple callback mechanism. This may eventually be removed if
all clients can reasonably be expected to use CallbackVH.

Use this to factor out the dead-phi-cycle-elimination code from LSR
utility function, and generalize it to use the
RecursivelyDeleteTriviallyDeadInstructions utility function.

This makes LSR more aggressive about eliminating dead PHI cycles;
adjust tests to either be less trivial or to simply expect fewer
instructions.

llvm-svn: 70636
2009-05-02 18:29:22 +00:00
Owen Anderson
309568c469 Real fix for PR3549, by using caching for predecessor counts in addition to the predecessors themselves. This halves the time
to optimize the testcase, beyond what my previous patch did.

llvm-svn: 69792
2009-04-22 08:50:12 +00:00
Owen Anderson
b36babc111 Use PredIteratorCache in LCSSA, which gives a 37% overall speedup on the testcase from PR3549. More improvements to come.
llvm-svn: 69788
2009-04-22 08:09:13 +00:00
Chris Lattner
60c88b66da use predicate instead of hand-rolled loop
llvm-svn: 69752
2009-04-21 23:37:18 +00:00
Jim Grosbach
da399d8358 remove trailing whitespace
llvm-svn: 69402
2009-04-17 23:30:55 +00:00
Eli Friedman
13e59b3c41 Fix for PR3944: make mem2reg O(N) instead of O(N^2) in the number of
incoming edges for a block with many predecessors.

llvm-svn: 69312
2009-04-16 21:40:28 +00:00
Devang Patel
7323064183 While inlining, clone llvm.dbg.func.start intrinsic and adjust
llvm.dbg.region.end instrinsic. This nested llvm.dbg.func.start/llvm.dbg.region.end pair now enables DW_TAG_inlined_subroutine support in code generator.

llvm-svn: 69118
2009-04-15 00:17:06 +00:00
Devang Patel
7fa69ef109 Update call graph after inlining invoke.
Patch by Jay Foad.

llvm-svn: 68120
2009-03-31 17:36:12 +00:00