Commit Graph

10585 Commits

Author SHA1 Message Date
David Greene
b3bc115a24 Do some cleanups suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:49:55 +00:00
Daniel Dunbar
89fccca4b0 StringRef(const char*) should not be used to turn null pointers into empty
strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:26:11 +00:00
Daniel Dunbar
efae4d379d Remove my Value.h build fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:07:02 +00:00
David Greene
d7a18e420e Fix a build error by providing a missing enum value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:04:19 +00:00
David Greene
b9c2fd964e Make the MachineFunction argument of getFrameRegister const.
This also fixes a build error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:00:03 +00:00
David Greene
b87bc95db0 Add hasLoadFromStackSlot and hasStoreToStackSlot to return whether a
machine instruction loads or stores from/to a stack slot.  Unlike
isLoadFromStackSlot and isStoreFromStackSlot, the instruction may be
something other than a pure load/store (e.g. it may be an arithmetic
operation with a memory operand).  This helps AsmPrinter determine when
to print a spill/reload comment.

This is only a hint since we may not be able to figure this out in all
cases.  As such, it should not be relied upon for correctness.

Implement for X86.  Return false by default for other architectures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:55:29 +00:00
Daniel Dunbar
db99095cfe Attempt to unbreak LLVM build, David G. please check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:53:56 +00:00
David Greene
3f2bf85d14 Add a bool flag to StackObjects telling whether they reference spill
slots.  The AsmPrinter will use this information to determine whether to
print a spill/reload comment.

Remove default argument values.  It's too easy to pass a wrong argument
value when multiple arguments have default values.  Make everything
explicit to trap bugs early.

Update all targets to adhere to the new interfaces..


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:49:22 +00:00
Benjamin Kramer
05872ea804 Add compare_lower and equals_lower methods to StringRef. Switch all users of
StringsEqualNoCase (from StringExtras.h) to it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:36:59 +00:00
David Greene
cf62632d83 Make FixedStackPseudoSourceValue a first-class PseudoSourceValue by
making it visible to clients and adding LLVM-style cast capability.
This will be used by AsmPrinter to determine when to emit spill comments
for an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:25:07 +00:00
David Greene
1251443929 Add AsmPrinter comment flags to machine instructions so that AsmPrinter
can emit extra information in comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:21:09 +00:00
David Greene
e55abe5cd0 Add comment flags so AsmPrinter can output additional information when
emitting comments.  These flags carry semantic information not otherwise
easily derivable from the IR text.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:13:34 +00:00
Devang Patel
70d75ca310 "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 19:02:56 +00:00
Dan Gohman
777bdad579 Mark DBG_LABEL, EH_LABEL, and GC_LABEL as not-duplicable, since
they really are not duplicable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 18:36:19 +00:00
Benjamin Kramer
7f82fdb9bc Silence a warning on targets with unsigned chars.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 17:59:45 +00:00
Nuno Lopes
34e992da38 implement shl, ashr, and lshr methods. shl is not fully implemented as it is quite tricky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 14:53:53 +00:00
Evan Cheng
586f69a118 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:35:05 +00:00
Evan Cheng
06b53c0d51 isLegalICmpImmediate should take a signed integer; code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:13:11 +00:00
Oscar Fuentes
8e3c16917c CMake: Hopefully unbreak the build by mimicking the changes on the
other build system about the new C_INCLUDE_DIRS configure option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86960 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 06:48:09 +00:00
Rafael Espindola
7f9ec910a3 Add the --with-c-include-dirs to llvm's configure.
The clang patch is next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 05:46:09 +00:00
Oscar Fuentes
a447cfea45 CMake: Pass -lm to check_symbol_exists for detecting several math
functions like floorf, ceilf, ... Add test for detecting nearbyintf.

This change was prompted by test/Transforms/SimplifyLibCalls/floor.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 05:36:09 +00:00
Chris Lattner
b52675b643 Add a new getPredicateOnEdge method which returns more rich information for
constant constraints.  Improve the LVI lattice to include inequality 
constraints.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 04:36:58 +00:00
Jim Grosbach
7707a0df5b Move the utility function UpdateTerminator() from CodePlacementOpt() into
MachineBasicBlock so other passes can utilize it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 03:55:33 +00:00
Nick Lewycky
ad108baf47 Add CreateNUWAdd and CreateNUWSub to complement the existing CreateNSWAdd and
CreateNSWSub functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:08:11 +00:00
Chris Lattner
38392bbeb8 expose edge information and switch j-t to use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:29:10 +00:00
Devang Patel
afa5a34b30 Do not use StringRef in DebugInfo interface.
This allows StringRef to skip controversial if(str) check in constructor.
Buildbots, wait for corresponding clang and llvm-gcc FE check-ins!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 00:50:58 +00:00
Jakob Stoklund Olesen
3e20475fee Fix liveness calculation when splitting critical edges during PHI elimination.
- Edges are split before any phis are eliminated, so the code is SSA.

- Create a proper IR BasicBlock for the split edges.

- LiveVariables::addNewBlock now has same syntax as
  MachineDominatorTree::addNewBlock. Algorithm calculates predecessor live-out
  set rather than successor live-in set.

This feature still causes some miscompilations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 19:31:31 +00:00
Devang Patel
4a8efb0c39 Add SetDebugLocation() variant to
add debug info location to an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 19:06:06 +00:00
Evan Cheng
77e4751011 Add TargetLowering::isLegalICmpImmediate. It tells LSR what immediate can be folded into target icmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 19:05:52 +00:00
Dan Gohman
641c6f983e Fix a copy+pasto in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86852 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 18:14:02 +00:00
Duncan Sands
a3da922a27 Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 15:34:13 +00:00
Chris Lattner
f8fb7c26ee remove the now dead condprop pass, PR3906.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:56:35 +00:00
Daniel Dunbar
a8333d3d10 Add StringRef::split(StringRef), to complement StringRef::split(char).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:19:11 +00:00
Chris Lattner
cc4d3b25f3 stub out some LazyValueInfo interfaces, and have JumpThreading
start using them in a trivial way when -enable-jump-threading-lvi
is passed.  enable-jump-threading-lvi will be my playground for 
awhile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 02:08:33 +00:00
Daniel Dunbar
3691393b86 Add Triple::str() which returns the contents of the Triple as a string, as a more readable alternative to getTriple().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86773 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:43:14 +00:00
Daniel Dunbar
64066bd8b5 Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:28:53 +00:00
Chris Lattner
10f2d13d58 Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:22:30 +00:00
Chris Lattner
68cf6042c1 remove redundant foward declaration. This function is already in
Analysis/Passes.h



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:21:21 +00:00
Chris Lattner
6eb8dd2276 jump threading does everything that condprop does any more. This passes
bootstrap on darwin i386.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:54:10 +00:00
Devang Patel
53bb5c95af Implement support to debug inlined functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:06:00 +00:00
Chris Lattner
0a26870d92 in -dot-cfg and -dot-cfg-only, when rendering switch instructions,
put the switch value in the successor boxes like we put T/F for branches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:56:15 +00:00
Chris Lattner
40d8c28b27 move some generally useful functions out of jump threading
into libanalysis and transformutils.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:26:15 +00:00
Devang Patel
6daf99bf8f Process InlinedAt location info.
Update InsertDeclare to return newly inserted llvm.dbg.declare intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86727 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:05:35 +00:00
Jakob Stoklund Olesen
f235f13931 Teach PHIElimination to split critical edges when -split-phi-edges is enabled.
Critical edges leading to a PHI node are split when the PHI source variable is
live out from the predecessor block. This help the coalescer eliminate more
PHI joins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:01:05 +00:00
Victor Hernandez
8e345a1c41 Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 08:32:25 +00:00
Victor Hernandez
2b6705f5e7 Add ComputeMultiple() analysis function that recursively determines if a Value V is a multiple of unsigned Base
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 08:28:35 +00:00
Chris Lattner
dce94d92df refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 05:59:26 +00:00
Chris Lattner
e34537856a add a new SimplifyInstruction API, which is like ConstantFoldInstruction,
except that the result may not be a constant.  Switch jump threading to 
use it so that it gets things like (X & 0) -> 0, which occur when phi preds
are deleted and the remaining phi pred was a zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 01:08:51 +00:00
Jeffrey Yasskin
81cf432569 Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 01:02:17 +00:00
Chris Lattner
d06094f068 factor simplification logic for AND and OR out to InstSimplify from instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:55:12 +00:00
David Goodwin
c2e8a7e8d2 Fixed to address code review. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:48:55 +00:00
Daniel Dunbar
d65267ee62 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:43:58 +00:00
David Goodwin
0855dee564 Allow targets to specify register classes whose member registers should not be renamed to break anti-dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:15:47 +00:00
Chris Lattner
9dbb42944c rename SimplifyCompare -> SimplifyCmpInst and split it into
Simplify[IF]Cmp pieces.  Add some predicates to CmpInst to 
determine whether a predicate is fp or int.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:28:39 +00:00
Chris Lattner
8f73deaa87 fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:06:58 +00:00
Daniel Dunbar
38424c9b5d Add StringSwitch::Cases overloads, for matching multiple strings to a single
value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:05:44 +00:00
Chris Lattner
9f3c25aeb3 stub out a new libanalysis "instruction simplify" interface that
takes decimated instructions and applies identities to them.  This
is pretty minimal at this point, but I plan to pull some instcombine
logic out into these and similar routines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86613 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:57:59 +00:00
Jeffrey Yasskin
6f348e4586 Remove dlsym stubs, with Nate Begeman's permission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86606 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:34:19 +00:00
Dan Gohman
80f6c58981 Print "..." instead of all the uninteresting register clobbers on call
instructions. This makes CodeGen dumps significantly less noisy.

Example before:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %R2<imp-def,dead>, %R3<imp-def,dead>, %R12<imp-def,dead>, %LR<imp-def,dead>, %D0<imp-def,dead>, %D1<imp-def,dead>, %D2<imp-def,dead>, %D3<imp-def,dead>, %D4<imp-def,dead>, %D5<imp-def,dead>, %D6<imp-def,dead>, %D7<imp-def,dead>, %D16<imp-def,dead>, %D17<imp-def,dead>, %D18<imp-def,dead>, %D19<imp-def,dead>, %D20<imp-def,dead>, %D21<imp-def,dead>, %D22<imp-def,dead>, %D23<imp-def,dead>, %D24<imp-def,dead>, %D25<imp-def,dead>, %D26<imp-def,dead>, %D27<imp-def,dead>, %D28<imp-def,dead>, %D29<imp-def,dead>, %D30<imp-def,dead>, %D31<imp-def,dead>, %CPSR<imp-def,dead>, %FPSCR<imp-def,dead>

Same example after:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %LR<imp-def,dead>, %CPSR<imp-def,dead>, ...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 19:38:45 +00:00
Dan Gohman
d146e986c8 Fix an 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:20:38 +00:00
Dan Gohman
28a4c78621 Constify MachineFunctionAnalysis' TargetMachine reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86564 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:18:49 +00:00
Dan Gohman
1edb8e0910 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 17:06:51 +00:00
Dan Gohman
9d51c972c1 Suppress implicit copy ctor and copy assignment for MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 17:06:23 +00:00
Nuno Lopes
95a3be0ba4 add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 15:36:28 +00:00
Oscar Fuentes
6a660d4a43 CMake: Detect gv, circo, twopi, neato, fdo, dot and dotty.
Patch by Arnaud Allard de Grandmaison!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 15:26:40 +00:00
Chris Lattner
0dd3b7645b fix some bogus asserts, PR5049
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86514 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 04:47:27 +00:00
Lang Hames
16dcaf5996 Moved some ManagedStatics out of the SlotIndexes header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 08:49:59 +00:00
Daniel Dunbar
d71153577f Fix class -> struct tag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 23:21:30 +00:00
Chris Lattner
9e496d2231 all targets should be required to declare legal integer types. My plan to
make it optional doesn't work out.  If you don't want to specify this, don't
specify a TD string at all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 18:53:00 +00:00
Anton Korobeynikov
8983da729a Add 8 bit libcalls and make use of them for msp430
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:14:39 +00:00
Chris Lattner
e82bdc4809 add the ability for TargetData to return information about legal integer
datatypes on a given CPU.  This is intended to allow instcombine and other
transformations to avoid converting big sequences of operations to an
inconvenient width, and will help clean up after SRoA.  See also "Adding 
legal integer sizes to TargetData" on Feb 1, 2009 on llvmdev, and PR3451.

Comments welcome.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:35:34 +00:00
Chris Lattner
2e07494170 more cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:23:04 +00:00
Chris Lattner
b7aadfac5e rewrite TargetData to use StringRef/raw_ostream instead of thrashing std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:13:23 +00:00
Jeffrey Yasskin
2d274412ed Make the need-stub variables accurate and consistent. In the case of
MachineRelocations, "stub" always refers to a far-call stub or a
load-a-faraway-global stub, so this patch adds "Far" to the term. (Other stubs
are used for lazy compilation and dlsym address replacement.) The variable was
also inconsistent between the positive and negative sense, and the positive
sense ("NeedStub") was more demanding than is accurate (since a nearby-enough
function can be called directly even if the platform often requires a stub).
Since the negative sense causes double-negatives, I switched to
"MayNeedFarStub" globally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 08:51:52 +00:00
Mikhail Glushenkov
6533afe349 llvmc: Add a '-time' option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 06:33:58 +00:00
Mikhail Glushenkov
4e2211112e 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 06:33:01 +00:00
Lang Hames
d6ef7fac1a Update some globals to use ManagedStatic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 05:50:28 +00:00
Evan Cheng
12749db150 Missed this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:07:30 +00:00
Kenneth Uildriks
b4997aeab7 Add code to check at SelectionDAGISel::LowerArguments time to see if return values can be lowered to registers. Coming soon, code to perform sret-demotion if return values cannot be lowered to registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 02:11:54 +00:00
Jakob Stoklund Olesen
3de23e6f6c Fix inverted conflict test in -early-coalesce.
A non-identity copy cannot be coalesced when the phi join destination register
is live at the copy site.

Also verify the condition that the PHI join source register is only used in
the PHI join. Otherwise the coalescing is invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 01:58:40 +00:00
Victor Hernandez
9d0b704e3e Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
Daniel Dunbar
2928c83b01 Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 10:58:06 +00:00
Chris Lattner
f55eeb918e remove some more Context arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 05:59:53 +00:00
Chris Lattner
7b550ccfc5 remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 04:27:31 +00:00
Victor Hernandez
df98761d08 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:33:24 +00:00
Douglas Gregor
6a66b38846 Add a bunch of missing "template" keywords to disambiguate dependent template names. GCC eats this ill-formed code, Clang does not. I already filed PR5404 to improve recovery in this case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86204 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:12:53 +00:00
Eric Christopher
ef1fad533e Fix PR5315, original patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:11:57 +00:00
Dan Gohman
b38a308616 Make printImplicitDef and printKill non-virtual, since they don't
need to be overridden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:04:05 +00:00
Douglas Gregor
0c8ae782cb Make a few more LLVM headers parsable as standalone headers.
Fix some problems with the hidden copy constructors for
ImmutableMap/ImmutableSet found by Clang++.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 23:01:30 +00:00
Dan Gohman
e5db7c4166 InstrTypes.h includes Instruction.h, so it's not necessary to include both.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:42:20 +00:00
Dan Gohman
f17e9511f1 Factor out the predicate code for loopsimplify form exit blocks into
a separate helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:21:41 +00:00
Oscar Fuentes
b5b10c25f7 CMake: Detect dotty.
Patch by Arnaud Allard de Grandmaison!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86153 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:03:26 +00:00
Douglas Gregor
9ed0d92e94 Move llvm:🆑:opt's conversion function into the base classes that
actually need that conversion function. Silences a Clang++ warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 18:30:50 +00:00
Chris Lattner
0ff290615f Declare classes with matched tags, pointed out by a clang++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 17:51:44 +00:00
Douglas Gregor
131b0d2fcf Make two more LLVM headers standalone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 13:39:23 +00:00
Douglas Gregor
fbe67f85b2 Make a few headers standalone. Plus, add a missing "template" keyword
that Clang diagnoses but GCC does not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86130 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 13:30:28 +00:00
Mon P Wang
82c443655d Reintroduce support for overloading target intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 03:19:08 +00:00
Lang Hames
090780be1c Tidied some ugliness in the SlotIndex default constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 01:18:31 +00:00
Lang Hames
a0e7b02760 Removed an assert which was causing significant slowdowns in debug builds.
This assert was very conservative to begin with (the error condition is well
covered by tests elsewhere in the code) so we won't miss much by removing it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:52:28 +00:00
Victor Hernandez
24f934d055 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:03:03 +00:00
Lang Hames
0368e500eb Handle empty/tombstone keys for LiveIndex more cleanly. Check for index sanity when constructing index list entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:24:15 +00:00
Jakob Stoklund Olesen
ad68264f59 Print out an informative comment for KILL instructions.
The KILL pseudo-instruction may survive to the asm printer pass, just like the IMPLICIT_DEF. Print the KILL as a comment instead of just leaving a blank line in the output.

With -asm-verbose=0, a blank line is printed, like IMPLICIT?DEF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 19:24:37 +00:00
Chris Lattner
6bffa63dfe make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
during bitfield codegen and slows down -O0 compile times by making
useless IR.  rdar://7362516


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 05:00:12 +00:00
Evan Cheng
9111c4fef5 Silence implicit conversion warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86000 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 03:08:57 +00:00
Lang Hames
11d0088ec2 Another spurious friend declaration removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 01:52:40 +00:00
Lang Hames
f3a521f86a Removed an unnecessary friend declaration and some crufty comments from IndexListEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85995 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 01:34:22 +00:00
Lang Hames
233a60ec40 The Indexes Patch.
This introduces a new pass, SlotIndexes, which is responsible for numbering
instructions for register allocation (and other clients). SlotIndexes numbering
is designed to match the existing scheme, so this patch should not cause any
changes in the generated code.

For consistency, and to avoid naming confusion, LiveIndex has been renamed
SlotIndex.

The processImplicitDefs method of the LiveIntervals analysis has been moved
into its own pass so that it can be run prior to SlotIndexes. This was
necessary to match the existing numbering scheme.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 23:52:08 +00:00
David Goodwin
4de099d8ca Do a scheduling pass ignoring anti-dependencies to identify candidate registers that should be renamed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 20:57:50 +00:00
Chris Lattner
fde2da47de turn IPSCCP back on by default, try #3 or 4? Woo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 19:35:13 +00:00
Kenneth Uildriks
7febee2a86 Added a comment to a function that had none
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 15:25:20 +00:00
Duncan Sands
674fdc9a28 Run the functionattrs pass after the inliner, and not before.
This makes both logical sense (see below) and increases the
number of functions marked readnone/readonly by about 1-2%
in practice.  The number of functions marked nocapture goes
up by about 5-10%.  The reason it makes sense is shown by
the following example: if you run -functionattrs -inline on
it, then no attributes are assigned.  But if you instead run
-inline -functionattrs then @f is marked readnone because the
simplifications produced by the inliner eliminate the store.

@x = external global i32

define void @w(i1 %b) {
        br i1 %b, label %write, label %return
write:
        store i32 1, i32 *@x
        br label %return
return:
        ret void
}

define void @f() {
        call void @w(i1 0)
        ret void
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 09:40:08 +00:00
Daniel Dunbar
8fd64a5e27 Speculatively redisable IPSCCP, I think its still breaking things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 07:49:22 +00:00
Chris Lattner
14532d03a1 turn IPSCCP back on now that the iterator invalidation bug is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 03:42:51 +00:00
Nate Begeman
8e46141e9e Add a couple more target nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 03:30:51 +00:00
Chris Lattner
3774c91854 revert r8579[56], which are causing unhappiness in buildbot land.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 19:31:10 +00:00
Chris Lattner
b7a7f013ee now that ip sccp *really* subsumes ipcp, remove ipcp again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 07:34:29 +00:00
Evan Cheng
f57b1baa44 Add PseudoSourceValue::mayAlias. It returns true if the object can ever alias any LLVM IR value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85762 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 23:50:04 +00:00
Chris Lattner
f51635cd30 fix two strange things in the default passmgr:
1. we'd run simplifycfg at the very start, even though
the per function passes have already cleaned this up.

2. In the main per-function pipeline that is interlaced with inlining 
   etc, we would do instcombine, jump threading, simplifycfg *before*
   doing SROA.  SROA is much more likely to expose opportunities for
   these passes than they are for SROA, so move SRoA up earlier.

also add some comments.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 20:41:59 +00:00
Chris Lattner
3e54f8850a IPSCCP apparently is not a superset of IPCP, this is bad,
but I'll investigate it separately.  This unbreaks 
test/FrontendC/weak_constant.c


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 19:29:12 +00:00
Duncan Sands
857e9996c7 Improve the other instance of the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 19:16:21 +00:00
Chris Lattner
c92712184f only run GlobalDCE at -O3 and run it late instead of early.
GlobalOpt already deletes trivially dead functions/globals,
so GlobalDCE only adds values for cycles of dead things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 19:09:12 +00:00
Chris Lattner
0037bfabd4 We currently only run ipsccp at LTO time, which is silly. It subsumes
ipconstprop and doesn't take much time.  Just run it in its place.

This adds a testcase for it, which I plan to expand to cover other
"integration" cases, where we expect the optimizer to be able to
eliminate various things.  Due to phase order issues we've regressed
in a number of areas and integration tests are the only way I see to
prevent this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 18:57:49 +00:00
Chris Lattner
c4775e4b97 remove a bunch of locking from LLVMContextImpl. Since only one thread
can be banging on a context at a time, this isn't needed.  Owen, please
review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 18:42:03 +00:00
Chris Lattner
4a7642ec9c the verifier shouldn't modify the IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 18:11:50 +00:00
Douglas Gregor
076124ef26 Reverting 85714, 85715, 85716, which are breaking the build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 16:42:53 +00:00
Dan Gohman
2166f62290 Add a function to Passes.h to allow clients to create instances
of the ScalarEvolution pass without needing to #include ScalarEvolution.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85716 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 15:28:36 +00:00
Dan Gohman
34e9d7b6be Don't #include Pass.h from CallGraph.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 15:23:35 +00:00
Dan Gohman
b2fae7560d Remove the #include of Pass.h from PassManager.h. This breaks a significant
#include dependency, as frontends commonly pull in PassManager.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 15:20:19 +00:00
Chris Lattner
660a4f389c fix an issue where the verifier would reject a function whose entry
block had its address taken even if the blockaddress was dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 04:08:01 +00:00
Chris Lattner
cdfc940912 Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 01:27:45 +00:00
Chris Lattner
1b98ff3e4f update the comment above llvm::SplitCriticalEdge, and make
it abort on IndirectBrInst as describe in the comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 21:51:10 +00:00
Chris Lattner
7d83ebcadd Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid 
blockaddress with a new blockaddress(@func, null) instead of a 
inttoptr(1).

This changes the bitcode encoding format, and still needs codegen 
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 20:08:37 +00:00
Dan Gohman
438b583dbd Revert r85667. LoopUnroll currently can't call utility functions which
auto-update the DominatorTree because it doesn't keep the DominatorTree
current while it works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 17:33:01 +00:00
Dan Gohman
f230d8ad15 Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor into
MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive,
and makes it unnecessary for LoopUnroll to have its own copy of this code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 16:08:00 +00:00
Dan Gohman
4c7279ac72 Rename forgetLoopBackedgeTakenCount to forgetLoop, because it
clears out more information than just the stored backedge taken count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 15:04:55 +00:00
Dan Gohman
9f476e3179 Remove CodeGenLICM. It's largely obsoleted by MachineLICM's new ability
to unfold loop-invariant loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:35:41 +00:00
Chris Lattner
3821176b2e make hasAddressTaken() constant time by storing a refcount in BB's subclass data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 22:33:29 +00:00
Dan Gohman
0115e164ba Fix MachineLICM to use the correct virtual register class when
unfolding loads for hoisting.  getOpcodeAfterMemoryUnfold returns the
opcode of the original operation without the load, not the load
itself, MachineLICM needs to know the operand index in order to get
the correct register class. Extend getOpcodeAfterMemoryUnfold to
return this information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 22:18:41 +00:00
Evan Cheng
2f192c256c Add option to createGVNPass to disable PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 20:12:24 +00:00
Evan Cheng
50222db00a Rather than having llvm-gcc changing the meaning of OptimizeSize, just make sure loop unswitch is conservative when optimization level is < 3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 07:23:49 +00:00
Dan Gohman
8c2b52552c Initial target-independent CodeGen support for BlockAddresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85556 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 01:27:03 +00:00
Devang Patel
c24096559d Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 00:39:25 +00:00
Dan Gohman
64348df5c9 Add a BlockAddress MachineOperand kind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 00:20:08 +00:00
Dan Gohman
cf3f89249d Remove a redundant copy constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 00:14:33 +00:00
Dan Gohman
e1f188fe27 Move some code from being emitted as boilerplate duplicated in every
*ISelDAGToDAG.cpp to being regular code in SelectionDAGISel.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 22:30:23 +00:00
Dan Gohman
533297b58d Rename usesCustomDAGSchedInserter to usesCustomInserter, and update a
bunch of associated comments, because it doesn't have anything to do
with DAGs or scheduling. This is another step in decoupling MachineInstr
emitting from scheduling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 18:10:34 +00:00
Chris Lattner
f32a6a3091 add interpreter support for indirect goto / blockaddress. The interpreter
now correctly runs clang's test/CodeGen/indirect-goto.c.  The JIT will abort
on it until someone feels compelled to implement this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 05:26:09 +00:00
Zhongxing Xu
7a8b33a9a4 add newline to make cl.exe happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 05:07:14 +00:00
Bill Wendling
8bedf97f68 Don't put in these EH changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 00:37:35 +00:00
Douglas Gregor
f25cf3d56f A switch-on-string-literal construct that is a nice alternative to
cascading "ifs" of strcmps/memcmps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 00:34:30 +00:00