Chad Rosier
fdca220a9e
Fix a few more places where TargetData/TargetLibraryInfo is not being passed.
...
Add FIXMEs to places that are non-trivial to fix.
llvm-svn: 145661
2011-12-02 01:26:24 +00:00
Chad Rosier
0b4bd4832a
Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetData
...
where it appeared beneficial to pass.
More of rdar://10500969
llvm-svn: 145630
2011-12-01 21:29:16 +00:00
Chad Rosier
49a66381f7
Propagate TargetLibraryInfo throughout ConstantFolding.cpp and
...
InstructionSimplify.cpp. Other fixups as needed.
Part of rdar://10500969
llvm-svn: 145559
2011-12-01 03:08:23 +00:00
Eli Friedman
2d9e4aa665
Make GlobalMerge honor the preferred alignment on globals without an explicitly specified alignment.
...
<rdar://problem/10497732>.
llvm-svn: 145523
2011-11-30 21:54:15 +00:00
Stepan Dyatkovskiy
56753569db
Potential bug in RewriteLoopBodyWithConditionConstant: use iterator should not be changed inside the uses enumeration loop.
...
llvm-svn: 145432
2011-11-29 20:34:39 +00:00
Daniel Dunbar
4e00f5f8fd
build/CMake: Finish removal of add_llvm_library_dependencies.
...
llvm-svn: 145420
2011-11-29 19:25:30 +00:00
Andrew Trick
63f81b112e
SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.
...
This reverts r139450, fixes r139453, and adds much needed comments and a
unit test.
llvm-svn: 145367
2011-11-29 02:16:38 +00:00
Andrew Trick
8c051c1949
Remove the temporary flag -disable-unroll-scev and dead code.
...
SCEV should now be used for trip count analysis, not LoopInfo.
llvm-svn: 145262
2011-11-28 19:22:09 +00:00
Benjamin Kramer
d861d825f2
Move code into anonymous namespaces.
...
llvm-svn: 145154
2011-11-26 23:01:57 +00:00
Nick Lewycky
39c6f0a5d5
Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.
...
Suggested in code review by Eli.
That code in InstCombine looks kinda suspicious.
llvm-svn: 145013
2011-11-20 19:09:04 +00:00
Eli Friedman
d02d82d355
Add support for custom names for library functions in TargetLibraryInfo. Add a custom name for fwrite and fputs on x86-32 OSX. Make SimplifyLibCalls honor the custom
...
names for fwrite and fputs.
Fixes <rdar://problem/9815881>.
llvm-svn: 144876
2011-11-17 01:27:36 +00:00
Nick Lewycky
ff690249a9
Merge isObjectPointerWithTrustworthySize with getPointerSize. Use it when
...
looking at the size of the pointee. Fixes PR11390!
llvm-svn: 144773
2011-11-16 03:49:48 +00:00
Nadav Rotem
d8497a8354
Fix MSVC warnings by adding a cast.
...
llvm-svn: 144721
2011-11-15 22:54:21 +00:00
Benjamin Kramer
4a8534a158
StringRefize and simplify.
...
llvm-svn: 144675
2011-11-15 19:12:09 +00:00
Eli Friedman
a83fbaff5f
Make sure scalarrepl picks the correct alloca when it rewrites a bitcast. Fixes PR11353.
...
llvm-svn: 144442
2011-11-12 02:07:50 +00:00
Eli Friedman
127d98ab35
Get rid of an optimization in SCCP which appears to have many issues. Specifically, it doesn't handle many cases involving undef correctly, and it is missing other checks which
...
lead to it trying to re-mark a value marked as a constant with a different value. It also appears to trigger very rarely.
Fixes PR11357.
llvm-svn: 144352
2011-11-11 01:16:15 +00:00
Pete Cooper
93d3c835a0
Fixed bug in DeadStoreElimination commit r144239
...
Size of data being pointed to wasn't always being checked so some small writes were killing big writes
Fixes <rdar://problem/10426753>
llvm-svn: 144312
2011-11-10 20:22:08 +00:00
Pete Cooper
38700a1201
DeadStoreElimination can now trim the size of a store if the end of the store is dead.
...
Currently checks alignment and killing stores on a power of 2 boundary as this is likely
to trim the size of the earlier store without breaking large vector stores into scalar ones.
Fixes <rdar://problem/10140300>
llvm-svn: 144239
2011-11-09 23:07:35 +00:00
Pete Cooper
a85aa24d64
LICM pass now understands invariant load metadata. Nothing generates this yet so it will currently never get used in real tests
...
llvm-svn: 144107
2011-11-08 19:30:00 +00:00
Nick Lewycky
7ea3dd8ae5
Do simple cross-block DSE when we encounter a free statement. Fixes PR11240.
...
llvm-svn: 143808
2011-11-05 10:48:42 +00:00
Daniel Dunbar
0193e03f99
Speculatively revert "DeadStoreElimination can now trim the size of a store if
...
the end of it is dead.", which appears to break bootstrapping LLVM.
llvm-svn: 143668
2011-11-04 00:48:26 +00:00
Daniel Dunbar
3760ebeebb
build: Add initial cut at LLVMBuild.txt files.
...
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Pete Cooper
4902705b5f
DeadStoreElimination can now trim the size of a store if the end of it is dead.
...
Only currently done if the later store is writing to a power of 2 address or
has the same alignment as the earlier store as then its likely to not break up
large stores into smaller ones
Fixes <rdar://problem/10140300>
llvm-svn: 143630
2011-11-03 18:01:56 +00:00
Andrew Trick
3c1e831108
Rewrite LinearFunctionTestReplace to handle pointer-type IVs.
...
We've been hitting asserts in this code due to the many supported
combintions of modes (iv-rewrite/no-iv-rewrite) and IV types. This
second rewrite of the code attempts to deal with these cases systematically.
llvm-svn: 143546
2011-11-02 17:19:57 +00:00
Chandler Carruth
06c2886572
Add parentheses to disambiguate the precedence of these operations and
...
silence -Wparentheses.
llvm-svn: 143534
2011-11-02 05:43:44 +00:00
Andrew Trick
c9baf3a7a1
Broaden an assert to handle enable-iv-rewrite=true following r143183.
...
Narrowest possible fix for PR11279.
llvm-svn: 143522
2011-11-02 00:02:45 +00:00
Benjamin Kramer
d32c541fe4
SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable.
...
Fixes PR11264.
llvm-svn: 143289
2011-10-29 19:43:31 +00:00
Andrew Trick
77532be5e0
LFTR should avoid a type mismatch with null pointer IVs.
...
Fixes rdar://10359193 Indvar LinearFunctionTestReplace assertion
llvm-svn: 143183
2011-10-28 03:45:11 +00:00
Eli Friedman
e6918ac01a
It is not safe to sink an alloca into a stacksave/stackrestore pair, so don't do that. <rdar://problem/10352360>
...
llvm-svn: 143093
2011-10-27 01:33:51 +00:00
Cameron Zwarich
2dd06afcf5
The element insertion code in scalar replacement doesn't handle incorrect
...
element types, even though the element extraction code does. It is surprising
that this bug has been here for so long. Fixes <rdar://problem/10318778>.
llvm-svn: 142740
2011-10-23 07:02:10 +00:00
Nick Lewycky
25e5f6896b
A non-escaping malloc in the entry block is not unlike an alloca. Do dead-store
...
elimination on them too.
llvm-svn: 142735
2011-10-22 21:59:35 +00:00
Devang Patel
f46908afb4
Initialze ScalarEvalution dependency.
...
Patch by Pranav Bhandarkar!
llvm-svn: 142556
2011-10-19 23:56:07 +00:00
Dan Gohman
5e2d8538d7
Teach the ARC optimizer about the !clang.arc.copy_on_escape metadata
...
tag on objc_retainBlock calls, which indicates that they may be
optimized away. rdar://10211286.
llvm-svn: 142298
2011-10-17 22:53:25 +00:00
Dan Gohman
13624a6c83
Suppress partial retain+release elimination when there's a
...
possibility that it will span multiple CFG diamonds/triangles which
could have different controlling predicates. rdar://10282956
llvm-svn: 142222
2011-10-17 18:48:25 +00:00
Bill Wendling
584c5f9c62
Correct over-zealous removal of hack.
...
Some code want to check that *any* call within a function has the 'returns
twice' attribute, not just that the current function has one.
llvm-svn: 142221
2011-10-17 18:43:40 +00:00
Bill Wendling
2ee7de36b8
Now that we have the ReturnsTwice function attribute, this method is
...
obsolete. Check the attribute instead.
<rdar://problem/8031714>
llvm-svn: 142212
2011-10-17 18:22:52 +00:00
Michael J. Spencer
7ce30d63fd
Fix CMake build.
...
llvm-svn: 142204
2011-10-17 17:50:39 +00:00
Devang Patel
8f9c569a13
svn mv Target/ARM/ARMGlobalMerge.cpp Transforms/Scalar/GlobalMerge.cpp
...
There is no reason to have simple IR level pass in lib/Target.
llvm-svn: 142200
2011-10-17 17:17:43 +00:00
Nick Lewycky
c8b7f776e6
When looking for dependencies on the src pointer, scan the src pointer. Scanning
...
on the memcpy call will pull up other unrelated stuff. Fixes PR11142.
llvm-svn: 142150
2011-10-16 20:13:32 +00:00
Duncan Sands
c4a6aaa716
Don't replace all dominated uses if there is only one use, since that
...
use can't be dominated, saving one domtree lookup.
llvm-svn: 142066
2011-10-15 11:13:42 +00:00
Andrew Trick
7cc89bde59
Fix indvars randomness by removing iteration over a map.
...
I rewrote the algorithm a while back so it doesn't require map lookup,
but neglected to change the data structure. This was caught by
llvm-gcc self host, not because there's anything special about
llvm-gcc, but because it is the only test for nondeterminism we
currently have. Unit tests don't work well for everything; we should
always try to have a nondeterminism stress test running.
Fixes PR11133: llvm-gcc self host .o mismatch after enable-iv-rewrite=false
llvm-svn: 142036
2011-10-15 01:38:14 +00:00
Eli Friedman
667bf19c57
Avoid undefined behavior in negation in LSR. Patch by Ahmed Charles.
...
Someone more familiar with LSR should double-check that the extra cast is actually doing the right thing in the overflow cases; I'm not completely confident that's that case.
llvm-svn: 141916
2011-10-13 23:48:33 +00:00
Eli Friedman
e702d68556
Enhance the memdep interface so that users can tell the difference between a dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases.
...
Patch by Xiaoyi Guo.
llvm-svn: 141896
2011-10-13 22:14:57 +00:00
Eli Friedman
22c39edd2e
Fix a couple hash functions so that they do not depend on undefined shifts. Based on patch by Ahmed Charles.
...
llvm-svn: 141820
2011-10-12 22:00:26 +00:00
Nick Lewycky
e7b3961fab
Add missing space.
...
llvm-svn: 141750
2011-10-12 00:14:31 +00:00
Cameron Zwarich
fac176ac51
Fix PR11106 by correcting a typo that has been in the code for over a year. This
...
would have never worked, since the element type of a vector type is never a
vector type. Also fix the conditional to be more direct in checking whether
EltTy is a vector type.
llvm-svn: 141713
2011-10-11 21:26:40 +00:00
Cameron Zwarich
a34d748f83
Remove a lot of the fancy scalar replacement code for dealing with llvm-gcc's
...
lowering of NEON code. It provides little-to-no benefit now and only introduces
additional complexity.
llvm-svn: 141646
2011-10-11 06:10:30 +00:00
Andrew Trick
23866a5e65
Add experimental -enable-lsr-phielim option.
...
I'm not sure we will need it in the long run, but the option is
currently useful for checking if the output of LSR is "clean".
llvm-svn: 141634
2011-10-11 02:30:45 +00:00
Andrew Trick
d36852e6b1
Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"
...
IVs.
Indvars previously chose randomly between congruent IVs. Now it will
bias the decision toward IVs that SCEVExpander likes to create. This
was not done to fix any problem, it's just a welcome side effect of
factoring code.
llvm-svn: 141633
2011-10-11 02:28:51 +00:00
Andrew Trick
75743b069e
LSR should only reuse phis that match its formula.
...
Fixes rdar://problem/5064068
llvm-svn: 141442
2011-10-07 23:46:21 +00:00