1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

2966 Commits

Author SHA1 Message Date
Dan Gohman
1e93b1c022 Override dominates and properlyDominates for SCEVAddRecExpr, as a
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
by all of its operands. This fixes an abort compiling 403.gcc.

llvm-svn: 96056
2010-02-13 00:19:39 +00:00
Dan Gohman
cdb2e784ff Fix a case of mismatched types in an Add that turned up in 447.dealII.
llvm-svn: 96007
2010-02-12 20:39:25 +00:00
Dan Gohman
c40eb525ad Reapply the new LoopStrengthReduction code, with compile time and
bug fixes, and with improved heuristics for analyzing foreign-loop
addrecs.

This change also flattens IVUsers, eliminating the stride-oriented
groupings, which makes it easier to work with.

llvm-svn: 95975
2010-02-12 10:34:29 +00:00
Dan Gohman
a18a12c897 Use an AssemblyAnnotatorWriter to clean up IVUsers' debug output.
The "uses=" comments are just clutter in this context.

llvm-svn: 95799
2010-02-10 20:42:37 +00:00
Dan Gohman
92b6122204 Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman
30a32bc593 Add const qualifiers.
llvm-svn: 95582
2010-02-08 22:00:06 +00:00
Devang Patel
102b8a3103 Set DW_AT_artificial only if argument is marked as artificial.
llvm-svn: 95461
2010-02-06 01:02:37 +00:00
Jakob Stoklund Olesen
039cd8ab3a Update CodeMetrics to count 'big' function calls explicitly.
llvm-svn: 95453
2010-02-05 23:21:18 +00:00
Dan Gohman
be6cf8cfb0 Change the argument to getIntegerSCEV to be an int64_t, rather
than int. This will make it more convenient for LSR, which does
a lot of things with int64_t offsets.

llvm-svn: 95281
2010-02-04 02:43:51 +00:00
Devang Patel
83d905f82b Provide interface to identifiy artificial methods.
llvm-svn: 95240
2010-02-03 19:57:19 +00:00
Dan Gohman
3343d0615b Various code simplifications.
llvm-svn: 95044
2010-02-02 01:38:49 +00:00
Bill Wendling
8a000012f2 Add "dump" method to IVUsersOneStride.
llvm-svn: 95022
2010-02-01 22:51:23 +00:00
Dan Gohman
0b2c2769ba Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.

llvm-svn: 94987
2010-02-01 18:27:38 +00:00
Devang Patel
c91ba40a59 Before inserting llvm.dbg.declare intrinsic at the end of a basic block, check whether the basic block has a terminator or not.
This API is used by clang and the test case is test/CodeGen/debug-info-crash.c in clang module.

llvm-svn: 94820
2010-01-29 18:30:57 +00:00
Duncan Sands
6f0edf859c It looks like the changes to the SRem logic of SimplifyDemandedUseBits
(fix for PR6165) are needed here too.

llvm-svn: 94801
2010-01-29 06:18:37 +00:00
Dan Gohman
25100f3a4e Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
rather than after.

llvm-svn: 94742
2010-01-28 06:32:46 +00:00
Dan Gohman
1eb6920a2f Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
use plain SCEVUnknowns with ConstantExpr::getSizeOf and
ConstantExpr::getOffsetOf constants. This eliminates a bunch of
special-case code.

Also add code for pattern-matching these expressions, for clients that
want to recognize them.

Move ScalarEvolution's logic for expanding array and vector sizeof
expressions into an element count times the element size, to expose
the multiplication to subsequent folding, into the regular constant
folder.

llvm-svn: 94737
2010-01-28 02:15:55 +00:00
Jakob Stoklund Olesen
5d298fdb4c Fix inline cost predictions with SCIENCE.
After running a batch of measurements, it is clear that the inliner metrics
need some adjustments:

Own argument bonus:       20 -> 5
Outgoing argument penalty: 0 -> 5
Alloca bonus:             10 -> 5
Constant instr bonus:      7 -> 5
Dead successor bonus:     40 -> 5*(avg instrs/block)

The new cost metrics are generaly 25 points higher than before, so we may need
to move thresholds.

With this change, InlineConstants::CallPenalty becomes a political correction:

if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction()))
  NumInsts += InlineConstants::CallPenalty + CS.arg_size();

The code size is accurately modelled by CS.arg_size(). CallPenalty is added
because calls tend to take a long time, so it may not be worth it to inline a
function with lots of calls.

All of the political corrections are in the InlineConstants namespace:
IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty,
NoreturnPenalty.

llvm-svn: 94615
2010-01-26 23:21:56 +00:00
Jakob Stoklund Olesen
1218f1331f Revert test polarity to match comment and desired outcome. Remove undeserved bonus.
A GEP with all constant indices is already considered free by
analyzeBasicBlock(), so don't give it an extra bonus in
CountCodeReductionForAlloca().

This patch should remove a small positive bias toward inlining functions with
variable-index GEPs, and remove a smaller negative bias from functions with
all-constant index GEPs.

llvm-svn: 94591
2010-01-26 21:31:35 +00:00
Jakob Stoklund Olesen
f4b32e1185 Remove dead code.
Functions containing indirectbr are marked NeverInline by analyzeBasicBlock(),
so there is no point in giving indirectbr special treatment in
CountCodeReductionForConstant. It is never called.

No functional change intended.

llvm-svn: 94590
2010-01-26 21:31:30 +00:00
Jakob Stoklund Olesen
509e8f1ec8 Skip calculation of ArgumentWeights if it will never be used.
Save a few bytes by allocating the correct size vector.

No functional change intended.

llvm-svn: 94589
2010-01-26 21:31:24 +00:00
Devang Patel
9e6549db1d Add extra element to composite type. This new element will be used to record c++ class that holds current class's vtable.
llvm-svn: 94586
2010-01-26 21:14:59 +00:00
Dan Gohman
4b3987001a Make the unsigned-range code more consistent with the signed-range code,
and clean up some loose ends.

llvm-svn: 94572
2010-01-26 19:19:05 +00:00
Dan Gohman
fd52a58a99 Fix a typo in a comment that Duncan noticed.
llvm-svn: 94562
2010-01-26 18:32:54 +00:00
Dan Gohman
783616ec9a Rename ItCount to BECount, since it holds a backedge-taken count rather
than an iteration count.

llvm-svn: 94549
2010-01-26 16:46:18 +00:00
Dan Gohman
5e06a05a16 Fix the the ceiling-division used in computing the MaxBECount so that it doesn't
have trouble with an intermediate add overflowing. Also, be more conservative
about the case where the induction variable in an SLT loop exit can step past
the RHS of the SLT and overflow in a single step.

Make getSignedRange more aggressive, to recover for some common cases which
the above fixes pessimized.

This addresses rdar://7561161.

llvm-svn: 94512
2010-01-26 04:40:18 +00:00
Victor Hernandez
648015f3a6 Assert when debug intrinsic insert functions are passed empty arguments
llvm-svn: 94491
2010-01-26 02:07:38 +00:00
Chris Lattner
5a57121631 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Devang Patel
280d341d36 Avoid using "Type" as the variable name.
llvm-svn: 94262
2010-01-23 00:26:28 +00:00
Victor Hernandez
f61bd354ef Make sure ValueFn starts off empty
llvm-svn: 94256
2010-01-23 00:03:28 +00:00
Chris Lattner
276811b58a Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner
2a96a8340e drop the pass name from the output.
llvm-svn: 94158
2010-01-22 05:52:51 +00:00
Chris Lattner
7ad458c173 eliminate dynamic_cast from this file.
llvm-svn: 94157
2010-01-22 05:46:59 +00:00
Chris Lattner
f683d7d909 eliminate a bunch more unneeded dynamic_cast's.
llvm-svn: 94156
2010-01-22 05:37:10 +00:00
Chris Lattner
1bd9c3ec88 eliminate a bunch of dynamic_cast's.
llvm-svn: 94155
2010-01-22 05:24:46 +00:00
Dan Gohman
7bd5379b8c When re-using an existing cast for a user, it's still necessary to call
rememberInstruction so that future users of that user will be inserted
in the correct position. This fixes the Darwin selfhost.

llvm-svn: 94070
2010-01-21 10:08:42 +00:00
Dan Gohman
be34c35f32 Re-implement the main strength-reduction portion of LoopStrengthReduction.
This new version is much more aggressive about doing "full" reduction in
cases where it reduces register pressure, and also more aggressive about
rewriting induction variables to count down (or up) to zero when doing so
reduces register pressure.

It currently uses fairly simplistic algorithms for finding reuse
opportunities, but it introduces a new framework allows it to combine
multiple strategies at once to form hybrid solutions, instead of doing
all full-reduction or all base+index.

llvm-svn: 94061
2010-01-21 02:09:26 +00:00
Chris Lattner
6e37641eca adopt getAdjustedAnalysisPointer in a few more passes.
llvm-svn: 94018
2010-01-20 20:09:02 +00:00
Chris Lattner
14e5ce0aa4 adopt getAdjustedAnalysisPointer in two more passes.
llvm-svn: 94017
2010-01-20 19:53:32 +00:00
Chris Lattner
eea6867290 adopt getAdjustedAnalysisPointer in BasicCallGraph.
llvm-svn: 94015
2010-01-20 19:51:46 +00:00
Chris Lattner
56e3aa006f add some new methods to adjust this pointers. Not used yet.
llvm-svn: 94013
2010-01-20 19:26:14 +00:00
Victor Hernandez
b8ad556b09 Avoid unnecessary Elts array
llvm-svn: 93978
2010-01-20 05:44:11 +00:00
Dan Gohman
2c72837459 Add a comment and tidy up some whitespace.
llvm-svn: 93932
2010-01-19 22:27:22 +00:00
Dan Gohman
ddb23efce9 Fix a typo and an 80-column violation in comments.
llvm-svn: 93931
2010-01-19 22:26:02 +00:00
Dan Gohman
273322a12b Give ScalarEvolution access to the DominatorTree. It'll need this
to make more intellegent AddRec folding decisions.

llvm-svn: 93930
2010-01-19 22:21:27 +00:00
Dan Gohman
71b2d12a48 Add a new helper function to IVUsers for returning the "canonical"
form of an expression. This is the expression without the
post-increment adjustment made, which is useful in determining
which registers will be used by the expansion.

llvm-svn: 93921
2010-01-19 21:55:32 +00:00
Victor Hernandez
afaac26fea Make findDbgDeclare/findDbgGlobalDeclare local static functions; avoid Elts array
llvm-svn: 93764
2010-01-18 20:42:09 +00:00
Tobias Grosser
4ce43821ee Create Generic DOTGraphTraits Printer/Viewer
Move the DOTGraphTraits dotty printer/viewer templates, that were developed for
the dominance tree into their own header file. This will allow reuse in future
passes.

llvm-svn: 93632
2010-01-16 10:56:41 +00:00
Devang Patel
3bbca51dcd Replace DebugLocTuple with DILocation.
llvm-svn: 93630
2010-01-16 06:09:35 +00:00
Victor Hernandez
c1b5223e76 Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
It also strips old llvm.dbg.declare intrinsics that did not pass metadata as the first argument.

llvm-svn: 93531
2010-01-15 19:04:09 +00:00
Victor Hernandez
97d7107d5e Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
llvm-svn: 93515
2010-01-15 17:36:47 +00:00
Victor Hernandez
aee71b4e81 Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.

llvm-svn: 93504
2010-01-15 03:37:48 +00:00
Eric Christopher
9230a37bb0 Pad my commit stats by reducing indentation in this now separate
commit.

llvm-svn: 93473
2010-01-14 23:00:10 +00:00
Eric Christopher
013342ad23 Few minor changes that were requested. No functional change.
llvm-svn: 93462
2010-01-14 21:48:00 +00:00
Evan Cheng
595cdb7091 Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.
llvm-svn: 93453
2010-01-14 21:04:31 +00:00
Eric Christopher
b2708c4ba1 Reduce the inlining cost of functions that contain calls to easily,
and frequently optimized functions.

llvm-svn: 93448
2010-01-14 20:12:34 +00:00
Victor Hernandez
832bd4fd2d Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

llvm-svn: 93149
2010-01-11 07:45:19 +00:00
Chris Lattner
953394de82 "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Dan Gohman
771144e807 Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.

llvm-svn: 93059
2010-01-09 18:17:45 +00:00
Chris Lattner
0dc48180de fix PR5978 by peeling the loop so that we avoid shifting the
result int by 8 for the first byte.  While normally harmless,
if the result is smaller than a byte, this shift is invalid.

llvm-svn: 93018
2010-01-08 19:02:23 +00:00
Chris Lattner
944f9c4ac1 teach ComputeNumSignBits to look through PHI nodes.
llvm-svn: 92964
2010-01-07 23:44:37 +00:00
Duncan Sands
4ef1119d94 Partially address a README by having functionattrs consider calls to
memcpy, memset and other intrinsics that only access their arguments
to be readnone if the intrinsic's arguments all point to local memory.
This improves the testcase in the README to readonly, but it could in
theory be made readnone, however this would involve more sophisticated
analysis that looks through the memcpy.

llvm-svn: 92829
2010-01-06 08:45:52 +00:00
Dan Gohman
b4e120e7a7 Restore dump() methods to Loop and MachineLoop.
llvm-svn: 92772
2010-01-05 21:08:02 +00:00
Benjamin Kramer
0ba7479f2c Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Benjamin Kramer
c233521d45 Convert a ton of simple integer type equality tests to the new predicate.
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
Devang Patel
3b08c33f33 Remove dead debug info intrinsics.
Intrinsic::dbg_stoppoint
 Intrinsic::dbg_region_start 
 Intrinsic::dbg_region_end 
 Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.

llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Chris Lattner
8a0648118b constant fold nasty constant expressions formed by llvm-gcc,
wrapping up PR3351.

llvm-svn: 92410
2010-01-02 01:22:23 +00:00
Chris Lattner
ecba817b0e fix Analysis/DebugInfo.h to not include Metadata.h. Do this
by moving one method out of line and eliminating redundant checks
from other methods.

llvm-svn: 92337
2009-12-31 03:02:08 +00:00
Chris Lattner
c12382b7c8 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner
9afb6e9c27 Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory.  This eliminates the operands
pointer and saves a new[] per node.

Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary.  A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related!  Debug info should use something non-mdnode for
declarations.

llvm-svn: 92321
2009-12-31 01:05:46 +00:00
Chris Lattner
d981b3fc91 remove a bunch of unneeded functions.
llvm-svn: 92263
2009-12-29 09:32:19 +00:00
Chris Lattner
430379c2d5 major cleanups, much of this file was incorrectly indented.
llvm-svn: 92262
2009-12-29 09:22:47 +00:00
Chris Lattner
f0034478f8 one pass of cleanup over DebugInfo.h. Much more is still needed.
llvm-svn: 92261
2009-12-29 09:15:46 +00:00
Chris Lattner
84e9de4a58 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

llvm-svn: 92259
2009-12-29 09:01:33 +00:00
Chris Lattner
9ec640a902 This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.

llvm-svn: 92235
2009-12-28 23:41:32 +00:00
Chris Lattner
cd3aa9d1ff rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
David Greene
c0eced92e3 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92086
2009-12-23 23:29:28 +00:00
David Greene
693db7a309 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92085
2009-12-23 23:27:15 +00:00
David Greene
0c06474821 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92081
2009-12-23 23:14:41 +00:00
David Greene
5980bb69ba Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92080
2009-12-23 23:09:39 +00:00
David Greene
b73d637eba Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92077
2009-12-23 23:00:50 +00:00
David Greene
f227aac0f4 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92076
2009-12-23 22:59:29 +00:00
David Greene
1b160211dd Remove dump routine and the associated Debug.h from a header. Patch up
other files to compensate.

llvm-svn: 92075
2009-12-23 22:58:38 +00:00
David Greene
dafe3d88d6 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92073
2009-12-23 22:49:57 +00:00
David Greene
02480b7d83 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92071
2009-12-23 22:35:10 +00:00
David Greene
b348240e9c Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92068
2009-12-23 22:28:01 +00:00
David Greene
62d4863b56 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92067
2009-12-23 22:18:14 +00:00
David Greene
f2377def25 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92066
2009-12-23 22:10:20 +00:00
David Greene
fc8ae247eb Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92063
2009-12-23 21:58:29 +00:00
David Greene
4caa552456 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92060
2009-12-23 21:48:18 +00:00
David Greene
c8b577197f Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92050
2009-12-23 21:27:29 +00:00
David Greene
fd7042fa79 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92048
2009-12-23 21:16:54 +00:00
David Greene
28b8bcd98d Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92046
2009-12-23 21:06:14 +00:00
David Greene
33f717c804 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92042
2009-12-23 20:52:41 +00:00
David Greene
016e0af68d Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92040
2009-12-23 20:43:58 +00:00
David Greene
1c88ae8f15 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92039
2009-12-23 20:34:27 +00:00
David Greene
e34eb9cc32 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92037
2009-12-23 20:20:46 +00:00
David Greene
a2539e0ff7 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92035
2009-12-23 20:10:59 +00:00
David Greene
2a072c7ac5 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92034
2009-12-23 20:03:58 +00:00
David Greene
218c909299 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92033
2009-12-23 19:51:44 +00:00