Chris Lattner
156b8c7109
reimplement multiple return value handling in IPSCCP, making it
...
more aggressive an correct. This survives building llvm in 64-bit
mode with optimizations and the built llvm passes make check.
llvm-svn: 85973
2009-11-03 23:40:48 +00:00
Chris Lattner
2c427233d4
finish half thunk thought
...
llvm-svn: 85937
2009-11-03 20:52:57 +00:00
Chris Lattner
cde8de519d
fix an IPSCCP bug I introduced when I changed IPSCCP to start working on
...
functions that don't have local linkage. Basically, we need to be more
careful about propagating argument information to functions whose results
we aren't tracking. This fixes a miscompilation of
LLVMCConfigurationEmitter.cpp when built with an llvm-gcc that has ipsccp
enabled.
llvm-svn: 85923
2009-11-03 19:24:51 +00:00
Chris Lattner
e1d5cd9f48
fix a subtle bug I introduced when refactoring SCCP. Testcase
...
to follow.
llvm-svn: 85903
2009-11-03 16:50:11 +00:00
Chris Lattner
fb14181b18
turn IPSCCP back on now that the iterator invalidation bug is fixed.
...
llvm-svn: 85858
2009-11-03 03:42:51 +00:00
Chris Lattner
b70ef3c8c7
fix a nasty iterator invalidation bug from my conversion from
...
std::map to DenseMap, exposed on release llvm-gcc bootstrap.
llvm-svn: 85840
2009-11-02 23:25:39 +00:00
Chris Lattner
a15cc59dcb
revert r8579[56], which are causing unhappiness in buildbot land.
...
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner
a3d794ebbb
disable IPSCCP support for multiple return values, it is buggy, so just
...
disable it until I can fix it.
llvm-svn: 85810
2009-11-02 18:22:51 +00:00
Chris Lattner
9d49f0c858
improve IPSCCP to be able to propagate the result of "!mayBeOverridden"
...
function to calls of that function, regardless of whether it has local
linkage or has its address taken. Not escaping should only affect
whether we make an aggressive assumption about the arguments to a
function, not whether we can track the result of it.
llvm-svn: 85795
2009-11-02 07:33:59 +00:00
Chris Lattner
47837c5182
don't mark the arguments of prototype overdefined, they will never be queried.
...
llvm-svn: 85793
2009-11-02 06:34:04 +00:00
Chris Lattner
5503328332
restore some code I removed in r85788, refactor it into
...
a shared place instead of duplicating it 4 times.
llvm-svn: 85792
2009-11-02 06:28:16 +00:00
Chris Lattner
4910b656b2
remove some confused code that dates from when we had
...
"multiple return values" but not "first class aggregates"
llvm-svn: 85791
2009-11-02 06:17:06 +00:00
Chris Lattner
809aee2f40
avoid redundant lookups in BBExecutable, and make it a SmallPtrSet.
...
llvm-svn: 85790
2009-11-02 06:11:23 +00:00
Chris Lattner
e77c9aa04a
Use the libanalysis 'ConstantFoldLoadFromConstPtr' function
...
instead of reinventing SCCP-specific logic. This gives us
new powers.
llvm-svn: 85789
2009-11-02 06:06:14 +00:00
Chris Lattner
f548403989
switch the main 'ValueState' map from being an std::map to being
...
a DenseMap. Doing this required being aware of subtle iterator
invalidation issues, but it provides a big speedup. In a
release-asserts build, this sped up optimizing 403.gcc from
1.34s -> 0.79s (IPSCCP) and 1.11s -> 0.44s (SCCP).
This commit also conflates in a bunch of general cleanups, sorry.
llvm-svn: 85788
2009-11-02 05:55:40 +00:00
Chris Lattner
e82b087ae6
only IPSCCP incoming arguments if the function is executable, this fixes
...
an assertion on the buildbot.
llvm-svn: 85784
2009-11-02 03:25:55 +00:00
Chris Lattner
9e97fbe114
add a new ValueState::getConstantInt() helper, use it to
...
simplify some code.
llvm-svn: 85783
2009-11-02 03:21:36 +00:00
Chris Lattner
7ccf1a6df6
tidy up some more: remove some extraneous inline specifiers, return harder.
...
llvm-svn: 85780
2009-11-02 03:03:42 +00:00
Chris Lattner
b5a13d4c90
eliminate the SCCPSolver::getValueMapping method.
...
llvm-svn: 85778
2009-11-02 02:54:24 +00:00
Chris Lattner
c49ae9912a
fix failures introduced in r85774
...
llvm-svn: 85777
2009-11-02 02:48:17 +00:00
Chris Lattner
e405ed9651
factor duplicated code into a new DeleteInstructionInBlock
...
function, eliminate temporary (and pointless) smallvector.
llvm-svn: 85776
2009-11-02 02:47:51 +00:00
Chris Lattner
a3c39d394d
Chris used to use '...' instead of proper grammar.
...
llvm-svn: 85775
2009-11-02 02:33:50 +00:00
Chris Lattner
6df5cec72f
remove some extraneous llvmcontext stuff.
...
llvm-svn: 85774
2009-11-02 02:30:06 +00:00
Chris Lattner
efdd2bbce6
change LatticeVal to use PointerIntPair to save some space.
...
llvm-svn: 85773
2009-11-02 02:20:32 +00:00
Chris Lattner
1a8b80ed5a
teach ipsccp and ipconstprop that a blockaddress doesn't 'take the address' of a function
...
in a way that should prevent ip constprop. This allows clang/test/CodeGen/indirect-goto.c
to pass with the new indirect goto lowering.
llvm-svn: 85709
2009-11-01 06:11:53 +00:00
Chris Lattner
ee8b951e73
teach various passes about blockaddress. We no longer
...
crash on any clang tests.
llvm-svn: 85465
2009-10-29 01:21:20 +00:00
Victor Hernandez
f390e04a47
Rename MallocFreeHelper as MemoryBuiltins
...
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
762195bd01
Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
...
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
de5ad42aa1
Remove FreeInst.
...
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.
llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Victor Hernandez
e297149e26
Auto-upgrade free instructions to calls to the builtin free function.
...
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
8acf2956b8
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
...
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Torok Edwin
729d92bd74
Fix PR4313: IPSCCP was not setting the lattice value for the invoke instruction
...
when the invoke had multiple return values: it set the lattice value only on the
extractvalue.
This caused the invoke's lattice value to remain the default (undefined), and
later propagated to extractvalue's operand, which incorrectly introduces
undefined behavior.
llvm-svn: 84637
2009-10-20 15:15:09 +00:00
Dan Gohman
e525d9ddc0
Remove an unnnecessary LLVMContext argument in
...
ConstantFoldLoadThroughGEPConstantExpr.
llvm-svn: 83311
2009-10-05 16:36:26 +00:00
Chris Lattner
fdd8790718
strength reduce a ton of type equality tests to check the typeid (Through
...
the new predicates I added) instead of going through a context and doing a
pointer comparison. Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.
llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Chris Lattner
f9e0c7f84b
calls to external functions are already marked overdefined, special casing
...
malloc isn't needed.
llvm-svn: 82932
2009-09-27 21:35:11 +00:00
Torok Edwin
21bd8c9fc5
Constant propagating byval pointer is safe if function is readonly.
...
llvm-svn: 82700
2009-09-24 18:33:42 +00:00
Torok Edwin
f95a450ef9
Don't constant propagate byval pointers, since they are not really pointers, but
...
rather structs passed by value.
This fixes PR5038.
llvm-svn: 82689
2009-09-24 09:47:18 +00:00
Victor Hernandez
5d034499ad
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
Chris Lattner
2dd09dbdf7
eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
...
llvm-svn: 80766
2009-09-02 06:11:42 +00:00
Chris Lattner
a3e620caba
add getPointerAddressSpace() to GEP instruction, use the method
...
in a few scalar xforms to simplify things.
llvm-svn: 80506
2009-08-30 20:06:40 +00:00
Chris Lattner
b25de3ff60
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
Dan Gohman
8dd69f88ea
Fix debug output to include a newline after printing a Value, now
...
that Value's operator<< doesn't include one.
llvm-svn: 79240
2009-08-17 15:25:05 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
5a1acd9912
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
23a204d91b
Move getTrue() and getFalse() to 2.5-like APIs.
...
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson
b292b8ce70
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson
487375e9a2
Move ConstantExpr to 2.5 API.
...
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Daniel Dunbar
9813b0b025
Eliminate some uses of DOUT, cerr, and getNameStart().
...
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Daniel Dunbar
0dd5e1ed39
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
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Owen Anderson
c37bc69e91
Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
...
llvm-svn: 76598
2009-07-21 18:03:38 +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
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
Owen Anderson
542619e6d5
Move more functionality over to LLVMContext.
...
llvm-svn: 75497
2009-07-13 20:58:05 +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
38264b1554
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
f1f1743b2e
Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
...
llvm-svn: 74873
2009-07-06 22:37:39 +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
340288c621
Even more passes being LLVMContext'd.
...
llvm-svn: 74781
2009-07-03 19:42:02 +00:00
Nick Lewycky
7ea68536b5
Don't crash on multiple return value with no obvious inserted value.
...
Fixes PR4314.
llvm-svn: 73007
2009-06-06 23:13:08 +00:00
Nick Lewycky
206876e2da
Use Operands.data() instead of &Operands[0] where Operands is a potentially
...
empty SmallVector.
llvm-svn: 72512
2009-05-28 04:08:10 +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
Rafael Espindola
6de96a1b5d
Add the private linkage.
...
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Chris Lattner
8fb9480ed2
Fix PR3325, a miscompilation of invokes by IPSCCP. Patch by Jay Foad!
...
llvm-svn: 62244
2009-01-14 21:01:16 +00:00
Devang Patel
45f1ae028e
Fix unused variable warnings.
...
llvm-svn: 59778
2008-11-21 01:52:59 +00:00
Nick Lewycky
d73806a9cc
Replace explicit loop with utility function.
...
llvm-svn: 58593
2008-11-03 03:49:14 +00:00
Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Chris Lattner
add44f3fb7
improve encapsulation of the BBExecutable set.
...
llvm-svn: 55271
2008-08-23 23:39:31 +00:00
Chris Lattner
65938fc69a
Switch an assortment of maps, sets and vectors to more efficient versions,
...
patch contributed by m-s!
llvm-svn: 55270
2008-08-23 23:36:38 +00:00
Bill Wendling
861bec78f8
Temporarily revert r54792. It's causing an ICE during bootstrapping.
...
llvm-svn: 54804
2008-08-14 23:05:24 +00:00
Devang Patel
52dc07b01a
Use DenseMap. Patch by Pratik Solanki.
...
llvm-svn: 54792
2008-08-14 21:31:10 +00:00
Dan Gohman
8ded5d5884
Fix SCCP's handling of struct value loads and stores. SCCP doesn't
...
track individual leaf values in such cases, so it needs to treat
struct values as normal values in this case.
llvm-svn: 54760
2008-08-13 21:22:48 +00:00
Dan Gohman
fa1211f69b
Enable first-class aggregates support.
...
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.
The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.
llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Dan Gohman
a5dd67f002
Tidy up some commments and use the getAggregateOperand and
...
getInsertedValueOperand accessors. Thanks Matthijs!
llvm-svn: 52543
2008-06-20 16:41:17 +00:00
Dan Gohman
b5210efb31
Fix the conditions under which SCCP should examine insertvalue
...
instructions. Thanks to Matthijs Kooijman for pointing this out!
llvm-svn: 52542
2008-06-20 16:39:44 +00:00
Dan Gohman
041f9d03ff
Teach SCCP about insertvalue and extractvalue, and about
...
propagating constants across aggregate return values when
insertvalue and extractvalue are used.
llvm-svn: 52520
2008-06-20 01:15:44 +00:00
Chris Lattner
5c207c83c6
Fix PR2358 by resolving calls with undef arguments to overdefined.
...
llvm-svn: 51535
2008-05-24 03:59:33 +00:00
Dale Johannesen
fecb88249f
Allow for switch with no cases. Was causing fault
...
in gcc.dg/pr27531-1.c.
llvm-svn: 51464
2008-05-23 01:01:31 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Chris Lattner
47fed61526
Fix various DOUTs to not call the extremely expensive Value::getName()
...
method. DOUT statements are disabled when assertions are off, but the
side effects of getName() are still evaluated. Just call getNameSTart,
which is close enough and doesn't cause heap traffic.
llvm-svn: 50958
2008-05-11 01:55:59 +00:00
Chris Lattner
82146fa267
Simplify code by using SwitchInst::findCaseValue instead of reimplementing it.
...
llvm-svn: 50957
2008-05-10 23:56:54 +00:00
Nick Lewycky
4d43d3c72c
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
...
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Chris Lattner
97951ac580
code restructuring, not functionality change.
...
llvm-svn: 50203
2008-04-24 00:21:50 +00:00
Chris Lattner
12f1e007f7
Don't replace multiple result of calls with undef,
...
sccp tracks getresult values, not call values in this
case.
llvm-svn: 50202
2008-04-24 00:19:54 +00:00
Chris Lattner
769203cb03
code cleanup, no functionality change.
...
llvm-svn: 50201
2008-04-24 00:16:28 +00:00
Chris Lattner
5a58a4dc6d
Rewrite multiple return value handling in SCCP. Before, the -sccp pass
...
would turn every getresult instruction into undef. This helps with
rdar://5778210
llvm-svn: 50140
2008-04-23 05:38:20 +00:00
Devang Patel
a7dfbc0366
Be conservative if getresult operand is neither call nor invoke.
...
llvm-svn: 49430
2008-04-09 15:58:24 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Dan Gohman
9988569af8
Don't include <map> in Pass.h, which doesn't need it. This requires
...
adding <map> to many files that actually do need it.
llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Devang Patel
e418de3023
Add TODO reminder.
...
llvm-svn: 48227
2008-03-11 17:32:05 +00:00
Devang Patel
a7a2075ab8
Initial multiple return values support.
...
llvm-svn: 48210
2008-03-11 05:46:42 +00:00
Nick Lewycky
83750d9caf
SCCP also needs to be taught to follow unwind_to
...
llvm-svn: 48109
2008-03-09 09:44:38 +00:00
Nick Lewycky
35e92c7bea
Not all users of a BB are Instructions any more.
...
llvm-svn: 48047
2008-03-08 07:48:41 +00:00
Anton Korobeynikov
1bfd121321
Make Transforms to be 4.3 warnings-clean
...
llvm-svn: 47371
2008-02-20 11:26:25 +00:00
Chris Lattner
1b706dd680
Fix PR1938 by forcing the code that uses an undefined value to branch one
...
way or the other. Rewriting the code itself prevents subsequent analysis
passes from making contradictory conclusions about the code that could
cause an infeasible path to be made feasible.
llvm-svn: 46427
2008-01-28 00:32:30 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Christopher Lamb
b053b80b79
Disable null pointer folding transforms for non-generic address spaces. This should probably be a target-specific predicate based on address space. That way for targets where this isn't applicable the predicate can be optimized away.
...
llvm-svn: 45403
2007-12-29 07:56:53 +00:00
Dan Gohman
c731c97fac
Use empty() member functions when that's what's being tested for instead
...
of comparing begin() and end().
llvm-svn: 42585
2007-10-03 19:26:29 +00:00