oota-llvm.git
13 years agoFix m_Not and m_Neg to not match random ConstantInt's. Before
Chris Lattner [Sat, 15 Jan 2011 05:52:27 +0000 (05:52 +0000)]
Fix m_Not and m_Neg to not match random ConstantInt's.  Before
these would try hard to match constants by inverting the bits
and recursively matching.  There are two problems with this:
1) some patterns would match when we didn't want them to (theoretical)
2) this is insanely expensive to do, and most often pointless.

This was apparently useful in just 2 instcombine cases, which I
added code to handle explicitly.  This change speeds up 'opt'
time on 176.gcc by 1% and produces bitwise identical code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123518 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoone more instcombine variant that is needed to work with future changes,
Chris Lattner [Sat, 15 Jan 2011 05:50:18 +0000 (05:50 +0000)]
one more instcombine variant that is needed to work with future changes,
no functionality change currently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123517 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix typo
Chris Lattner [Sat, 15 Jan 2011 05:42:47 +0000 (05:42 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123516 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCatch ~x < cst just like ~x < ~y, we currently handle this through
Chris Lattner [Sat, 15 Jan 2011 05:41:33 +0000 (05:41 +0000)]
Catch ~x < cst  just like ~x < ~y, we currently handle this through
means that are about to disappear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123515 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoreduce indentation
Chris Lattner [Sat, 15 Jan 2011 05:40:29 +0000 (05:40 +0000)]
reduce indentation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123514 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago80-col.
Eric Christopher [Sat, 15 Jan 2011 00:25:09 +0000 (00:25 +0000)]
80-col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123505 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGeneralize LoadAndStorePromoter a bit and switch LICM
Chris Lattner [Sat, 15 Jan 2011 00:12:35 +0000 (00:12 +0000)]
Generalize LoadAndStorePromoter a bit and switch LICM
to use it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123501 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a comment.
Bob Wilson [Sat, 15 Jan 2011 00:09:18 +0000 (00:09 +0000)]
Fix a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123497 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix 80-cols.
Eric Christopher [Fri, 14 Jan 2011 23:50:53 +0000 (23:50 +0000)]
Fix 80-cols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123494 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate CMake build.
Ted Kremenek [Fri, 14 Jan 2011 22:58:11 +0000 (22:58 +0000)]
Update CMake build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123491 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix some tablegen issues to allow using zero_reg for InstAlias definitions.
Bob Wilson [Fri, 14 Jan 2011 22:58:09 +0000 (22:58 +0000)]
Fix some tablegen issues to allow using zero_reg for InstAlias definitions.

This is needed to allow an InstAlias for an instruction with an "OptionalDef"
result register (like ARM's cc_out) where you want to set the optional register
to reg0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123490 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix memory leak found by clang static analyzer.
Ted Kremenek [Fri, 14 Jan 2011 22:34:17 +0000 (22:34 +0000)]
Fix memory leak found by clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123487 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago'HiReg' is written but never read. Nuke its
Ted Kremenek [Fri, 14 Jan 2011 22:34:13 +0000 (22:34 +0000)]
'HiReg' is written but never read.  Nuke its
declaration and its assignments.

Found by clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123486 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a false-positive warning.
Owen Anderson [Fri, 14 Jan 2011 22:31:13 +0000 (22:31 +0000)]
Fix a false-positive warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123480 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDelete an assignment to ThisBB which isn't needed, and tidy up some
Dan Gohman [Fri, 14 Jan 2011 22:26:16 +0000 (22:26 +0000)]
Delete an assignment to ThisBB which isn't needed, and tidy up some
comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123479 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance GlobalOpt to be able evaluate initializers that involve stores through
Owen Anderson [Fri, 14 Jan 2011 22:19:20 +0000 (22:19 +0000)]
Enhance GlobalOpt to be able evaluate initializers that involve stores through
bitcasts, at least in simple cases.  This fixes clang's CodeGenCXX/virtual-base-dtor.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123477 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a possibility to switch between CFI directives- and table-based frame description...
Anton Korobeynikov [Fri, 14 Jan 2011 21:58:08 +0000 (21:58 +0000)]
Add a possibility to switch between CFI directives- and table-based frame description emission. Currently all the backends use table-based stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123476 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCleanup
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:58 +0000 (21:57 +0000)]
Cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123475 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd CFI directives-based frame information emission. Not hooked yet.
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:53 +0000 (21:57 +0000)]
Add CFI directives-based frame information emission. Not hooked yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123474 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSplit stuff as a preparation for CFI directives-based frame information emission
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:45 +0000 (21:57 +0000)]
Split stuff as a preparation for CFI directives-based frame information emission

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123473 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse common style for .cfi directives
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:39 +0000 (21:57 +0000)]
Use common style for .cfi directives

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123472 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport for precise scheduling of the instruction selection DAG,
Andrew Trick [Fri, 14 Jan 2011 21:11:41 +0000 (21:11 +0000)]
Support for precise scheduling of the instruction selection DAG,
disabled in this checkin. Sorry for the large diffs due to
refactoring. New functionality is all guarded by EnableSchedCycles.

Scheduling the isel DAG is inherently imprecise, but we give it a best
effort:
- Added MayReduceRegPressure to allow stalled nodes in the queue only
  if there is a regpressure need.
- Added BUHasStall to allow checking for either dependence stalls due to
  latency or resource stalls due to pipeline hazards.
- Added BUCompareLatency to encapsulate and standardize the heuristics
  for minimizing stall cycles (vs. reducing register pressure).
- Modified the bottom-up heuristic (now in BUCompareLatency) to
  prioritize nodes by their depth rather than height. As long as it
  doesn't stall, height is irrelevant. Depth represents the critical
  path to the DAG root.
- Added hybrid_ls_rr_sort::isReady to filter stalled nodes before
  adding them to the available queue.

Related Cleanup: most of the register reduction routines do not need
to be templates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123468 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoswitch SRoA to use LoadAndStorePromoter instead of its own copy of the code.
Chris Lattner [Fri, 14 Jan 2011 19:50:47 +0000 (19:50 +0000)]
switch SRoA to use LoadAndStorePromoter instead of its own copy of the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123457 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a new LoadAndStorePromoter class, which implements the general
Chris Lattner [Fri, 14 Jan 2011 19:36:13 +0000 (19:36 +0000)]
Add a new LoadAndStorePromoter class, which implements the general
"promote a bunch of load and stores" logic, allowing the code to
be shared and reused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123456 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOperandTraits<>::Layout isn't used for anything. Remove it.
Jay Foad [Fri, 14 Jan 2011 18:41:56 +0000 (18:41 +0000)]
OperandTraits<>::Layout isn't used for anything. Remove it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123452 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate llvm-gcc's tests.
Rafael Espindola [Fri, 14 Jan 2011 17:01:20 +0000 (17:01 +0000)]
Update llvm-gcc's tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123447 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReorder macros on config.h.cmake to easily compare it against
Oscar Fuentes [Fri, 14 Jan 2011 16:41:03 +0000 (16:41 +0000)]
Reorder macros on config.h.cmake to easily compare it against
config.h.in.

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123445 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDisable debug mode.
Devang Patel [Fri, 14 Jan 2011 15:55:50 +0000 (15:55 +0000)]
Disable debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123443 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTurn X-(X-Y) into Y. According to my auto-simplifier this is the most common
Duncan Sands [Fri, 14 Jan 2011 15:26:10 +0000 (15:26 +0000)]
Turn X-(X-Y) into Y.  According to my auto-simplifier this is the most common
simplification present in fully optimized code (I think instcombine fails to
transform some of these when "X-Y" has more than one use).  Fires here and
there all over the test-suite, for example it eliminates 8 subtractions in
the final IR for 445.gobmk, 2 subs in 447.dealII, 2 in paq8p etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123442 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFactorize common code out of the InstructionSimplify shift logic. Add in
Duncan Sands [Fri, 14 Jan 2011 14:44:12 +0000 (14:44 +0000)]
Factorize common code out of the InstructionSimplify shift logic.  Add in
threading of shifts over selects and phis while there.  This fires here and
there in the testsuite, to not much effect.  For example when compiling spirit
it fires 5 times, during early-cse, resulting in 6 more cse simplifications,
and 3 more terminators being folded by jump threading, but the final bitcode
doesn't change in any interesting way: other optimizations would have caught
the opportunity anyway, only later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123441 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename this test.
Duncan Sands [Fri, 14 Jan 2011 14:16:33 +0000 (14:16 +0000)]
Rename this test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123440 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoswitch the second scalarrepl pass to use SSAUpdater. We run two scalarrepl passes...
Chris Lattner [Fri, 14 Jan 2011 08:21:08 +0000 (08:21 +0000)]
switch the second scalarrepl pass to use SSAUpdater.  We run two scalarrepl passes: one
early in the cleanup code and one late interlaced with the inliner.  The second one is
important because inlining and other scalar optzns can unpin allocas, allowing them to
be split up and promoted.  While important for performance, this is also relatively
rare, and we would previously force a (non-lazy) computation of DomFrontiers, which
happened even if nothing became unpinned.

With this patch, the first pass of scalarrepl still promotes the vast bulk of allocas
in programs, but hte second pass has changed to use SSAUpdater, which is more "sparse"
and lazy.  This speeds up opt -O3 time on kimwitu++ (a c++ app) by about 1%.  The
numbers are interesting: the first pass promotes ~17500 allocas.  The second pass
promotes about 1600.  For non-C++ codes, the compile time win should be greater,
because the second pass of scalarrepl does less.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123437 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosplit SROA into two passes: one that uses DomFrontiers (-scalarrepl)
Chris Lattner [Fri, 14 Jan 2011 08:13:00 +0000 (08:13 +0000)]
split SROA into two passes: one that uses DomFrontiers (-scalarrepl)
and one that uses SSAUpdater (-scalarrepl-ssa)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123436 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove casts between Value** and Constant**, which won't work if a
Jay Foad [Fri, 14 Jan 2011 08:07:43 +0000 (08:07 +0000)]
Remove casts between Value** and Constant**, which won't work if a
static_cast from Constant* to Value* has to adjust the "this" pointer.
This is groundwork for PR889.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123435 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement full support for promoting allocas to registers using SSAUpdater
Chris Lattner [Fri, 14 Jan 2011 07:50:47 +0000 (07:50 +0000)]
Implement full support for promoting allocas to registers using SSAUpdater
instead of DomTree/DomFrontier.  This may be interesting for reducing compile
time.  This is currently disabled, but seems to work just fine.

When this is enabled, we eliminate two runs of dominator frontier, one in the
"early per-function" optimizations and one in the "interlaced with inliner"
function passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123434 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agorelax testcase a bit.
Chris Lattner [Fri, 14 Jan 2011 07:46:33 +0000 (07:46 +0000)]
relax testcase a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123433 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTry for the third time to teach getFirstTerminator() about debug values.
Jakob Stoklund Olesen [Fri, 14 Jan 2011 06:33:45 +0000 (06:33 +0000)]
Try for the third time to teach getFirstTerminator() about debug values.

This time let's rephrase to trick gcc-4.3 into not miscompiling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123432 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agorevert my fastisel patch again which apparently still gives the
Chris Lattner [Fri, 14 Jan 2011 06:14:33 +0000 (06:14 +0000)]
revert my fastisel patch again which apparently still gives the
llvm-gcc-i386-linux-selfhost buildbot heartburn...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123431 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoreapply r123414 now that the botz are calmed down and the fix is already in.
Chris Lattner [Fri, 14 Jan 2011 04:24:28 +0000 (04:24 +0000)]
reapply r123414 now that the botz are calmed down and the fix is already in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123427 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoindentation
Chris Lattner [Fri, 14 Jan 2011 04:23:53 +0000 (04:23 +0000)]
indentation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123426 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCompleted :lower16: / :upper16: support for movw / movt pairs on Darwin.
Evan Cheng [Fri, 14 Jan 2011 02:38:49 +0000 (02:38 +0000)]
Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.
- Fixed :upper16: fix up routine. It should be shifting down the top 16 bits first.
- Added support for Thumb2 :lower16: and :upper16: fix up.
- Added :upper16: and :lower16: relocation support to mach-o object writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123424 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r123419. It still breaks llvm-gcc-i386-linux-selfhost.
Jakob Stoklund Olesen [Fri, 14 Jan 2011 02:12:54 +0000 (02:12 +0000)]
Revert r123419. It still breaks llvm-gcc-i386-linux-selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123423 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agor123414 broke llvm-gcc bootstrap apparently, revert
Chris Lattner [Fri, 14 Jan 2011 02:07:32 +0000 (02:07 +0000)]
r123414 broke llvm-gcc bootstrap apparently, revert

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123422 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSet the insertion point correctly for instructions generated by load folding:
Chris Lattner [Fri, 14 Jan 2011 01:33:40 +0000 (01:33 +0000)]
Set the insertion point correctly for instructions generated by load folding:
they should go *before* the new instruction not after it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123420 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTry again to teach getFirstTerminator() about debug values.
Jakob Stoklund Olesen [Fri, 14 Jan 2011 01:17:53 +0000 (01:17 +0000)]
Try again to teach getFirstTerminator() about debug values.

Fix some callers to better deal with debug values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123419 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRather than doing early instcombine, try doing early CSE instead. This should still...
Owen Anderson [Fri, 14 Jan 2011 00:41:11 +0000 (00:41 +0000)]
Rather than doing early instcombine, try doing early CSE instead.  This should still handle
most important simplifications, as well as resolving phase ordering issues where instcombine
would inhibit important CSE'ing opportunities, for instance on BitBench/drop3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123418 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove some shift transforms out of instcombine and into InstructionSimplify.
Duncan Sands [Fri, 14 Jan 2011 00:37:45 +0000 (00:37 +0000)]
Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything.  I fixed this in the constant folder as well.  Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero.  This is in accordance with the LangRef, but I must
admit that it is fairly aggressive.  Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't bother conditionalizing the use of SROA in -O1 mode. We're already running...
Owen Anderson [Fri, 14 Jan 2011 00:36:40 +0000 (00:36 +0000)]
Don't bother conditionalizing the use of SROA in -O1 mode.  We're already running it unconditionally
later in the pipeline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123416 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix PR8961 - a fast isel miscompilation where we'd insert a new instruction
Chris Lattner [Fri, 14 Jan 2011 00:01:01 +0000 (00:01 +0000)]
fix PR8961 - a fast isel miscompilation where we'd insert a new instruction
after sext's generated for addressing that got folded.  Previously we compiled
test5 into:

_test5:                                 ## @test5
## BB#0:
        movq    -8(%rsp), %rax          ## 8-byte Reload
        movq    (%rdi,%rax), %rdi
        addq    %rdx, %rdi
        movslq  %esi, %rax
        movq    %rax, -8(%rsp)          ## 8-byte Spill
        movq    %rdi, %rax
        ret

which is insane and wrong.  Now we produce:

_test5:                                 ## @test5
## BB#0:
movslq %esi, %rax
movq (%rdi,%rax), %rax
addq %rdx, %rax
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123414 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBetter terminator avoidance.
Jakob Stoklund Olesen [Thu, 13 Jan 2011 23:35:53 +0000 (23:35 +0000)]
Better terminator avoidance.

This approach also works when the terminator doesn't have a slot index. (Which
can happen??)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123413 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd comment about Thumb2 fixup comments being completely bogus.
Evan Cheng [Thu, 13 Jan 2011 23:27:39 +0000 (23:27 +0000)]
Add comment about Thumb2 fixup comments being completely bogus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123411 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd single entry / single exit accessors.
Tobias Grosser [Thu, 13 Jan 2011 23:18:04 +0000 (23:18 +0000)]
Add single entry / single exit accessors.

Add methods for accessing the (single) entry / exit edge of a region. If no such
edge exists, null is returned.  Both accessors return the start block of the
corresponding edge. The edge can finally be formed by utilizing
Region::getEntry() or Region::getExit();

Contributed by: Andreas Simbuerger <simbuerg@fim.uni-passau.de>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123410 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRecognize alternative register names like ip -> r12.
Owen Anderson [Thu, 13 Jan 2011 22:50:36 +0000 (22:50 +0000)]
Recognize alternative register names like ip -> r12.
Fixes <rdar://problem/8857982>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123409 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a few more places that should use MBB::getLastNonDebugInstr().
Jakob Stoklund Olesen [Thu, 13 Jan 2011 22:47:43 +0000 (22:47 +0000)]
Fix a few more places that should use MBB::getLastNonDebugInstr().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123408 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAs far as I can tell, unified syntax uses c0-c15 instead of cr0-cr15 for mcr and...
Owen Anderson [Thu, 13 Jan 2011 22:38:16 +0000 (22:38 +0000)]
As far as I can tell, unified syntax uses c0-c15 instead of cr0-cr15 for mcr and friends.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123407 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agotypo
Chris Lattner [Thu, 13 Jan 2011 22:11:56 +0000 (22:11 +0000)]
typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123406 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agomemcpy + metadata = bliss :)
Chris Lattner [Thu, 13 Jan 2011 22:08:15 +0000 (22:08 +0000)]
memcpy + metadata = bliss :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123405 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support to the ARM MC infrastructure to support mcr and friends. This requires...
Owen Anderson [Thu, 13 Jan 2011 21:46:02 +0000 (21:46 +0000)]
Add support to the ARM MC infrastructure to support mcr and friends. This requires supporting
the symbolic immediate names used for these instructions, fixing their pretty-printers, and
adding proper encoding information for them.

With this, we can properly pretty-print and encode assembly like:
mrc p15, #0, r3, c13, c0, #3

Fixes <rdar://problem/8857858>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123404 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRelax an assertion. On archs like ARM, an immediate field may be scattered. So it...
Evan Cheng [Thu, 13 Jan 2011 21:45:26 +0000 (21:45 +0000)]
Relax an assertion. On archs like ARM, an immediate field may be scattered. So it's possible for some bits of every 8 bits to be encoded already, and the rest still needs to be fixed up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123403 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTemporary workaround for an i386 crash in LiveDebugVariables.
Jakob Stoklund Olesen [Thu, 13 Jan 2011 21:28:55 +0000 (21:28 +0000)]
Temporary workaround for an i386 crash in LiveDebugVariables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123400 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach frame lowering to ignore debug values after the terminators.
Jakob Stoklund Olesen [Thu, 13 Jan 2011 21:28:52 +0000 (21:28 +0000)]
Teach frame lowering to ignore debug values after the terminators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123399 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTidy comments, indentation, and 80-column violations.
Bob Wilson [Thu, 13 Jan 2011 21:10:12 +0000 (21:10 +0000)]
Tidy comments, indentation, and 80-column violations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123397 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix whitespace.
Bob Wilson [Thu, 13 Jan 2011 20:59:44 +0000 (20:59 +0000)]
Fix whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123396 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix ARMAsmParser::ParseOperand() to allow it to parse . as a branch target and
Kevin Enderby [Thu, 13 Jan 2011 20:32:36 +0000 (20:32 +0000)]
Fix ARMAsmParser::ParseOperand() to allow it to parse . as a branch target and
directional local labels like 1f and 2b.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123393 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLittle help to debug the bugpoint itself.
Devang Patel [Thu, 13 Jan 2011 19:48:54 +0000 (19:48 +0000)]
Little help to debug the bugpoint itself.
Patch by Bob Wilson.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123390 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSpeculatively revert r123384 to make llvm-gcc-i386-linux-selfhost buildbot happy.
Devang Patel [Thu, 13 Jan 2011 19:27:50 +0000 (19:27 +0000)]
Speculatively revert r123384  to make llvm-gcc-i386-linux-selfhost buildbot happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123389 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd some platform tests.
Oscar Fuentes [Thu, 13 Jan 2011 19:17:28 +0000 (19:17 +0000)]
Add some platform tests.

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123388 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen updating a tSpill/tRestore instruction to be a tSTRr/tLDRr, correctly
Jim Grosbach [Thu, 13 Jan 2011 19:16:48 +0000 (19:16 +0000)]
When updating a tSpill/tRestore instruction to be a tSTRr/tLDRr, correctly
set up the source operands. The original instr has an immediate operand that
should be replaced with the frame reg operand rather than just adding the
reg operand. Previously, the instruction ended up with too many operands
causing an assert() when adding the default predicate. rdar://8825456

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123387 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach MachineBasicBlock::getFirstTerminator to ignore debug values.
Jakob Stoklund Olesen [Thu, 13 Jan 2011 18:41:05 +0000 (18:41 +0000)]
Teach MachineBasicBlock::getFirstTerminator to ignore debug values.

It will still return an iterator that points to the first terminator or end(),
but there may be DBG_VALUE instructions following the first terminator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123384 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCheck for empty structs, and for consistency, zero-element arrays.
Bob Wilson [Thu, 13 Jan 2011 18:26:59 +0000 (18:26 +0000)]
Check for empty structs, and for consistency, zero-element arrays.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123383 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoExtend SROA to handle arrays accessed as homogeneous structs and vice versa.
Bob Wilson [Thu, 13 Jan 2011 17:45:11 +0000 (17:45 +0000)]
Extend SROA to handle arrays accessed as homogeneous structs and vice versa.

This is a minor extension of SROA to handle a special case that is
important for some ARM NEON operations.  Some of the NEON intrinsics
return multiple values, which are handled as struct types containing
multiple elements of the same vector type.  The corresponding return
types declared in the arm_neon.h header have equivalent arrays.  We
need SROA to recognize that it can split up those arrays and structs
into separate vectors, even though they are not always accessed with
the same type.  SROA already handles loads and stores of an entire
alloca by using insertvalue/extractvalue to access the individual
pieces, and that code works the same regardless of whether the type
is a struct or an array.  So, all that needs to be done is to check
for compatible arrays and homogeneous structs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123381 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake SROA more aggressive with allocas containing padding.
Bob Wilson [Thu, 13 Jan 2011 17:45:08 +0000 (17:45 +0000)]
Make SROA more aggressive with allocas containing padding.

SROA only split up structs and arrays one level at a time, so padding can
only cause trouble if it is located in between the struct or array elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123380 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDisable RTTI when building unit tests. This avoids errors at link time.
Oscar Fuentes [Thu, 13 Jan 2011 15:31:45 +0000 (15:31 +0000)]
Disable RTTI when building unit tests. This avoids errors at link time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123377 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPlatform tests for argz_* functions.
Oscar Fuentes [Thu, 13 Jan 2011 15:06:32 +0000 (15:06 +0000)]
Platform tests for argz_* functions.

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123376 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove some wrong code which fortunately was never executed (as explained in
Duncan Sands [Thu, 13 Jan 2011 10:43:08 +0000 (10:43 +0000)]
Remove some wrong code which fortunately was never executed (as explained in
the comment I added): an extern weak global may have a null address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123373 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe most common simplification missed by instsimplify in unoptimized bitcode
Duncan Sands [Thu, 13 Jan 2011 08:56:29 +0000 (08:56 +0000)]
The most common simplification missed by instsimplify in unoptimized bitcode
is "X != 0 -> X" when X is a boolean.  This occurs a lot because of the way
llvm-gcc converts gcc's conditional expressions.  Add this, and a few other
similar transforms for completeness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123372 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoModel :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
Evan Cheng [Thu, 13 Jan 2011 07:58:56 +0000 (07:58 +0000)]
Model :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
in the right direction. It eliminated some hacks and will unblock codegen
work. But it's far from being done. It doesn't reject illegal expressions,
e.g. (FOO - :lower16:BAR). It also doesn't work in Thumb2 mode at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123369 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoExperiment with changing the default 32-bit linux stack alignment to
Eric Christopher [Thu, 13 Jan 2011 06:47:10 +0000 (06:47 +0000)]
Experiment with changing the default 32-bit linux stack alignment to
16 bytes for PR8969. Update all testcases accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123367 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoKeep unnamed_addr when linking.
Rafael Espindola [Thu, 13 Jan 2011 05:12:34 +0000 (05:12 +0000)]
Keep unnamed_addr when linking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123364 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReject uses of unnamed_addr in declarations.
Rafael Espindola [Thu, 13 Jan 2011 01:30:30 +0000 (01:30 +0000)]
Reject uses of unnamed_addr in declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123358 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a FIXME and two asserts for now in the ARMAsmParser when it sees .code 16 or
Kevin Enderby [Thu, 13 Jan 2011 01:07:01 +0000 (01:07 +0000)]
Add a FIXME and two asserts for now in the ARMAsmParser when it sees .code 16 or
.code 32 if the TargetMachine's isThumb() boolean does not match.  The correct
fix is to switch ARM subtargets at that point and is tracked by rdar://8856789
which is bigger task.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123353 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix r123346 to handle scalar types too.
Dan Gohman [Thu, 13 Jan 2011 01:06:51 +0000 (01:06 +0000)]
Fix r123346 to handle scalar types too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123352 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd missing space in debug output
Jakob Stoklund Olesen [Thu, 13 Jan 2011 00:57:35 +0000 (00:57 +0000)]
Add missing space in debug output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123351 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange call to Error() to assert()
Jason W Kim [Thu, 13 Jan 2011 00:27:00 +0000 (00:27 +0000)]
Change call to Error() to assert()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123350 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStyle clean up - break up the breaks.
Jason W Kim [Thu, 13 Jan 2011 00:07:51 +0000 (00:07 +0000)]
Style clean up - break up the breaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123347 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoApply the patch from PR8958, which allows llc to get slightly
Dan Gohman [Wed, 12 Jan 2011 23:56:26 +0000 (23:56 +0000)]
Apply the patch from PR8958, which allows llc to get slightly
further on the associated testcase before aborting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123346 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport/Path: Deprecate PathV1::IsSymlink and replace all uses with PathV2::is_symlink.
Michael J. Spencer [Wed, 12 Jan 2011 23:55:06 +0000 (23:55 +0000)]
Support/Path: Deprecate PathV1::IsSymlink and replace all uses with PathV2::is_symlink.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123345 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTry again enabling LiveDebugVariables.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 23:36:21 +0000 (23:36 +0000)]
Try again enabling LiveDebugVariables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123342 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdded clarifying comment
Jason W Kim [Wed, 12 Jan 2011 23:25:02 +0000 (23:25 +0000)]
Added clarifying comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123341 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoJimG sez: "The value-kinds look like masks, but they're not consistently used
Jason W Kim [Wed, 12 Jan 2011 23:21:49 +0000 (23:21 +0000)]
JimG sez: "The value-kinds look like masks, but they're not consistently used
that way, unfortunately. If you want to change them to work additively instead
of a one-variant-kind-per-symbolref, that's great and I completely agree it's
worth doing, but it really should be a separate patch. Until then, this isn't
correct."

So I am reverting this bit until a more opportune time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123340 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't emit a DBG_VALUE for a spill slot that the rewriter decided not to use after...
Jakob Stoklund Olesen [Wed, 12 Jan 2011 23:14:07 +0000 (23:14 +0000)]
Don't emit a DBG_VALUE for a spill slot that the rewriter decided not to use after all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123339 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix braino in dominator tree walk.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 23:14:04 +0000 (23:14 +0000)]
Fix braino in dominator tree walk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123338 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSometimes, old virtual registers can linger on DBG_VALUE instructions.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 22:37:49 +0000 (22:37 +0000)]
Sometimes, old virtual registers can linger on DBG_VALUE instructions.

Make sure we don't crash in that case, but simply turn them into %noreg instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123335 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach VirtRegRewriter to update slot indexes when erasing instructions.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 22:28:51 +0000 (22:28 +0000)]
Teach VirtRegRewriter to update slot indexes when erasing instructions.

It was leaving dangling pointers in the slot index maps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123334 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAnnotate VirtRegRewriter debug output with slot indexes.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 22:28:48 +0000 (22:28 +0000)]
Annotate VirtRegRewriter debug output with slot indexes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123333 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoVerify slot index ordering.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 21:27:48 +0000 (21:27 +0000)]
Verify slot index ordering.

The slot indexes must be monotonically increasing through the function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123324 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAssert if anybody tries to put a slot index on a DBG_VALUE instruction.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 21:27:45 +0000 (21:27 +0000)]
Assert if anybody tries to put a slot index on a DBG_VALUE instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123323 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoVerify that machine instruction parent pointers are consistent.
Jakob Stoklund Olesen [Wed, 12 Jan 2011 21:27:41 +0000 (21:27 +0000)]
Verify that machine instruction parent pointers are consistent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123322 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSort the register list based on the *actual* register numbers rather than the
Bill Wendling [Wed, 12 Jan 2011 21:20:59 +0000 (21:20 +0000)]
Sort the register list based on the *actual* register numbers rather than the
enum values we give to them. <rdar://problem/8823730>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123321 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse SmallVector instead of SmallPtrSet and avoid non-deterministic behavior.
Devang Patel [Wed, 12 Jan 2011 19:12:45 +0000 (19:12 +0000)]
Use SmallVector instead of SmallPtrSet and avoid non-deterministic behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123318 91177308-0d34-0410-b5e6-96231b3b80d8