Commit Graph

69521 Commits

Author SHA1 Message Date
Andrew Trick
d1dace8aea Enable support for precise scheduling of the instruction selection
DAG. Disable using "-disable-sched-cycles".

For ARM, this enables a framework for modeling the cpu pipeline and
counting stalls. It also activates several heuristics to drive
scheduling based on the model. Scheduling is inherently imprecise at
this stage, and until spilling is improved it may defeat attempts to
schedule. However, this framework provides greater control over
tuning codegen.

Although the flag is not target-specific, it should have very little
affect on the default scheduler used by x86. The only two changes that
affect x86 are:
- scheduling a high-latency operation bumps the current cycle so independent
  operations can have their latency covered. i.e. two independent 4
  cycle operations can produce results in 4 cycles, not 8 cycles.
- Two operations with equal register pressure impact and no
  latency-based stalls on their uses will be prioritized by depth before height
  (height is irrelevant if no stalls occur in the schedule below this point).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 06:19:05 +00:00
Andrew Trick
c8bfd1d78f Convert -enable-sched-cycles and -enable-sched-hazard to -disable
flags. They are still not enable in this revision.

Added TargetInstrInfo::isZeroCost() to fix a fundamental problem with
the scheduler's model of operand latency in the selection DAG.

Generalized unit tests to work with sched-cycles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 05:51:33 +00:00
Chris Lattner
cd151d2f95 fix PR9013, an infinite loop in instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 05:29:50 +00:00
Chris Lattner
084fe6243a update obsolete comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 05:08:26 +00:00
Michael J. Spencer
281f3901b7 Object: Renable the tests now that none of the build bots complain about aliasing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123964 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 05:07:13 +00:00
Nick Lewycky
acf4a7c0e6 Don't try to pull vector bitcasts that change the number of elements through
a select. A vector select is pairwise on each element so we'd need a new
condition with the right number of elements to select on. Fixes PR8994.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123963 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 02:30:43 +00:00
Michael J. Spencer
7acdb4d237 Object: Fix type punned pointer issues by making DataRefImpl a union and using intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 02:27:02 +00:00
Peter Collingbourne
be111ef182 tblgen: Add support for non-inheritable attributes
This patch makes the necessary changes to TableGen to support
non-inheritable attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 02:08:26 +00:00
Nick Lewycky
4c93a0f092 Add a constant folding of casts from zero to zero. Fixes PR9011!
While here, I'd like to complain about how vector is not an aggregate type
according to llvm::Type::isAggregateType(), but they're listed under aggregate
types in the LangRef and zero vectors are stored as ConstantAggregateZero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-21 01:12:09 +00:00
Evan Cheng
d7e3cc840b Don't be overly aggressive with CSE of "ldr constantpool". If it's a pc-relative
value, the "add pc" must be CSE'ed at the same time. We could follow the same
approach as T2 by adding pseudo instructions that combine the ldr + "add pc".
But the better approach is to use movw + movt (which I will enable soon), so
I'll leave this as a TODO.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123949 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 23:55:07 +00:00
Tobias Grosser
e906921480 Implement requiredTransitive
The PassManager did not implement the transitivity of requiredTransitive. This
was unnoticed since 2006.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 21:03:22 +00:00
Tobias Grosser
5839614d97 RegionPassPrinter should contain the name of the pass printed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123941 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 21:03:20 +00:00
Bruno Cardoso Lopes
1115c47203 Add testcases for clz encoding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123937 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 19:27:16 +00:00
Bruno Cardoso Lopes
e47f3751d7 Fix the encoding and parsing of clrex instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123936 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 19:18:32 +00:00
Bob Wilson
55931ab992 Move InstAlias check of argument types to a separate loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123934 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:38:10 +00:00
Bob Wilson
906bc368bc Tidy comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:38:07 +00:00
Bob Wilson
47c90a70ba Fix broken check for InstAlias argument used with different types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123932 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:38:05 +00:00
Bob Wilson
5e8f2a65ca Precompute InstAlias operand mapping to result instruction operand indices.
There should be no functional change from this, but I think it's simpler this
way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123931 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:38:02 +00:00
Bruno Cardoso Lopes
6456121d5c Change instruction names for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:36:07 +00:00
Bruno Cardoso Lopes
8dd37f7b7d Add cdp/cdp2 instructions for thumb/thumb2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:32:09 +00:00
Devang Patel
163b5d23ab Disable objdump-trivial-object.test. It is broken on powerpc-darwin9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123928 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:08:44 +00:00
Bruno Cardoso Lopes
b32f7a5f4b - Use a more appropriate name for Owen's ARM Parser isMCR hack since the same operands can be present
in cdp/cdp2 instructions. Also increase the hack with cdp/cdp2 instructions.
- Fix the encoding of cdp/cdp2 instructions for ARM (no thumb and thumb2 yet) and add testcases for t
hem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123927 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 18:06:58 +00:00
Jakob Stoklund Olesen
c0de995712 SplitKit requires that all defs are in place before calling useIntv().
The value mapping gets confused about which original values have multiple new
definitions so they may need phi insertions.

This could probably be simplified by letting enterIntvBefore() take a live range
to be added following the instruction. As long as the range stays inside the
same basic block, value mapping shouldn't be a problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123926 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 17:45:23 +00:00
Jakob Stoklund Olesen
d7ca57705e Add LiveIntervalMap::dumpCache() to print out the cache used by the ssa update algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123925 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 17:45:20 +00:00
Bruno Cardoso Lopes
6b3a999f22 Add mcr*2 and mr*c2 support to thumb2 targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 16:58:48 +00:00
Bruno Cardoso Lopes
fa5bd27fbe Add mcr* and mr*c support to thumb targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 16:35:57 +00:00
Michael J. Spencer
fafb8a1ba5 Disable this test until I can figure out why it's broken. Not xfailed because it
usese 100% CPU and times out, so it's annoying to run it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 16:24:07 +00:00
Kalle Raiskila
5106b84506 Allow sign-extending of i8 and i16 to i128 on SPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123912 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 15:49:06 +00:00
Duncan Sands
9d32f60a6f At -O123 the early-cse pass is run before instcombine has run. According to my
auto-simplier the transform most missed by early-cse is (zext X) != 0 -> X != 0.
This patch adds this transform and some related logic to InstructionSimplify
and removes some of the logic from instcombine (unfortunately not all because
there are several situations in which instcombine can improve things by making
new instructions, whereas instsimplify is not allowed to do this).  At -O2 this
often results in more than 15% more simplifications by early-cse, and results in
hundreds of lines of bitcode being eliminated from the testsuite.  I did see some
small negative effects in the testsuite, for example a few additional instructions
in three programs.  One program, 483.xalancbmk, got an additional 35 instructions,
which seems to be due to a function getting an additional instruction and then
being inlined all over the place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123911 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 13:21:55 +00:00
Bruno Cardoso Lopes
8197754be5 Refactor mcr* and mr*c instructions into classes with the same encoding. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 13:17:59 +00:00
Eric Christopher
6214373fe9 My editor's indent went crazy. Fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123909 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:56:34 +00:00
Eric Christopher
02050986d9 Expand invalid return values for umulo and smulo. Handle these similarly
to add/sub by doing the normal operation and then checking for overflow
afterwards. This generally relies on the DAG handling the later invalid
operations as well.

Fixes the 64-bit part of rdar://8622122 and rdar://8774702.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123908 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:54:28 +00:00
Evan Cheng
907276dc44 Correct itinerary entry for t2MOV_pic_ga_add_pc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:43:03 +00:00
Evan Cheng
ab56e31424 Add test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123906 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:38:21 +00:00
Evan Cheng
9fe2009956 Sorry, several patches in one.
TargetInstrInfo:
Change produceSameValue() to take MachineRegisterInfo as an optional argument.
When in SSA form, targets can use it to make more aggressive equality analysis.

Machine LICM:
1. Eliminate isLoadFromConstantMemory, use MI.isInvariantLoad instead.
2. Fix a bug which prevent CSE of instructions which are not re-materializable.
3. Use improved form of produceSameValue.

ARM:
1. Teach ARM produceSameValue to look pass some PIC labels.
2. Look for operands from different loads of different constant pool entries
   which have same values.
3. Re-implement PIC GA materialization using movw + movt. Combine the pair with
   a "add pc" or "ldr [pc]" to form pseudo instructions. This makes it possible
   to re-materialize the instruction, allow machine LICM to hoist the set of
   instructions out of the loop and make it possible to CSE them. It's a bit
   hacky, but it significantly improve code quality.
4. Some minor bug fixes as well.

With the fixes, using movw + movt to materialize GAs significantly outperform the
load from constantpool method. 186.crafty and 255.vortex improved > 20%, 254.gap
and 176.gcc ~10%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123905 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 08:34:58 +00:00
Michael J. Spencer
59315d1d54 llvm-objdump: Remove redundant includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123902 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 07:22:13 +00:00
Michael J. Spencer
d11699d3c0 llvm-nm: Fix warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123901 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 07:22:04 +00:00
Michael J. Spencer
db26073c6a Object: Add some tests!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123899 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:39:15 +00:00
Michael J. Spencer
92e1deb051 Add llvm-objdump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123898 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:39:06 +00:00
Michael J. Spencer
20d335aa04 llvm-nm: Update to use the new LLVMObject library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123897 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:38:57 +00:00
Michael J. Spencer
b84551a14f Object: Add ELF support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123896 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:38:47 +00:00
Michael J. Spencer
a1ef8ef660 Object: Add COFF Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123895 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:38:34 +00:00
Andrew Trick
0bc308600b Selection DAG scheduler register pressure heuristic fixes.
Added a check for already live regs before claiming HighRegPressure.
Fixed a few cases of checking the wrong number of successors.
Added some tracing until these heuristics are better understood.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123892 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:21:59 +00:00
Jakob Stoklund Olesen
fd50d76ff8 Check that a live range exists before shortening it. This fixes PR8989.
The live range may have been deleted earlier because of rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123891 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:20:02 +00:00
Jakob Stoklund Olesen
b908a009cf Add hidden -verify-coalescing to run the machine code verifier before and after
register coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123890 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 06:20:00 +00:00
Michael J. Spencer
8b1659e8bf gold: MinGW fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 05:43:16 +00:00
Venkatraman Govindaraju
71e39dac0c Sparc backend: Implements a delay slot filler that attempt to fill delay slots
with useful instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123884 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 05:08:26 +00:00
Cameron Zwarich
a9ba456b7c Update a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123879 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 03:58:43 +00:00
Cameron Zwarich
229b22132b Remove an unnecessary #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123877 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 03:56:35 +00:00
Jakob Stoklund Olesen
b7683c06cb Fix bug found by new clang warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123872 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 02:43:19 +00:00