Devang Patel
b63c74730c
Let AnalyzeAlloca() remove debug intrinsics.
...
llvm-svn: 59454
2008-11-17 18:37:53 +00:00
Torok Edwin
026259faeb
If SI->size() is 0, we are not allowed to dereference ->begin().
...
This fixed PR3078.
llvm-svn: 59416
2008-11-16 17:21:25 +00:00
Chris Lattner
7917b43a28
eliminate some std::set's.
...
llvm-svn: 59409
2008-11-16 07:17:51 +00:00
Chris Lattner
f8f6270f14
simplify loop
...
llvm-svn: 59406
2008-11-16 06:35:18 +00:00
Chris Lattner
44152742a0
simplify a bunch more instcombines to use m_Specific etc.
...
llvm-svn: 59403
2008-11-16 05:38:51 +00:00
Chris Lattner
d397fef50d
factor the code for simplifying (icmp)|(icmp) into its own function.
...
llvm-svn: 59402
2008-11-16 05:20:07 +00:00
Chris Lattner
909b969b18
do some computation with apints instead of ConstantInts.
...
llvm-svn: 59401
2008-11-16 05:14:43 +00:00
Chris Lattner
feaea9bdf7
merge a check into a place where it is simpler.
...
llvm-svn: 59400
2008-11-16 05:10:52 +00:00
Chris Lattner
269cbd5770
factor a whole bunch of code out into a helper function.
...
llvm-svn: 59398
2008-11-16 05:06:21 +00:00
Chris Lattner
b37b6e7e96
simplify the conditions on two gigantic if's, decreasing indentation
...
a bit. Next step is to factor out into their own helper functions.
llvm-svn: 59397
2008-11-16 04:55:20 +00:00
Chris Lattner
f1be285134
simplify some instcombine matches by using m_Specific
...
llvm-svn: 59395
2008-11-16 04:46:19 +00:00
Chris Lattner
fae5e33111
Use new m_SelectCst template to eliminate macros.
...
llvm-svn: 59392
2008-11-16 04:33:38 +00:00
Chris Lattner
569d78cbb5
simplify code.
...
llvm-svn: 59390
2008-11-16 04:26:55 +00:00
Chris Lattner
c3f3b059d0
Handle the case where there is no "not". It is possible it got
...
folded into the select.
llvm-svn: 59389
2008-11-16 04:25:26 +00:00
Chris Lattner
5f6d9a313b
factor a bunch of copy/paste code out into a helper function.
...
Eliminate the cases checking for cond?0:-1, since that is already
handled by commutative checking.
llvm-svn: 59388
2008-11-16 04:24:12 +00:00
Chris Lattner
68d2da2a19
rearrange some code, no functionality change.
...
llvm-svn: 59381
2008-11-16 03:56:24 +00:00
Chris Lattner
e02c7c7ad2
if we're going to use a macro, use it maximally. no functionality change.
...
llvm-svn: 59380
2008-11-16 03:54:57 +00:00
Devang Patel
8ada1d5de5
Refactor code.
...
Strip debug information before stripping symbol names.
llvm-svn: 59328
2008-11-14 22:49:37 +00:00
Devang Patel
3dd51c5c62
Really remove all debug information.
...
llvm-svn: 59208
2008-11-13 01:28:40 +00:00
Oscar Fuentes
1b504d5372
CMake: Remove removed source file.
...
llvm-svn: 59098
2008-11-12 00:14:12 +00:00
Devang Patel
4f02a0b740
Remove
...
llvm-svn: 59093
2008-11-11 23:58:15 +00:00
Devang Patel
bf0835706c
Undo previous check-in.
...
llvm-svn: 59092
2008-11-11 23:57:33 +00:00
Oscar Fuentes
2353ef3e91
CMake: Updated list of source files for lib/Transforms/Utils.
...
llvm-svn: 59077
2008-11-11 19:51:36 +00:00
Devang Patel
6096f26bd4
Add utility pass to remove dbg info.
...
llvm-svn: 59068
2008-11-11 19:33:39 +00:00
Devang Patel
95b18126ee
Use actual function name in comments.
...
llvm-svn: 59063
2008-11-11 19:16:41 +00:00
Cedric Venet
8cb2e28e43
Update CMakeLists.txt
...
llvm-svn: 59039
2008-11-11 09:55:48 +00:00
Devang Patel
53b39b5467
Cleanup debug info. assocated with deleted instructions.
...
llvm-svn: 59012
2008-11-11 00:54:10 +00:00
Devang Patel
dc6699e82f
Add utility routines to remove dead debug info.
...
llvm-svn: 59011
2008-11-11 00:53:02 +00:00
Devang Patel
d0ce981372
If the sign of exit condition and split condition does not match
...
then do not split loop index.
llvm-svn: 58995
2008-11-10 19:48:34 +00:00
Bill Wendling
7ef7314d1a
Third time's a charm.
...
The previous patches didn't match correctly. Also, we need to make sure that
the conditional is the same before doing the transformation.
llvm-svn: 58978
2008-11-10 06:59:06 +00:00
Mon P Wang
25f0106fd9
Added support for the following definition of shufflevector
...
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask>
llvm-svn: 58964
2008-11-10 04:46:22 +00:00
Bill Wendling
4fb13c051d
Correction for the last patch. Should match the conditional in the first part
...
of the select match, not the select instruction itself.
llvm-svn: 58947
2008-11-09 23:37:53 +00:00
Bill Wendling
1579287550
The method of doing the matching with a 'select' instruction was wrong. The
...
original code was matching like this:
if (match(A, m_Not(m_Value(B))))
B was already matched as a 'select' instruction. However, this isn't matching
what we think it's matching. It would match B as a 'Value', so basically
anything would match to it. In this case, a Constant matched. B was replaced
with a constant representation. And then the wrong value would be used in the
SelectInst::Create statement, causing a crash.
After thinking on this for a moment, and after Nick L. told me how the pattern
matching stuff was supposed to work, the solution was to match NOT an m_Value,
but an m_Select.
llvm-svn: 58946
2008-11-09 23:17:42 +00:00
Nuno Lopes
2e42927e7c
fix leakage of ValueNumbering
...
llvm-svn: 58933
2008-11-09 12:45:23 +00:00
Bill Wendling
3f547be28f
If the LHS of the FCMP is coming from a UIToFP instruction, then we don't want
...
to generate signed ICMP instructions to replace the FCMP. This would violate
the following:
define i1 @test1(i32 %val) {
%1 = uitofp i32 %val to double
%2 = fcmp ole double %1, 0.000000e+00
ret i1 %2
}
would be transformed into:
define i1 @test1(i32 %val) {
%1 = icmp slt i33 %val, 1
ret i1 %1
}
which is obviously wrong. This patch modifes InstCombiner::FoldFCmp_IntToFP_Cst
to handle when the LHS comes from UIToFP.
llvm-svn: 58929
2008-11-09 04:26:50 +00:00
Daniel Dunbar
2b9dce2669
Rework r58829, allowing removal of dbg info intrinsics during alloca
...
promotion.
- Eliminate uses after free and simplify tests.
Devang: Please check that this is still doing what you intended.
llvm-svn: 58887
2008-11-08 04:12:17 +00:00
Bill Wendling
b9656df4ac
BCUI + 1 doesn't work. Use next instead.
...
llvm-svn: 58830
2008-11-07 01:59:41 +00:00
Devang Patel
b8e0d59ceb
Handle (delete) dbg intrinsics while promoting alloca.
...
llvm-svn: 58826
2008-11-07 01:30:07 +00:00
Mon P Wang
5ca2ec65bd
Fixed scalarizing an extract subvector and prevent an infinite loop
...
when simplify a vector.
llvm-svn: 58820
2008-11-06 22:52:21 +00:00
Devang Patel
5a5ab730e0
InstructionNamer preserves everything.
...
llvm-svn: 58787
2008-11-06 01:00:16 +00:00
Devang Patel
f0ef35738c
Do now allow InlineAlways pass to remove dead functions.
...
llvm-svn: 58744
2008-11-05 01:39:16 +00:00
Devang Patel
7a848b0ee3
Check Attribute::NoInline.
...
llvm-svn: 58742
2008-11-05 01:37:05 +00:00
Oscar Fuentes
076e048cf7
CMake: updated list of source files.
...
llvm-svn: 58736
2008-11-05 00:11:22 +00:00
Dan Gohman
8cdea717a3
Add a new pass to simplify specific half_powr function calls. This is
...
a specialized pass that it not likely to be generally useful.
llvm-svn: 58732
2008-11-04 23:41:45 +00:00
Dale Johannesen
0a7b4f5800
Allow SROA of vectors. Removing this caused a
...
huge performance regression in something we care
about. This may not be final fix.
llvm-svn: 58718
2008-11-04 20:54:03 +00:00
Devang Patel
f33f8a8606
Fix unused variable warnings.
...
llvm-svn: 58651
2008-11-03 23:14:09 +00:00
Devang Patel
fe57d109b6
Ignore conditions that are outside the loop.
...
llvm-svn: 58631
2008-11-03 19:38:07 +00:00
Andrew Lenharth
348f3fa6a7
add a period at the end of the comment, ignoring the fact that the comment would be hard pressed to be considered a sentence, but if it makes Bill happy...
...
llvm-svn: 58630
2008-11-03 19:29:29 +00:00
Devang Patel
c1631db93b
Turn floating point IVs into integer IVs where possible.
...
This allows SCEV users to effectively calculate trip count.
LSR later on transforms back integer IVs to floating point IVs
later on to avoid int-to-float casts inside the loop.
llvm-svn: 58625
2008-11-03 18:32:19 +00:00
Andrew Lenharth
45b86322f2
Ensure that we are checking only calls to the function we are interested in specializing
...
llvm-svn: 58615
2008-11-03 16:05:35 +00:00
Nick Lewycky
d73806a9cc
Replace explicit loop with utility function.
...
llvm-svn: 58593
2008-11-03 03:49:14 +00:00
Nick Lewycky
3c6d34a7f0
Changes from Duncan's review:
...
* merge two weak functions by making them both alias a third non-weak fn
* don't reimplement CallSite::hasArgument
* whitelist the safe linkage types
llvm-svn: 58568
2008-11-02 16:46:26 +00:00
Duncan Sands
cede1e035c
Get this building on 64 bit machines (error:
...
cast from ‘const llvm::PointerType*’ to ‘unsigned int’
loses precision).
llvm-svn: 58561
2008-11-02 09:00:33 +00:00
Oscar Fuentes
0433be6feb
CMake: added a source file.
...
llvm-svn: 58559
2008-11-02 06:01:39 +00:00
Nick Lewycky
d01d42e76c
Add a new MergeFunctions pass. It finds identical functions and merges them.
...
This triggers only 60 times in llvm-test (look at .llvm.bc, not .linked.rbc)
and so it probably wont be turned on by default. Also, may of those are likely
to go away when PR2973 is fixed.
llvm-svn: 58557
2008-11-02 05:52:50 +00:00
Nick Lewycky
8d8acf327b
Fix demanded bits analysis with srem by negative number. Based on a patch
...
by Richard Osborne.
llvm-svn: 58555
2008-11-02 02:41:50 +00:00
Dan Gohman
83eea0b17f
Fix this recently moved code to use the correct type. CI is now a
...
ConstantInt, and SI is the original cast instruction. This fixes
PR2996.
llvm-svn: 58549
2008-11-02 00:17:33 +00:00
Daniel Dunbar
a1c4fcfc29
Fix warning.
...
llvm-svn: 58486
2008-10-31 01:50:01 +00:00
Dan Gohman
13cbcf1c18
Canonicalize sext(i1) to i1?-1:0, and update various instcombine
...
optimizations accordingly.
llvm-svn: 58457
2008-10-30 20:40:10 +00:00
Daniel Dunbar
3933e66a89
Add InlineCost class for represent the estimated cost of inlining a
...
function.
- This explicitly models the costs for functions which should
"always" or "never" be inlined. This fixes bugs where such costs
were not previously respected.
llvm-svn: 58450
2008-10-30 19:26:59 +00:00
Chris Lattner
0934c0f35b
Fix PR2967 by not deleting volatile load/stores that occur before unreachable.
...
I don't really see this as being needed, but there is little harm from doing
it.
llvm-svn: 58385
2008-10-29 17:46:26 +00:00
Daniel Dunbar
e7fbf9f425
Factor shouldInline method out of Inliner.
...
- No functionality change.
llvm-svn: 58355
2008-10-29 01:02:02 +00:00
Daniel Dunbar
cc20455346
Assorted comment/naming fixes, 80-col violations, and reindentation.
...
- No functionality change.
llvm-svn: 58352
2008-10-28 23:24:26 +00:00
Dan Gohman
2c34c130bf
(A & sext(C)) | (B & ~sext(C) -> C ? A : B
...
llvm-svn: 58351
2008-10-28 22:38:57 +00:00
Torok Edwin
ca97b42ef7
export an ID for the instructionNamer, allowing analysis/transformation passes
...
that need it to require it by ID.
llvm-svn: 58238
2008-10-27 10:16:27 +00:00
Chris Lattner
59b5691388
Rewrite all the 'PromoteLocallyUsedAlloca[s]' logic. With the power of
...
LargeBlockInfo, we can now dramatically simplify their implementation
and speed them up at the same time. Now the code has time proportional
to the number of uses of the alloca, not the size of the block.
This also eliminates code that tried to batch up different allocas which
are used in the same blocks, and eliminates the 'retry list' logic which
was baroque and no unneccesary. In addition to being a speedup for crazy
cases, this is also a nice cleanup:
PromoteMemoryToRegister.cpp | 270 +++++++++++++++-----------------------------
1 file changed, 96 insertions(+), 174 deletions(-)
llvm-svn: 58229
2008-10-27 07:05:53 +00:00
Chris Lattner
f594ecc453
Add a new LargeBlockInfo helper, which is just a wrapper around
...
a trivial dense map. Use this in RewriteSingleStoreAlloca to
avoid aggressively rescanning blocks over and over again. This
fixes PR2925, speeding up mem2reg on the testcase in that bug
from 4.56s to 0.02s in a debug build on my machine.
llvm-svn: 58227
2008-10-27 06:05:26 +00:00
Nick Lewycky
f6e4dca67e
Add value range analyzing of Add and Sub.
...
Understand that mul %x, 1 = %x.
llvm-svn: 58069
2008-10-24 04:00:26 +00:00
Daniel Dunbar
7f39e2d85a
Change create*Pass factory functions to return Pass* instead of
...
LoopPass*.
- Although less precise, this means they can be used in clients
without RTTI (who would otherwise need to include LoopPass.h, which
eventually includes things using dynamic_cast). This was the
simplest solution that presented itself, but I am happy to use a
better one if available.
llvm-svn: 58010
2008-10-22 23:32:42 +00:00
Dan Gohman
72e66eedb8
Use Function::getEntryBlock() instead of Function::front(), for clarity.
...
llvm-svn: 57870
2008-10-21 03:10:28 +00:00
Dan Gohman
fa29b67aee
Fix a bug that prevented llvm-extract -delete from working.
...
llvm-svn: 57864
2008-10-21 01:08:07 +00:00
Dan Gohman
215742a966
Use 0 instead of false to return a null pointer.
...
llvm-svn: 57660
2008-10-17 00:56:52 +00:00
Dan Gohman
bc0278400c
Teach instcombine's visitLoad to scan back several instructions
...
to find opportunities for store-to-load forwarding or load CSE,
in the same way that visitStore scans back to do DSE. Also, define
a new helper function for testing whether the addresses of two
memory accesses are known to have the same value, and use it in
both visitStore and visitLoad.
These two changes allow instcombine to eliminate loads in code
produced by front-ends that frequently emit obviously redundant
addressing for memory references.
llvm-svn: 57608
2008-10-15 23:19:35 +00:00
Evan Cheng
d885f6e139
Combine (fcmp cc0 x, y) | (fcmp cc1 x, y) into a single fcmp when possible.
...
llvm-svn: 57515
2008-10-14 18:44:08 +00:00
Evan Cheng
ce70752b11
- Somehow I forgot about one / une.
...
- Renumber fcmp predicates to match their icmp counterparts.
- Try swapping operands to expose more optimization opportunities.
llvm-svn: 57513
2008-10-14 18:13:38 +00:00
Evan Cheng
67786cce66
Optimize anding of two fcmp into a single fcmp if the operands are the same. e.g. uno && ueq -> ueq
...
ord && olt -> olt
ord && ueq -> oeq
llvm-svn: 57507
2008-10-14 17:15:11 +00:00
Matthijs Kooijman
f7d3cb5435
Make InstructionCombining::getBitCastOperand() recognize GEP instructions and
...
constant expression with all zero indices as being the same as a bitcast.
llvm-svn: 57442
2008-10-13 15:17:01 +00:00
Chris Lattner
da435910e8
Fix PR2697 by rewriting the '(X / pos) op neg' logic. This also changes
...
a couple other cases for clarity, but shouldn't affect correctness.
Patch by Eli Friedman!
llvm-svn: 57387
2008-10-11 22:55:00 +00:00
Devang Patel
647a1e532b
Check loop exit predicate properly while eliminating one iteration loop.
...
This patch fixes PR 2869
llvm-svn: 57369
2008-10-10 22:02:57 +00:00
Nuno Lopes
e3127f3f80
fix memleak by cleaning the global sets on pass exit
...
llvm-svn: 57353
2008-10-10 16:25:50 +00:00
Dale Johannesen
4f0bd68cfe
Add a "loses information" return value to APFloat::convert
...
and APFloat::convertToInteger. Restore return value to
IEEE754. Adjust all users accordingly.
llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Nick Lewycky
03c5fa18f1
Don't drop alignment on globals when cloning.
...
llvm-svn: 57320
2008-10-09 06:27:14 +00:00
Nuno Lopes
06c67f88d7
dont specialize weak functions and the like
...
llvm-svn: 57305
2008-10-08 18:45:59 +00:00
Duncan Sands
26ff6f9c54
Add <cstdio> include where needed by gcc-4.4.
...
Patch by Samuel Tardieu.
llvm-svn: 57291
2008-10-08 07:23:46 +00:00
Chris Lattner
42d5785dbd
Add parentheses to avoid warnings in GCC 4.4.0,
...
patch by Samuel Tardieu!
llvm-svn: 57288
2008-10-08 06:42:28 +00:00
Andrew Lenharth
5aa1cc4065
Correctly set attributes when removing args during cloning. Fixes PR2765
...
llvm-svn: 57254
2008-10-07 18:08:38 +00:00
Devang Patel
40aafce00d
Fix typo, fix PR 2865.
...
llvm-svn: 57221
2008-10-06 23:22:54 +00:00
Matthijs Kooijman
cbe5e16eb5
Allow scalarrepl to treat an all-zero GEP just as bitcast.
...
This includes not marking a GEP involving a vector as unsafe, but only when it
has all zero indices. This allows scalarrepl to work in a few more cases.
llvm-svn: 57177
2008-10-06 16:23:31 +00:00
Chris Lattner
917a6c1343
rewrite bswap matching to be more general, allowing arbitrary
...
shifting and masking inside a bswap expr. This allows it to handle
the cases from PR2842, which involve the intermediate 'or'
expressions being shifted, not just the input value.
llvm-svn: 57095
2008-10-05 02:13:19 +00:00
Chris Lattner
ca91f265c4
fix a bug where the bswap matcher could match a case involving
...
ashr. It should only apply to lshr.
llvm-svn: 57089
2008-10-05 00:50:57 +00:00
Duncan Sands
1d35e9aebe
Ignore loads from and stores to local memory (i.e. allocas)
...
when deciding whether to mark a function readnone/readonly.
Since the pass is currently run before SROA, this may be
quite helpful. Requested by Chris on IRC.
llvm-svn: 57050
2008-10-04 13:24:24 +00:00
Dan Gohman
e21903987f
Clean up some multiple-return-value code that is no longer
...
applicable.
llvm-svn: 57033
2008-10-03 22:21:24 +00:00
Devang Patel
f963403b58
Nick Lewycky's patch.
...
While hosting instruction check PHI node.
llvm-svn: 57025
2008-10-03 18:57:37 +00:00
Duncan Sands
3a813a5d3f
Teach internalize to preserve the callgraph.
...
Why? Because it was there!
llvm-svn: 56996
2008-10-03 07:36:09 +00:00
Owen Anderson
cb4f156b6b
SplitBlock should only attempt to update LoopInfo if it is actually being used.
...
llvm-svn: 56994
2008-10-03 06:55:35 +00:00
Duncan Sands
d65a4daeea
Factorize code: remove variants of "strip off
...
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject. The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.
llvm-svn: 56922
2008-10-01 15:25:41 +00:00
Nuno Lopes
96740aad86
revert the addition of Preverves(CallGraph), per Duncan's comments
...
llvm-svn: 56917
2008-10-01 09:13:40 +00:00
Dan Gohman
67d90de2b0
Call ScalarEvolution's deleteValueFromRecords before deleting an
...
instruction, not after. This fixes some uses of free'd memory.
llvm-svn: 56908
2008-10-01 02:02:03 +00:00
Nuno Lopes
5093ab4c76
add preserversCFG() + preservers(CallGraph)
...
llvm-svn: 56887
2008-09-30 22:04:30 +00:00
Nuno Lopes
2bd7b24f1a
add AU.setPreservesCFG() since this pass only adds and removes function attributes
...
llvm-svn: 56868
2008-09-30 18:34:38 +00:00
Nick Lewycky
e8ced3ec19
Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2))
...
llvm-svn: 56834
2008-09-30 06:08:34 +00:00
Duncan Sands
57512a1be4
Speed up these passes when the callgraph has
...
huge simply connected components. Suggested
by Chris.
llvm-svn: 56787
2008-09-29 14:59:04 +00:00
Nuno Lopes
ffc9da6772
remove redundant test (mayBeOverriden() includes hasLinkOnceLinkage)
...
llvm-svn: 56786
2008-09-29 14:40:32 +00:00
Duncan Sands
e340e18783
Tweak some comments.
...
llvm-svn: 56784
2008-09-29 13:35:31 +00:00
Duncan Sands
08d91178e9
Rename isWeakForLinker to mayBeOverridden. Use it
...
instead of hasWeakLinkage in a bunch of optimization
passes.
llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Devang Patel
9eb525d4f9
Implement function notes as function attributes.
...
llvm-svn: 56716
2008-09-26 23:51:19 +00:00
Devang Patel
a05633e105
Now Attributes are divided in three groups
...
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn
Return attributes use 0 as the index.
Function attributes use ~0U as the index.
This patch requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56704
2008-09-26 22:53:05 +00:00
Devang Patel
4c758ea3e0
Large mechanical patch.
...
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Evan Cheng
25dd4a2daf
Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.
...
llvm-svn: 56549
2008-09-24 06:48:55 +00:00
Eric Christopher
c1ea149dcd
Fix fallout in CodeGenPrepare from 56526. Will likely need more work.
...
llvm-svn: 56546
2008-09-24 05:32:41 +00:00
Devang Patel
6402c7236f
s/ParamAttrsWithIndex/FnAttributeWithIndex/g
...
llvm-svn: 56535
2008-09-24 00:55:02 +00:00
Devang Patel
e15607b7bb
Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
...
llvm-svn: 56527
2008-09-24 00:06:15 +00:00
Devang Patel
e87abd26ba
Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
...
Do not check isDeclaration() in hasNote(). It is clients' responsibility.
llvm-svn: 56524
2008-09-23 23:52:03 +00:00
Devang Patel
ba3fa6c6e1
s/ParameterAttributes/Attributes/g
...
llvm-svn: 56513
2008-09-23 23:03:40 +00:00
Devang Patel
82fed6702b
Use parameter attribute store (soon to be renamed) for
...
Function Notes also. Function notes are stored at index ~0.
llvm-svn: 56511
2008-09-23 22:35:17 +00:00
Devang Patel
329fe728b5
Add hasNote() to check note associated with a function.
...
llvm-svn: 56477
2008-09-22 22:32:29 +00:00
Oscar Fuentes
a229b3c9a7
Initial support for the CMake build system.
...
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Duncan Sands
e1dc84be64
Implement review feedback from Devang: make use
...
of mayReadFromMemory and mayWriteToMemory.
llvm-svn: 56387
2008-09-20 16:45:58 +00:00
Duncan Sands
310077034a
Remove the MarkModRef pass (use AddReadAttrs instead).
...
Unfortunately this means removing one regression test
of GlobalsModRef because I couldn't work out how to
perform it without MarkModRef.
llvm-svn: 56342
2008-09-19 08:23:44 +00:00
Duncan Sands
af25ee7ffc
Add a new pass AddReadAttrs which works out which functions
...
can get the readnone/readonly attributes, and gives them it.
The plan is to remove markmodref (which did the same thing
by querying GlobalsModRef) and delete the analogous
functionality from GlobalsModRef.
llvm-svn: 56341
2008-09-19 08:17:05 +00:00
Devang Patel
c25be3b2de
splitLoop does not handle split condition EQ.
...
Fixes PR 2805
llvm-svn: 56321
2008-09-18 23:45:14 +00:00
Bill Wendling
a00fa322b1
Decrementing the iterator here could be wrong if the worklist is empty after the "erase".
...
Thanks to Ji Young Park for the patch!
llvm-svn: 56316
2008-09-18 23:04:18 +00:00
Devang Patel
76b22c1420
Try to place hoisted instructions befoe icmp instruction.
...
llvm-svn: 56315
2008-09-18 22:50:42 +00:00
Devang Patel
7f9671ba37
Do not hoist instruction above branch condition. The instruction may use branch condition.
...
llvm-svn: 56286
2008-09-17 18:21:49 +00:00
Devang Patel
dca8d3b183
Do not ignore iv uses outside the loop.
...
This one slipped through cracks very well.
llvm-svn: 56284
2008-09-17 17:53:47 +00:00
Dan Gohman
dafa9c6e85
Improve instcombine's handling of integer min and max in two ways:
...
- Recognize expressions like "x > -1 ? x : 0" as min/max and turn them
into expressions like "x < 0 ? 0 : x", which is easily recognizable
as a min/max operation.
- Refrain from folding expression like "y/2 < 1" to "y < 2" when the
comparison is being used as part of a min or max idiom, like
"y/2 < 1 ? 1 : y/2". In that case, the division has another use, so
folding doesn't eliminate it, and obfuscates the min/max, making it
harder to recognize as a min/max operation.
These benefit ScalarEvolution, CodeGen, and anything else that wants to
recognize integer min and max.
llvm-svn: 56246
2008-09-16 18:46:06 +00:00
Dan Gohman
68e7735a38
Teach LSR to optimize away SMAX operations for tripcounts in common
...
cases. See the comment above OptimizeSMax for the full story, and
the testcase for an example. This cancels out a pessimization
commonly attributed to indvars, and will allow us to lift some of
the artificial throttles in indvars, rather than add new ones.
llvm-svn: 56230
2008-09-15 21:22:06 +00:00
Dan Gohman
eff71f2953
On 64-bit targets, change 32-bit getelementptr indices to be 64-bit
...
getelementptr indices, inserting an explicit cast if necessary.
This helps expose the sign-extension operation to other optimizations.
llvm-svn: 56133
2008-09-11 23:06:38 +00:00
Dan Gohman
7d01c0654c
Fix a vectorshuffle instcombine bug introduced by r55995.
...
Patch by Nicolas Capens!
llvm-svn: 56129
2008-09-11 22:47:57 +00:00
Dan Gohman
9b9d547a5c
Fix a copy+paste bug that Duncan spotted. For several
...
cases it was still getting lucky and detecting overflow
but it was clearly incorrect.
llvm-svn: 56113
2008-09-11 18:53:02 +00:00
Dan Gohman
9d9a4be588
In my analysis for r56076 I missed the case where the original
...
multiplication overflows.
llvm-svn: 56082
2008-09-11 00:25:00 +00:00
Dan Gohman
c1ae01688f
Fix an icmp+sdiv optimization to check for and handle an overflow
...
condition. This fixes PR2740.
llvm-svn: 56076
2008-09-10 23:30:57 +00:00
Devang Patel
728c44ab56
fix white spaces.
...
llvm-svn: 56056
2008-09-10 14:49:55 +00:00
Dan Gohman
97f0a0f28d
Fix a warning about comparing signed and unsigned values.
...
llvm-svn: 56040
2008-09-10 01:09:32 +00:00
Devang Patel
92b032f3e6
if loop induction variable is always sign or zero extended then
...
extend the type of induction variable.
llvm-svn: 56017
2008-09-09 21:41:07 +00:00
Devang Patel
92c5367705
fix overflow check.
...
llvm-svn: 56011
2008-09-09 20:54:34 +00:00
Anton Korobeynikov
1a1140429e
Make safer variant of alias resolution routine to be default
...
llvm-svn: 56005
2008-09-09 20:05:04 +00:00
Anton Korobeynikov
a9b60ee0fc
Resolve aliases, when possible
...
llvm-svn: 56001
2008-09-09 19:04:59 +00:00
Dan Gohman
86fb5b48de
Make SimplifyDemandedVectorElts simplify vectors with multiple
...
users, and teach it about shufflevector instructions.
Also, fix a subtle bug in SimplifyDemandedVectorElts'
insertelement code.
This is a patch that was originally written by Eli Friedman,
with some fixes and cleanup by me.
llvm-svn: 55995
2008-09-09 18:11:14 +00:00
Devang Patel
0f7a3507cf
Fix simplifycfg crash in handing block merge.
...
llvm-svn: 55971
2008-09-09 01:06:56 +00:00
Devang Patel
3d56051f70
s/RemoveUnreachableBlocks/RemoveUnreachableBlocksFromFn/g
...
llvm-svn: 55965
2008-09-08 22:14:17 +00:00
Devang Patel
7518f250b9
Remove unused counter.
...
llvm-svn: 55924
2008-09-08 17:14:54 +00:00
Devang Patel
538a7f479a
Remove OptimizeIVType()
...
llvm-svn: 55913
2008-09-08 16:13:27 +00:00
Duncan Sands
b9a6f861b4
Update the callgraph correctly.
...
llvm-svn: 55896
2008-09-08 11:08:09 +00:00
Duncan Sands
3cf7d86556
Update the callgraph correctly in ArgumentPromotion.
...
llvm-svn: 55895
2008-09-08 11:07:35 +00:00
Duncan Sands
46911f1271
Reapply 55859. This doesn't change anything as
...
long as the callgraph is correct. It checks
for wrong callgraphs more strictly.
llvm-svn: 55894
2008-09-08 11:05:51 +00:00
Duncan Sands
1ea0d2e6db
Correct a comment and strip trailing whitespace.
...
llvm-svn: 55883
2008-09-07 09:54:09 +00:00
Nuno Lopes
421f488cb7
fix crash when the malloc/free function is defined or is a declaration with 0 parameters.
...
this pass doesnt seem to be used, but still it's now a little more correct
llvm-svn: 55873
2008-09-06 17:44:06 +00:00
Duncan Sands
95c2a7848a
When PruneEH turned an invoke into an ordinary
...
call (thus changing the call site) it didn't
inform the callgraph about this. But the
call site does matter - as shown by the testcase,
the callgraph become invalid after the inliner
ran (with an edge between two functions simply
missing), resulting in wrong deductions by
GlobalsModRef.
llvm-svn: 55872
2008-09-06 17:19:29 +00:00
Owen Anderson
1dd2e40521
Revert r55859. This is breaking the build in the abscence of its companion commit.
...
llvm-svn: 55865
2008-09-05 23:36:01 +00:00