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
Dan Gohman
18daca0895
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
3c115770e7
Factorize out a concept - no functionality change.
...
llvm-svn: 67454
2009-03-21 21:27:31 +00:00
Duncan Sands
926d062a48
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
1d76ebc9ed
Fix comment typo.
...
llvm-svn: 67307
2009-03-19 17:23:29 +00:00
Zhou Sheng
fd26fc58bd
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
90fc23d03d
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
96e37540a0
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
6a76677e1b
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
3edb15a6c7
Fix one more place where debug info affected
...
codegen (speculative execution).
llvm-svn: 66859
2009-03-13 01:05:24 +00:00
Dale Johannesen
67278f57e8
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
d9b24eba60
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
78eadcb3dc
Another missing check for debug intrinsics.
...
llvm-svn: 66800
2009-03-12 17:42:45 +00:00
Dale Johannesen
6a856e8183
Allow for switch values bigger than 64 bits.
...
llvm-svn: 66751
2009-03-12 01:20:06 +00:00
Dale Johannesen
a63033a34c
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
7579673822
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
eedb8ab91a
Ignore dbg info, while estimating size of jump through block.
...
llvm-svn: 66554
2009-03-10 18:00:05 +00:00
Evan Cheng
c147115cdf
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
5ab54d488f
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
0643e4e36c
Fix another case where debug info interferes with
...
an optimization.
llvm-svn: 66288
2009-03-06 21:08:33 +00:00
Devang Patel
3ae9d5d375
While hoisting instruction to speculatively execute simple bb, ignore dbg intrinsics.
...
llvm-svn: 66255
2009-03-06 06:00:17 +00:00
Dale Johannesen
83c13c2ace
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
28a28a2588
Add "check/remove dbg var" helper routines.
...
llvm-svn: 66223
2009-03-06 00:19:37 +00:00
Dale Johannesen
8ca4d24371
Revert unintended commmit.
...
llvm-svn: 66001
2009-03-04 02:09:48 +00:00
Dale Johannesen
c6bfdb8253
Skip ptr-to-ptr bitcasts when counting in another case.
...
llvm-svn: 66000
2009-03-04 02:06:53 +00:00
Dale Johannesen
e184480072
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
e611f70764
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
81b6cd8ce5
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
ceed180d4c
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
7fdda71ad7
Remove accidental check-ins in r65960. :-(
...
llvm-svn: 65961
2009-03-03 19:25:16 +00:00
Bill Wendling
8244b700bf
Use > instead of >=. We want to promote aggregates of 128-bytes.
...
llvm-svn: 65960
2009-03-03 19:18:49 +00:00
Dan Gohman
51d4e8db6a
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
33fa9dc8a9
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
f5563f28d3
Fix compiler warning about uninitialized variables. No functional change.
...
llvm-svn: 65620
2009-02-27 06:29:31 +00:00
Zhou Sheng
670d50e102
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
241d74737b
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
702836b2dd
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
75d957dba4
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
74d0dda00f
Add AddrModeMatcher.cpp
...
llvm-svn: 65228
2009-02-21 07:05:11 +00:00
Evan Cheng
d8aad94754
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
0c2e862ad0
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
580c176f47
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
6feb7523b8
Fix typo caused by too much surfing, dudes...
...
llvm-svn: 64626
2009-02-16 04:26:53 +00:00
Chris Lattner
5babade39e
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
dd611eac76
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
60571be0de
Ignore dbg intrinsic while folding unconditional branch.
...
llvm-svn: 64242
2009-02-10 22:14:17 +00:00
Devang Patel
6c041de2ff
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
7377e7aa89
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
72f5fba371
Revert rev. 63876. It is causing llvm-gcc bootstrap failure.
...
llvm-svn: 63888
2009-02-05 21:46:41 +00:00
Devang Patel
66eee02024
Ignore dbg intrinsics while propagating conditional expression info.
...
llvm-svn: 63876
2009-02-05 19:15:39 +00:00
Devang Patel
e665f78460
Ignore dbg intrinsics while folding switch instruction.
...
llvm-svn: 63802
2009-02-05 00:30:42 +00:00
Devang Patel
10be164b28
Ignore dbg intrinsics.
...
llvm-svn: 63781
2009-02-04 21:39:48 +00:00
Devang Patel
2fac28a8c7
While folding vallue comparison terminators ignore dbg intrinsics.
...
llvm-svn: 63700
2009-02-04 01:06:11 +00:00
Devang Patel
bc5a1a7007
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
4b56b3c66e
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
a676cf98e3
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
cd8353b6fe
Update the callgraph when replacing InvokeInst with CallInst when inlining.
...
llvm-svn: 63600
2009-02-03 04:34:40 +00:00
Gabor Greif
690930270b
use precise getters
...
llvm-svn: 63402
2009-01-30 18:21:13 +00:00
Duncan Sands
aee16d4916
Rename getAnalysisToUpdate to getAnalysisIfAvailable.
...
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Dale Johannesen
b818fa1bd3
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
1867040e00
Improve the inlining cost function a bit.
...
Little practical effect.
llvm-svn: 62908
2009-01-24 01:27:33 +00:00
Gabor Greif
fbd40904c1
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
6ade48fcaa
another fix for PR3354
...
llvm-svn: 62561
2009-01-20 01:15:41 +00:00
Bill Wendling
5281f4fb64
Doxygen-ify comments.
...
llvm-svn: 62546
2009-01-19 23:43:56 +00:00
Chris Lattner
e8fa6f2468
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
bf83203ae6
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
bb76cc9447
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
af6f58bbf4
reduce indentation by using 'continue', no functionality change.
...
llvm-svn: 62477
2009-01-19 02:07:32 +00:00
Chris Lattner
c03b442e54
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
ead19aaccb
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
20f36c51bd
introduce typedef for complicated vector, and use it too
...
llvm-svn: 62384
2009-01-17 00:09:08 +00:00
Gabor Greif
0d0908d06a
typo
...
llvm-svn: 62377
2009-01-16 23:08:50 +00:00
Rafael Espindola
0aba6c9435
Add the private linkage.
...
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Gabor Greif
b1f92de36f
avoid using iterators when they get invalidated potentially
...
this fixes PR3332
llvm-svn: 62271
2009-01-15 18:40:09 +00:00
Dale Johannesen
e458c47a74
Fix testsuite regressions from recursive inlining.
...
llvm-svn: 62189
2009-01-13 22:43:37 +00:00
Dale Johannesen
12bb54e183
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