Commit Graph

14608 Commits

Author SHA1 Message Date
Andrew Trick
b1831c6640 Allow loop unrolling to get known trip counts from ScalarEvolution.
SCEV unrolling can unroll loops with arbitrary induction variables. It
is a prerequisite for -disable-iv-rewrite performance. It is also
easily handles loops of arbitrary structure including multiple exits
and is generally more robust.

This is under a temporary option to avoid affecting default
behavior for the next couple of weeks. It is needed so that I can
checkin unit tests for updateUnloop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137384 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11 23:36:16 +00:00
NAKAMURA Takumi
4c7324d032 DataTypes.h.cmake: Tweak INT32_MIN for MSVC. MSC treats -2147483648 as -(2147483648U).
It caused an unexpected behavior since r137254.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137365 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11 21:59:55 +00:00
Chad Rosier
78eb93c591 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11 00:22:48 +00:00
Devang Patel
5bc942cc3c Stay within 80 columns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 23:58:09 +00:00
Andrew Trick
fb62b8deb3 Reapplying r136844.
An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 23:22:57 +00:00
Andrew Trick
d8a2f3ab91 Cleanup. Remove an extraneous GraphTraits specialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 22:55:39 +00:00
Devang Patel
b549bcfe6c Distinguish between two copies of one inlined variable. Take 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 21:50:54 +00:00
Devang Patel
103b8e653c Provide utility to extract and use lexical scoping information from machine instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137237 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 19:04:06 +00:00
Andrew Trick
bddb7f8210 Cleanup. Make ScalarEvolution an explicit argument of the
SimplifyIndVar utility since it is required.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137202 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 04:22:26 +00:00
Andrew Trick
4b4bb71bcd Added a SimplifyIndVar utility to simplify induction variable users
based on ScalarEvolution without changing the induction variable phis.

This utility is the main tool of IndVarSimplifyPass, but the pass also
restructures induction variables in strange ways that are sensitive to
pass ordering. This provides a way for other loop passes to simplify
new uses of induction variables created during transformation. The
utility may be used by any pass that preserves ScalarEvolution. Soon
LoopUnroll will use it.

The net effect in this checkin is to cleanup the IndVarSimplify pass
by factoring out the SimplifyIndVar algorithm into a standalone utility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137197 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 03:46:27 +00:00
Andrew Trick
2d31ae3d9d Cleanup. Added LoopBlocksDFS::perform for simple clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 01:59:05 +00:00
Peter Collingbourne
59c1ba96ba Preserve the name for this variant of IRBuilder::CreateCall
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 01:10:08 +00:00
Andrew Trick
306afdf443 Cleanup. Avoid relying on specialization of std::distance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137191 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 00:49:12 +00:00
Andrew Trick
b1eede1281 Fix the LoopUnroller to handle nontrivial loops and partial unrolling.
These are not individual bug fixes. I had to rewrite a good chunk of
the unroller to make it sane. I think it was getting lucky on trivial
completely unrolled loops with no early exits. I included some fairly
simple unit tests for partial unrolling. I didn't do much stress
testing, so it may not be perfect, but should be usable now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 00:28:10 +00:00
Jakob Stoklund Olesen
c66d36028b Trim an unneeded header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137184 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 23:49:21 +00:00
Eli Friedman
21006d40ac Representation of 'atomic load' and 'atomic store' in IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 23:02:53 +00:00
Rafael Espindola
dd3d68f7a9 Add missing file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137162 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 22:19:52 +00:00
Jakob Stoklund Olesen
6d1fd0b979 Move CalculateRegClass to MRI::recomputeRegClass.
This function doesn't have anything to do with spill weights, and MRI
already has functions for manipulating the register class of a virtual
register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137123 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 16:46:27 +00:00
Devang Patel
48d726fbce Provide method to print variable's extended name which includes inline location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137095 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 01:03:14 +00:00
Jakob Stoklund Olesen
27215676c7 Refer to the RegisterCoalescer pass by ID.
A public interface is no longer needed since RegisterCoalescer is not an
analysis any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 00:29:53 +00:00
Jakob Stoklund Olesen
2df3f58a0b Hoist hasLoadFromStackSlot and hasStoreToStackSlot.
These the methods are target-independent since they simply scan the
memory operands.  They can live in TargetInstrInfoImpl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-08 20:53:24 +00:00
Benjamin Kramer
08de97a5b0 Pacify virtual dtor warnings and cmake buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137060 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-08 19:09:02 +00:00
Benjamin Kramer
41ab14b725 Add MCInstrAnalysis class. This allows the targets to specify own versions of MCInstrDescs functions.
- Add overrides for ARM.
- Teach llvm-objdump to use this instead of plain MCInstrDesc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-08 18:56:44 +00:00
Chandler Carruth
4147f39769 Temporarily revert r135528 which distinguishes between two copies of one
inlined variable, based on the discussion in PR10542.

This explodes the runtime of several passes down the pipeline due to
a large number of "copies" remaining live across a large function. This
only shows up with both debug and opt, but when it does it creates
a many-minute compile when self-hosting LLVM+Clang. There are several
other cases that show these types of regressions.

All of this is tracked in PR10542, and progress is being made on fixing
the issue. Once its addressed, the re-instated, but until then this
restores the performance for self-hosting and other opt+debug builds.

Devang, let me know if this causes any trouble, or impedes fixing it in
any way, and thanks for working on this!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-05 00:51:31 +00:00
Duncan Sands
1203486d92 Fix a place that was clearly forgotten when the type legalization
logic moved over to its own enum.  Noticed by Andrey Karpov with
the PVS-studio tool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136881 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 16:01:54 +00:00
Andrew Trick
0712108d22 Reverting r136884 updateUnloop, which crashed a linux builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136857 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 01:04:37 +00:00
Andrew Trick
762797d1af An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 23:50:25 +00:00
Andrew Trick
fbfb806e3f whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136840 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 23:43:49 +00:00
Andrew Trick
5207936a24 An interface for iterating over a loop's blocks in DFS order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136838 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 23:27:28 +00:00
Bill Wendling
2626dba9c5 Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
This is some of my original LLVM code. *wipes tear*


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136821 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 22:18:20 +00:00
Owen Anderson
56cb3e3ccb Add accessors for manipulating an MCInst's operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136818 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 21:52:15 +00:00
Jakub Staszak
8ea45231dc Add more constantness in BlockFrequencyInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136816 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 21:30:57 +00:00
Eli Friedman
26689ac37e New approach to r136737: insert the necessary fences for atomic ops in platform-independent code, since a bunch of platforms (ARM, Mips, PPC, Alpha are the relevant targets here) need to do essentially the same thing.
I think this completes the basic CodeGen for atomicrmw and cmpxchg.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 21:06:02 +00:00
Bill Wendling
866ec86542 Remove CreateUnwind from the IRBuillder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136811 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 20:53:38 +00:00
Andrew Trick
1009c3299b SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget
to notify SCEV of a change. Add forgetLoop in a couple of those places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 18:32:11 +00:00
Jay Foad
e3fbe6c0fb Use cast<> instead of a C-style cast to get some free assertions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 10:05:04 +00:00
Rafael Espindola
c684e83e45 Move methods in PassManagerBuilder offline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136727 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 21:50:27 +00:00
Rafael Espindola
3d453ac131 move PassManagerBuilder.h to IPO. This is a non intuitive place to put it,
but it solves a layering violation since things in Support are not supposed to
use things in Transforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 21:50:24 +00:00
Rafael Espindola
49cb9b8886 Assume .cfi_startproc is the first thing in a function. If the function is
externally visable, create a local symbol to use in the CFE. If not, use the
function label itself.

Fixes PR10420.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136716 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 20:24:22 +00:00
Roman Divacky
2c0d69fad0 Sketch out PowerPC ELF writer. This is enough to get clang -integrated-as
to compile a working hello world on FreeBSD/PPC32.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136689 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 15:51:38 +00:00
Bill Wendling
1600525385 Remove the LLVMBuildUnwind C API function.
The 'unwind' function is going away with the new EH rewrite. This is step 0 in
keeping front-ends from using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136683 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 06:20:17 +00:00
Andrew Trick
fcb4356dee Use consistent terminology for loop exit/exiting blocks. Name change only.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136677 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 04:23:35 +00:00
Eli Friedman
9b0a479bb7 Fix a couple silly typos in IRBuilder in the new atomic instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 00:45:35 +00:00
Owen Anderson
423b81e692 Add a clear() operation to MCInst, to drop all of its operands. Useful for the disassembler, where we may realize fairly late into decoding that something is wrong and need to reset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136634 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 18:43:18 +00:00
Jakub Staszak
e2481ff8ee Add BlockFrequency::getEntryFrequency()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 15:22:10 +00:00
Jay Foad
4f2d6950fb The operands of a GlobalAlias are always Constants. Simplify things
accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136608 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 12:20:36 +00:00
Bill Wendling
dccc03b242 Add the 'resume' instruction for the new EH rewrite.
This adds the 'resume' instruction class, IR parsing, and bitcode reading and
writing. The 'resume' instruction resumes propagation of an existing (in-flight)
exception whose unwinding was interrupted with a 'landingpad' instruction (to be
added later).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136589 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31 06:30:59 +00:00
Bill Wendling
10c6d12a9f Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 05:42:50 +00:00
Jakob Stoklund Olesen
73e7dced38 Add an isSSA() flag to MachineRegisterInfo.
This flag is true from isel to register allocation when the machine
function is required to be in SSA form.  The TwoAddressInstructionPass
and PHIElimination passes clear the flag.

The SSA flag wil be used by the machine code verifier to check for SSA
form, and eventually an assertion can enforce it in +Asserts builds.
This will catch the common target error of creating machine code with
multiple defs of a virtual register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136532 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 22:51:22 +00:00
Jakub Staszak
6f6baf1bdd Add more constantness in BranchProbabilityInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:30:00 +00:00