Commit Graph

2927 Commits

Author SHA1 Message Date
Dan Gohman c70e994364 Fix SCEVExpander's existing PHI reuse checking to recognize the
case where there are loop-invariant instructions somehow left
inside the loop, and in a position where they won't dominate
the IV increment position.

llvm-svn: 96448
2010-02-17 02:39:31 +00:00
Dan Gohman cf39be32bf Fold bswap(undef) to undef.
llvm-svn: 96432
2010-02-17 00:54:58 +00:00
Devang Patel 7c7cfbbc38 Use line and column number to distinguish two lexical blocks at the same level.
llvm-svn: 96395
2010-02-16 21:39:34 +00:00
Bob Wilson 92cdb6eec5 Split critical edges as needed for load PRE.
llvm-svn: 96378
2010-02-16 19:51:59 +00:00
Duncan Sands 19d0b47b1f There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Dan Gohman 148a972b67 When reusing an existing PHI node in a loop, be even more
strict about the requirements.

llvm-svn: 96301
2010-02-16 00:20:08 +00:00
Duncan Sands 9dff9bec31 Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Dan Gohman fefbff9cd8 When testing whether a given SCEV depends on a temporary symbolic
name, test whether the SCEV itself is that temporary symbolic name,
in addition to checking whether the symbolic name appears as a
possibly-indirect operand.

llvm-svn: 96216
2010-02-15 10:28:37 +00:00
Dan Gohman 4d8feb11dd When restoring a saved insert location, check to see if the saved
insert location has become an "inserted" instruction since the time
it was saved. If so, advance to the first non-"inserted" instruction.

llvm-svn: 96203
2010-02-15 00:21:43 +00:00
Dan Gohman 6b7517342e In rememberInstruction, if the value being remembered is the
current insertion point, advance the current insertion point.
This avoids a use-before-def situation in a testcase extracted
from clang which is difficult to reduce to a reasonable-sized
regression test.

llvm-svn: 96151
2010-02-14 03:12:47 +00:00
Dan Gohman f446713fd0 Simplify this code; no need for a custom subclass if it doesn't need
to override anything from the parent class.

llvm-svn: 96150
2010-02-14 02:48:58 +00:00
Dan Gohman fe873e7c10 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 1a8674e60b 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 45774ce0ad 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 c42c5243a1 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 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman 6f9646e1c5 Add const qualifiers.
llvm-svn: 95582
2010-02-08 22:00:06 +00:00
Devang Patel 6efc8e5120 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 b0b2297066 Update CodeMetrics to count 'big' function calls explicitly.
llvm-svn: 95453
2010-02-05 23:21:18 +00:00
Dan Gohman 9946b5109c 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 999b499024 Provide interface to identifiy artificial methods.
llvm-svn: 95240
2010-02-03 19:57:19 +00:00
Dan Gohman 7e5f1b2773 Various code simplifications.
llvm-svn: 95044
2010-02-02 01:38:49 +00:00
Bill Wendling c5829c4a50 Add "dump" method to IVUsersOneStride.
llvm-svn: 95022
2010-02-01 22:51:23 +00:00
Dan Gohman e5e1b7b05a 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 7f8be9ba95 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 26cd6bd0b0 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 9f4ea22c88 Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
rather than after.

llvm-svn: 94742
2010-01-28 06:32:46 +00:00
Dan Gohman cf9138307d 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 0234628284 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 87256d8fe1 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 832e79ca32 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 cab470b17a 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 f4b25d6d7b 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 85be4333ad 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 a01418d75a Fix a typo in a comment that Duncan noticed.
llvm-svn: 94562
2010-01-26 18:32:54 +00:00
Dan Gohman fdb744b203 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 51aaf02821 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 907bdbb6be Assert when debug intrinsic insert functions are passed empty arguments
llvm-svn: 94491
2010-01-26 02:07:38 +00:00
Chris Lattner 823aed16f9 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 0e44c51a3e Avoid using "Type" as the variable name.
llvm-svn: 94262
2010-01-23 00:26:28 +00:00
Victor Hernandez 73b0f99f17 Make sure ValueFn starts off empty
llvm-svn: 94256
2010-01-23 00:03:28 +00:00
Chris Lattner 7ba0661f27 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 e0701f987f drop the pass name from the output.
llvm-svn: 94158
2010-01-22 05:52:51 +00:00
Chris Lattner 0b1c7235aa eliminate dynamic_cast from this file.
llvm-svn: 94157
2010-01-22 05:46:59 +00:00
Chris Lattner 9efd4fcceb eliminate a bunch more unneeded dynamic_cast's.
llvm-svn: 94156
2010-01-22 05:37:10 +00:00
Chris Lattner 2fa26e5fd0 eliminate a bunch of dynamic_cast's.
llvm-svn: 94155
2010-01-22 05:24:46 +00:00
Dan Gohman 60a9bf414e 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 51ad99d2c5 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 da363d9af8 adopt getAdjustedAnalysisPointer in a few more passes.
llvm-svn: 94018
2010-01-20 20:09:02 +00:00
Chris Lattner 3b03327c14 adopt getAdjustedAnalysisPointer in two more passes.
llvm-svn: 94017
2010-01-20 19:53:32 +00:00