Eli Friedman
b8f6a4fc8e
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
20b34ac794
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
4fdeba9706
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
c43e47938a
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
b6b2530000
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Torok Edwin
fbcc663cbf
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
4d6149f356
Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariant
...
function.
llvm-svn: 75584
2009-07-14 01:37:59 +00:00
Owen Anderson
542619e6d5
Move more functionality over to LLVMContext.
...
llvm-svn: 75497
2009-07-13 20:58:05 +00:00
Owen Anderson
53a52215b5
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
2f67295aac
silence a vc++ warning.
...
llvm-svn: 75393
2009-07-11 22:31:59 +00:00
Torok Edwin
56d0659726
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
ccb29cd290
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
16e7674f4b
Push LLVMContext through the PatternMatch API.
...
llvm-svn: 75255
2009-07-10 17:35:01 +00:00
Owen Anderson
1e5f00e7a7
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
ab81d2f5e9
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
eb373ad2af
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
b17f32945f
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
5948fdf68b
Push LLVMContext through GlobalVariables and IRBuilder.
...
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson
38264b1554
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
39f00cc1d4
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
e70b637033
More LLVMContext-ification.
...
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Mike Stump
bbd8707f6e
Fix build.
...
llvm-svn: 74782
2009-07-03 22:11:58 +00:00
Nick Lewycky
cb23509546
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
6773d388aa
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
96122debc1
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
4dfc680059
Minor code simplification.
...
llvm-svn: 74491
2009-06-30 01:24:43 +00:00
Dan Gohman
ffdcba3dbd
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
c8ca49659a
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
0f2eb5b9f7
Remove unused routines.
...
llvm-svn: 74351
2009-06-26 22:53:22 +00:00
Douglas Gregor
6d94e6a5f3
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
7eaf50ecac
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
945d08d76f
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
9df78ee1ae
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
4fe64deb7b
Fix old-style type names in comments.
...
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Dan Gohman
a5b9645c4b
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
adbc284666
Give embedded metadata its own type instead of relying on EmptyStructTy.
...
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Torok Edwin
7996339dd8
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
2649491f9c
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
1ac1969e09
Reuse existing getUnderlyingObject instead of
...
adding another copy.
llvm-svn: 71783
2009-05-14 18:41:18 +00:00
Dale Johannesen
3181652363
Handle some additonal cases of external weak globals.
...
llvm-svn: 71717
2009-05-13 20:55:30 +00:00
Dale Johannesen
69921959b4
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
af9eaa830a
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
36b9026fa7
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
9a6fef0a52
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
1efabaaa2a
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
48f8222293
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
351134ba93
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
5036695c32
Revert r70645 for now; it's causing a variety of regressions.
...
llvm-svn: 70661
2009-05-03 05:46:20 +00:00
Dan Gohman
e9a38d16fe
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
ff08995589
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
6cbf5bb9bb
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
bb754826c9
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
58be2d4413
use predicate instead of hand-rolled loop
...
llvm-svn: 69752
2009-04-21 23:37:18 +00:00
Jim Grosbach
8d62763779
remove trailing whitespace
...
llvm-svn: 69402
2009-04-17 23:30:55 +00:00
Eli Friedman
929207fd1d
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
046bf624b9
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
4ce6e69022
Update call graph after inlining invoke.
...
Patch by Jay Foad.
llvm-svn: 68120
2009-03-31 17:36:12 +00:00
Dan Gohman
4f2fea1a21
Now that errs() is properly non-buffered, there's no need to
...
explicitly flush it.
llvm-svn: 67526
2009-03-23 15:57:19 +00:00
Duncan Sands
1f15ca7c7a
Factorize out a concept - no functionality change.
...
llvm-svn: 67454
2009-03-21 21:27:31 +00:00
Duncan Sands
a09e0afe74
Don't load values out of global constants with weak
...
linkage: the value may be replaced with something
different at link time. (Frontends that want to
allow values to be loaded out of weak constants can
give their constants weak_odr linkage).
llvm-svn: 67407
2009-03-20 21:53:29 +00:00
Dale Johannesen
e4f361212b
Fix comment typo.
...
llvm-svn: 67307
2009-03-19 17:23:29 +00:00
Zhou Sheng
05bea906c1
Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl.
...
If the instruction has no users, it is also not only used by debug info
and should not be deleted.
llvm-svn: 67194
2009-03-18 10:13:08 +00:00
Zhou Sheng
64a6a092b1
Fix a bug.
...
If I->use_empty(), this method should return false.
llvm-svn: 67180
2009-03-18 07:56:13 +00:00
Bill Wendling
4bb96e9a50
Revert r66920. It was causing failures in the self-hosting buildbot (in release
...
mode).
Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2 libSystem.B.dylib 0x92f112bb _sigtramp + 43
3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4 bugpoint 0x00021d1c main + 92
5 bugpoint 0x00002106 start + 54
6 bugpoint 0x00000004 start + 18446744073709543220
Stack dump:
0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2 libSystem.B.dylib 0x92f112bb _sigtramp + 43
3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4 bugpoint 0x00021d1c main + 92
5 bugpoint 0x00002106 start + 54
6 bugpoint 0x00000006 start + 18446744073709543222
Stack dump:
0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes
0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2 libSystem.B.dylib 0x92f112bb _sigtramp + 43
3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4 bugpoint 0x00021d1c main + 92
5 bugpoint 0x00002106 start + 54
Stack dump:
0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes
--- Reverse-merging (from foreign repository) r66920 into '.':
U include/llvm/Support/CallSite.h
U include/llvm/Instructions.h
U lib/Analysis/IPA/GlobalsModRef.cpp
U lib/Analysis/IPA/Andersens.cpp
U lib/Bitcode/Writer/BitcodeWriter.cpp
U lib/VMCore/Instructions.cpp
U lib/VMCore/Verifier.cpp
U lib/VMCore/AsmWriter.cpp
U lib/Transforms/Utils/LowerInvoke.cpp
U lib/Transforms/Scalar/SimplifyCFGPass.cpp
U lib/Transforms/IPO/PruneEH.cpp
U lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm-svn: 66953
2009-03-13 21:15:59 +00:00
Gabor Greif
258232fb80
Second installment of "BasicBlock operands to the back"
...
changes.
For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().
This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.
This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.
llvm-svn: 66920
2009-03-13 18:27:29 +00:00
Dale Johannesen
cecfa6e08d
Fix one more place where debug info affected
...
codegen (speculative execution).
llvm-svn: 66859
2009-03-13 01:05:24 +00:00
Dale Johannesen
ed6f5a8253
Previous debug info fix to this code wasn't quite
...
right; did the wrong thing when there are exactly 11
non-debug instructions, followed by debug info.
Remove a FIXME since it's apparently been fixed along the way.
llvm-svn: 66840
2009-03-12 23:18:09 +00:00
Dale Johannesen
7f99d22f2f
There already was a class to force deterministic
...
sorting of ConstantInt's; unreinvent wheel.
llvm-svn: 66824
2009-03-12 21:01:11 +00:00
Dale Johannesen
578d8bfc3c
Another missing check for debug intrinsics.
...
llvm-svn: 66800
2009-03-12 17:42:45 +00:00
Dale Johannesen
9cdb9bb3e5
Allow for switch values bigger than 64 bits.
...
llvm-svn: 66751
2009-03-12 01:20:06 +00:00
Dale Johannesen
5a41b2def5
Fix some nondeterministic behavior when forwarding
...
from a switch table. Multiple table entries that
branch to the same place were being sorted by the
pointer value of the ConstantInt*; changed to sort
by the actual value of the ConstantInt.
llvm-svn: 66749
2009-03-12 01:00:26 +00:00
Dale Johannesen
900aaa3d1e
Don't consider debug intrinsics when checking
...
whether a callee to be inlined is a leaf.
llvm-svn: 66588
2009-03-10 22:20:02 +00:00
Devang Patel
84fceff969
Ignore dbg info, while estimating size of jump through block.
...
llvm-svn: 66554
2009-03-10 18:00:05 +00:00
Evan Cheng
1c94228de3
If a function is marked alwaysinline, it must be inlined (possibly for correctness). Do so even if the callee has dynamic alloca and the caller doesn't.
...
llvm-svn: 66539
2009-03-10 07:57:50 +00:00
Duncan Sands
12da8ce3d2
Introduce new linkage types linkonce_odr, weak_odr, common_odr
...
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Dale Johannesen
6e447e08ee
Fix another case where debug info interferes with
...
an optimization.
llvm-svn: 66288
2009-03-06 21:08:33 +00:00
Devang Patel
5aed7765b8
While hoisting instruction to speculatively execute simple bb, ignore dbg intrinsics.
...
llvm-svn: 66255
2009-03-06 06:00:17 +00:00
Dale Johannesen
073ab5acab
Tweak the check for promotable alloca's to handle
...
debug intrinsics correctly.
llvm-svn: 66225
2009-03-06 00:42:50 +00:00
Devang Patel
0c970f94e9
Add "check/remove dbg var" helper routines.
...
llvm-svn: 66223
2009-03-06 00:19:37 +00:00
Dale Johannesen
845e582cbe
Revert unintended commmit.
...
llvm-svn: 66001
2009-03-04 02:09:48 +00:00
Dale Johannesen
d71c20081c
Skip ptr-to-ptr bitcasts when counting in another case.
...
llvm-svn: 66000
2009-03-04 02:06:53 +00:00
Dale Johannesen
c8b5a6ef7d
Always skip ptr-to-ptr bitcasts when counting,
...
per Chris' suggestion. Slightly faster.
llvm-svn: 65999
2009-03-04 01:53:05 +00:00
Dale Johannesen
738c60f259
Marking debug info intrinsics as not touching memory
...
caused them to be considered trivially dead. Fix this.
llvm-svn: 65979
2009-03-03 23:30:00 +00:00
Dale Johannesen
09c3e8ec00
Instruction counters must skip the bitcasts that
...
feed into llvm.dbg.declare nodes, as well as
the debug directives themselves.
llvm-svn: 65976
2009-03-03 22:36:47 +00:00
Dale Johannesen
77456b7ab4
When removing a store to an alloca that has only one
...
use, check also for the case where it has two uses,
the other being a llvm.dbg.declare. This is needed so
debug info doesn't affect codegen.
llvm-svn: 65970
2009-03-03 21:26:39 +00:00
Bill Wendling
7fcd6148f7
Remove accidental check-ins in r65960. :-(
...
llvm-svn: 65961
2009-03-03 19:25:16 +00:00
Bill Wendling
a68fc7af63
Use > instead of >=. We want to promote aggregates of 128-bytes.
...
llvm-svn: 65960
2009-03-03 19:18:49 +00:00
Dan Gohman
92b551bc2b
Fix a bunch of Doxygen syntax issues. Escape special characters,
...
and put @file directives on their own comment line.
llvm-svn: 65920
2009-03-03 02:55:14 +00:00
Dale Johannesen
e1bb2f86f9
When sinking an insn in InstCombine bring its debug
...
info with it.
Don't count debug info insns against the scan maximum
in FindAvailableLoadedValue (lest they affect codegen).
llvm-svn: 65910
2009-03-03 01:09:07 +00:00
Nick Lewycky
d05f6870c3
Fix compiler warning about uninitialized variables. No functional change.
...
llvm-svn: 65620
2009-02-27 06:29:31 +00:00
Zhou Sheng
264e46e1e9
Ignore dbg info intrinsics when folding conditional branch to
...
conditional branch predecessors.
llvm-svn: 65509
2009-02-26 06:56:37 +00:00
Zhou Sheng
5d9cc1763b
Don't block basic block with only SwitchInst to fold into predecessors.
...
llvm-svn: 65456
2009-02-25 15:34:27 +00:00
Devang Patel
e288082644
While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite.
...
gcc.c-torture/execute/20000605-3.c
gcc.c-torture/execute/20020619-1.c
gcc.c-torture/execute/20030920-1.c
gcc.c-torture/execute/loop-ivopts-1.c
llvm-svn: 65353
2009-02-24 00:05:16 +00:00
Mon P Wang
dccfa0b26c
Changed option name from inline-threshold to basic-inline-threshold because
...
inline-threshold option is used by the inliner.
llvm-svn: 65309
2009-02-23 07:07:56 +00:00
Evan Cheng
1173ec7a2e
Add AddrModeMatcher.cpp
...
llvm-svn: 65228
2009-02-21 07:05:11 +00:00
Evan Cheng
c380864d2c
Factor address mode matcher out of codegen prepare to make it available to other passes, e.g. loop strength reduction.
...
llvm-svn: 65134
2009-02-20 18:24:38 +00:00
Zhou Sheng
053737e1ae
Just roll back the previous change to -mem2reg.
...
Will re-think about this according to Chris's comments.
llvm-svn: 65126
2009-02-20 17:49:33 +00:00
Zhou Sheng
6a0634d423
patch to update the line number information in pass -mem2reg.
...
Currently this pass will delete the variable declaration info,
and keep the line number info. But the kept line number info is not updated,
and some is redundant or not correct, this patch just updates those info.
llvm-svn: 65123
2009-02-20 16:31:35 +00:00
Nick Lewycky
0f269cfdee
Fix typo caused by too much surfing, dudes...
...
llvm-svn: 64626
2009-02-16 04:26:53 +00:00
Chris Lattner
feb129e813
Fix a nasty bug (PR3550) where the inline pass could incorrectly mark
...
calls with the tail marker when inlining them through an invoke. Patch,
testcase, and perfect analysis by Jay Foad!
llvm-svn: 64364
2009-02-12 07:06:42 +00:00
Devang Patel
316705027b
If llvm.dbg.region.end is disappearing then remove corresponding llvm.dbg.func.start also.
...
llvm-svn: 64278
2009-02-11 01:29:06 +00:00
Devang Patel
654e47f366
Ignore dbg intrinsic while folding unconditional branch.
...
llvm-svn: 64242
2009-02-10 22:14:17 +00:00
Devang Patel
4bed3565f3
Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end during inlining.
...
llvm-svn: 64209
2009-02-10 07:48:18 +00:00
Devang Patel
caf4485781
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
...
llvm-svn: 64207
2009-02-10 07:00:59 +00:00
Devang Patel
02f58e1e8d
Revert rev. 63876. It is causing llvm-gcc bootstrap failure.
...
llvm-svn: 63888
2009-02-05 21:46:41 +00:00
Devang Patel
5922e26d1a
Ignore dbg intrinsics while propagating conditional expression info.
...
llvm-svn: 63876
2009-02-05 19:15:39 +00:00
Devang Patel
086b212277
Ignore dbg intrinsics while folding switch instruction.
...
llvm-svn: 63802
2009-02-05 00:30:42 +00:00
Devang Patel
916fdce16d
Ignore dbg intrinsics.
...
llvm-svn: 63781
2009-02-04 21:39:48 +00:00
Devang Patel
fd9f635103
While folding vallue comparison terminators ignore dbg intrinsics.
...
llvm-svn: 63700
2009-02-04 01:06:11 +00:00
Devang Patel
f10e287c65
Ignore dbg intrinsics while hoisting common code in the two blocks up into the branch block.
...
llvm-svn: 63687
2009-02-04 00:03:08 +00:00
Devang Patel
2032cadd0f
Do not let dbg intrinsic block folding of two entry phi node.
...
llvm-svn: 63671
2009-02-03 22:12:02 +00:00
Nick Lewycky
05daea5d32
Revert r63600. It didn't fix the bug, it just moved it a bit.
...
llvm-svn: 63618
2009-02-03 06:30:37 +00:00
Nick Lewycky
12a130bd06
Update the callgraph when replacing InvokeInst with CallInst when inlining.
...
llvm-svn: 63600
2009-02-03 04:34:40 +00:00
Gabor Greif
97f1720621
use precise getters
...
llvm-svn: 63402
2009-01-30 18:21:13 +00:00
Duncan Sands
5a913d61e3
Rename getAnalysisToUpdate to getAnalysisIfAvailable.
...
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Dale Johannesen
2b3389a626
Revert previous change; even this mild and clearly
...
more accurate change loses more than it gains on
benchmarks.
llvm-svn: 62938
2009-01-24 21:49:34 +00:00
Dale Johannesen
899ecdbbba
Improve the inlining cost function a bit.
...
Little practical effect.
llvm-svn: 62908
2009-01-24 01:27:33 +00:00
Gabor Greif
eb61fcf2a1
Simplify the logic of getting hold of a PHI predecessor block.
...
There is now a direct way from value-use-iterator to incoming block in PHINode's API.
This way we avoid the iterator->index->iterator trip, and especially the costly
getOperandNo() invocation. Additionally there is now an assertion that the iterator
really refers to one of the PHI's Uses.
llvm-svn: 62869
2009-01-23 19:40:15 +00:00
Chris Lattner
c59945b4bd
another fix for PR3354
...
llvm-svn: 62561
2009-01-20 01:15:41 +00:00
Bill Wendling
caf1d22243
Doxygen-ify comments.
...
llvm-svn: 62546
2009-01-19 23:43:56 +00:00
Chris Lattner
ea9f1d3c47
Fix a problem exposed by PR3354: simplifycfg was making a potentially
...
trapping instruction be executed unconditionally.
llvm-svn: 62541
2009-01-19 23:03:13 +00:00
Bill Wendling
534d2e0bae
Temporarily revert r62487. It's causing this error during a release bootstrap of
...
llvm-gcc. Most likely, it's miscompiling one of the "gen*" programs:
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./prev-gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./prev-gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.6.0/bin/ -c -g -O2 -mdynamic-no-pic -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -mdynamic-no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/build -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o build/gencondmd.o build/gencondmd.c
../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected '}' before ')' token
../../llvm-gcc.src/gcc/config/i386/mmx.md:926: warning: excess elements in struct initializer
../../llvm-gcc.src/gcc/config/i386/mmx.md:926: warning: (near initialization for 'insn_conditions[4]')
../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected '}' before ')' token
../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected ',' or ';' before ')' token
../../llvm-gcc.src/gcc/config/i386/mmx.md:927: error: expected identifier or '(' before ',' token
../../llvm-gcc.src/gcc/config/i386/sse.md:3458: error: expected identifier or '(' before ',' token
...
llvm-svn: 62506
2009-01-19 08:46:20 +00:00
Chris Lattner
f2bb4ea39c
Fix PR3016, a bug which can occur do to an invalid assumption:
...
we assumed a CFG structure that would be valid when all code in
the function is reachable, but not all code is necessarily
reachable. Do a simple, but horrible, CFG walk to check for this
case.
llvm-svn: 62487
2009-01-19 02:46:28 +00:00
Chris Lattner
e381d7026f
reduce indentation by using 'continue', no functionality change.
...
llvm-svn: 62477
2009-01-19 02:07:32 +00:00
Chris Lattner
54f0c61d71
Fix some problems in SpeculativelyExecuteBB. Basically,
...
because of dead code, a phi could use the speculated instruction
that was not in "BB2". Make this check explicit and tighten up
some other corners. This fixes PR3292. No testcase becauase this
depends entirely on visitation order of blocks and requires a
sequence of 8 passes to repro.
llvm-svn: 62476
2009-01-19 00:36:37 +00:00
Chris Lattner
e1c01e4e2b
Make this a bit more explicit about which cases need the
...
check. No functionality change.
llvm-svn: 62474
2009-01-18 23:22:07 +00:00
Gabor Greif
f1abfdccdc
introduce typedef for complicated vector, and use it too
...
llvm-svn: 62384
2009-01-17 00:09:08 +00:00
Gabor Greif
8c573f7e49
typo
...
llvm-svn: 62377
2009-01-16 23:08:50 +00:00
Rafael Espindola
6de96a1b5d
Add the private linkage.
...
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Gabor Greif
5aa1922614
avoid using iterators when they get invalidated potentially
...
this fixes PR3332
llvm-svn: 62271
2009-01-15 18:40:09 +00:00
Dale Johannesen
0aeabdff57
Fix testsuite regressions from recursive inlining.
...
llvm-svn: 62189
2009-01-13 22:43:37 +00:00
Dale Johannesen
433a9086c0
Enable recursive inlining. Reduce inlining threshold
...
back to 200; 400 seems to be too high, loses more than
it gains.
llvm-svn: 62107
2009-01-12 22:11:50 +00:00
Duncan Sands
dc020f9c3c
Rename getABITypeSize to getTypePaddedSize, as
...
suggested by Chris.
llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Misha Brukman
5cbf223916
Removed trailing whitespace from Makefiles.
...
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Dale Johannesen
4755d9df78
Adjustments to last patch based on review.
...
llvm-svn: 61969
2009-01-09 01:30:11 +00:00
Dale Johannesen
b48fc71fc6
Do not inline functions with (dynamic) alloca into
...
functions that don't already have a (dynamic) alloca.
Dynamic allocas cause inefficient codegen and we shouldn't
propagate this (behavior follows gcc). Two existing tests
assumed such inlining would be done; they are hacked by
adding an alloca in the caller, preserving the point of
the tests.
llvm-svn: 61946
2009-01-08 21:45:23 +00:00
Dan Gohman
906152a20f
Tidy up #includes, deleting a bunch of unnecessary #includes.
...
llvm-svn: 61715
2009-01-05 17:59:02 +00:00
Chris Lattner
4caf5eb70c
Fix PR2929 by making bugpoint/code extract propagate the nothrow
...
bit from the original function to the cloned one.
llvm-svn: 61194
2008-12-18 05:52:56 +00:00
Chris Lattner
c1c6404bba
make instnamer name unnamed blocks as well as instructions and args.
...
llvm-svn: 61175
2008-12-18 00:33:11 +00:00
Eli Friedman
cb61afb546
Add a helper to remove a branch and DCE the condition, and use it
...
consistently for deleting branches. In addition to being slightly
more readable, this makes SimplifyCFG a bit better
about cleaning up after itself when it makes conditions unused.
llvm-svn: 61100
2008-12-16 20:54:32 +00:00
Misha Brukman
234b44add2
Fix spelling.
...
llvm-svn: 60971
2008-12-13 05:21:37 +00:00
Chris Lattner
f50d7f76c6
fix a bug I introduced in simplifycfg handling single entry phi
...
nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no
need to delete it afterward.
llvm-svn: 60653
2008-12-07 07:22:45 +00:00
Chris Lattner
dc3f6f2c12
Factor some code into a new FoldSingleEntryPHINodes method.
...
llvm-svn: 60501
2008-12-03 19:44:02 +00:00
Chris Lattner
37e0136fef
third time is the charm.
...
llvm-svn: 60469
2008-12-03 07:45:15 +00:00
Chris Lattner
c04a1ffa9a
fix assertion.
...
llvm-svn: 60468
2008-12-03 07:43:05 +00:00
Chris Lattner
7eb270ed03
Rename DeleteBlockIfDead to DeleteDeadBlock and make it
...
unconditionally delete the block. All likely clients will
do the checking anyway.
llvm-svn: 60464
2008-12-03 06:40:52 +00:00
Chris Lattner
bcc904a67c
Factor some code out of SimplifyCFG, forming a new
...
DeleteBlockIfDead method.
llvm-svn: 60463
2008-12-03 06:37:44 +00:00
Chris Lattner
e9f6c355bf
rewrite RecursivelyDeleteTriviallyDeadInstructions to use a more efficient
...
formulation that doesn't require set lookups or scanning a set.
llvm-svn: 60203
2008-11-28 01:20:46 +00:00
Chris Lattner
d4b5ba615e
remove some weirdness that came from the LSR code that has
...
nothing to do with dead instruction elimination. No tests in
dejagnu depend on this, so I don't know what it was needed for.
llvm-svn: 60202
2008-11-28 00:58:15 +00:00
Chris Lattner
8e84c129ce
delete ErasePossiblyDeadInstructionTree, replacing uses of it with
...
RecursivelyDeleteTriviallyDeadInstructions.
llvm-svn: 60196
2008-11-27 23:25:44 +00:00