oota-llvm.git
12 years agoMove getPointerToNamedFunction() from JIT/MCJIT to JITMemoryManager.
Danil Malyshev [Wed, 28 Mar 2012 21:46:36 +0000 (21:46 +0000)]
Move getPointerToNamedFunction() from JIT/MCJIT to JITMemoryManager.

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

12 years agoHandle intrinsics in GlobalsModRef. Fixes pr12351.
Rafael Espindola [Wed, 28 Mar 2012 21:31:24 +0000 (21:31 +0000)]
Handle intrinsics in GlobalsModRef. Fixes pr12351.

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

12 years agoSpill DPair registers, not just QPR.
Jakob Stoklund Olesen [Wed, 28 Mar 2012 21:20:32 +0000 (21:20 +0000)]
Spill DPair registers, not just QPR.

The arm_neon intrinsics can create virtual registers from the DPair
register class which allows both even-odd and odd-even D-register pairs.

This fixes PR12389.

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

12 years agoAlso verify after ExpandPostRAPseudos.
Jakob Stoklund Olesen [Wed, 28 Mar 2012 20:49:30 +0000 (20:49 +0000)]
Also verify after ExpandPostRAPseudos.

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

12 years agoInline function into its one caller.
Bill Wendling [Wed, 28 Mar 2012 20:48:49 +0000 (20:48 +0000)]
Inline function into its one caller.

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

12 years agoEnable machine code verification after the late machine optimization passes.
Jakob Stoklund Olesen [Wed, 28 Mar 2012 20:47:37 +0000 (20:47 +0000)]
Enable machine code verification after the late machine optimization passes.

Branch folding invalidates liveness and disables liveness verification
on some targets.

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

12 years agoSkip liveness verification when MRI->tracksLiveness() is false.
Jakob Stoklund Olesen [Wed, 28 Mar 2012 20:47:35 +0000 (20:47 +0000)]
Skip liveness verification when MRI->tracksLiveness() is false.

Extract the liveness verification into its own method.

This makes it possible to run the machine code verifier after liveness
information is no longer required to be valid.

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

12 years agoReformat the LTOModule code to be more inline with LLVM's coding standards. Add
Bill Wendling [Wed, 28 Mar 2012 20:46:54 +0000 (20:46 +0000)]
Reformat the LTOModule code to be more inline with LLVM's coding standards. Add
a bunch of comments for the various functions. No intended functionality change.

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

12 years agoRevert r153516: "Invalidate liveness in Thumb2ITBlockPass."
Jakob Stoklund Olesen [Wed, 28 Mar 2012 20:11:44 +0000 (20:11 +0000)]
Revert r153516: "Invalidate liveness in Thumb2ITBlockPass."
Revert r153519: "ARMLoadStoreOptimizer invalidates register liveness."

These patches caused miscompilations in povray by turning off branch
folding's updating of live-in lists.

It turns out the the late scheduler depends on the live-in lists, even
if it doesn't need correct kill flags.

<rdar://problem/11139228>

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

12 years agoAllow removeLiveIn to be called with a register that isn't live-in.
Jakob Stoklund Olesen [Wed, 28 Mar 2012 20:11:42 +0000 (20:11 +0000)]
Allow removeLiveIn to be called with a register that isn't live-in.

This avoids the silly double search:

  if (isLiveIn(Reg))
    removeLiveIn(Reg);

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

12 years agoRevert r153521 as it's causing large regressions on the nightly testers.
Chad Rosier [Wed, 28 Mar 2012 18:42:50 +0000 (18:42 +0000)]
Revert r153521 as it's causing large regressions on the nightly testers.
Original commit message for r153521 (aka r153423):
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.

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

12 years agoFixed commuteInstructions bug where if its called pre-regalloc the subreg indices...
Pete Cooper [Wed, 28 Mar 2012 17:02:22 +0000 (17:02 +0000)]
Fixed commuteInstructions bug where if its called pre-regalloc the subreg indices weren't commuted

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

12 years agoGlobalOpt: If we have an inbounds GEP from a ConstantAggregateZero global that we...
Benjamin Kramer [Wed, 28 Mar 2012 14:50:09 +0000 (14:50 +0000)]
GlobalOpt: If we have an inbounds GEP from a ConstantAggregateZero global that we just determined to be constant, replace all loads from it with a zero value.

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

12 years agoAdd another note about a missed compare with nsw arithmetic instcombine.
Benjamin Kramer [Wed, 28 Mar 2012 10:50:18 +0000 (10:50 +0000)]
Add another note about a missed compare with nsw arithmetic instcombine.

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

12 years agoFixup VST1.32 with writeback instruction. Also re-factor non-writeback version.
Richard Barton [Wed, 28 Mar 2012 10:18:11 +0000 (10:18 +0000)]
Fixup VST1.32 with writeback instruction. Also re-factor non-writeback version.

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

12 years agoSwitch to WeakVHs in the value mapper, and aggressively prune dead basic
Chandler Carruth [Wed, 28 Mar 2012 08:38:27 +0000 (08:38 +0000)]
Switch to WeakVHs in the value mapper, and aggressively prune dead basic
blocks in the function cloner. This removes the last case of trivially
dead code that I've been seeing in the wild getting inlined, analyzed,
re-inlined, optimized, only to be deleted. Nukes a FIXME from the
cleanup tests.

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

12 years agoMore debug output.
Eric Christopher [Wed, 28 Mar 2012 07:34:36 +0000 (07:34 +0000)]
More debug output.

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

12 years agoFix the output of the DW_TAG_friend tag to include DW_AT_friend
Eric Christopher [Wed, 28 Mar 2012 07:34:31 +0000 (07:34 +0000)]
Fix the output of the DW_TAG_friend tag to include DW_AT_friend
and not the rest of the member tag.

Fixes PR11695

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

12 years agoSome whitespace cleanup.
Bill Wendling [Wed, 28 Mar 2012 04:17:34 +0000 (04:17 +0000)]
Some whitespace cleanup.

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

12 years agoUse the correct filename for the error message.
Bill Wendling [Wed, 28 Mar 2012 02:39:06 +0000 (02:39 +0000)]
Use the correct filename for the error message.

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

12 years agoUse Nakamura's suggestion of bypassing using 'filename' and just the pointers directly.
Bill Wendling [Wed, 28 Mar 2012 01:30:51 +0000 (01:30 +0000)]
Use Nakamura's suggestion of bypassing using 'filename' and just the pointers directly.

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

12 years agoTurn off post-RA scheduler by default.
Akira Hatanaka [Wed, 28 Mar 2012 00:52:23 +0000 (00:52 +0000)]
Turn off post-RA scheduler by default.

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

12 years agoFix 80-column violation.
Chad Rosier [Wed, 28 Mar 2012 00:35:33 +0000 (00:35 +0000)]
Fix 80-column violation.

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

12 years agoFix test case.
Akira Hatanaka [Wed, 28 Mar 2012 00:25:01 +0000 (00:25 +0000)]
Fix test case.

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

12 years agoTurn on post register allocation scheduler.
Akira Hatanaka [Wed, 28 Mar 2012 00:24:17 +0000 (00:24 +0000)]
Turn on post register allocation scheduler.

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

12 years agoSort relocation entries before they are written out to a file. MIPS ABI
Akira Hatanaka [Wed, 28 Mar 2012 00:23:33 +0000 (00:23 +0000)]
Sort relocation entries before they are written out to a file. MIPS ABI
imposes a constraint that GOT16 referring to a local symbol or HI16 has to be
followed immediately by a matching LO16 relocation.

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

12 years agoEmit all directives except for ".cprestore" during asm printing rather than emit
Akira Hatanaka [Wed, 28 Mar 2012 00:22:50 +0000 (00:22 +0000)]
Emit all directives except for ".cprestore" during asm printing rather than emit
them as machine instructions. Directives ".set noat" and ".set at" are now
emitted only at the beginning and end of a function except in the case where
they are emitted to enclose .cpload with an immediate operand that doesn't fit
in 16-bit field or unaligned load/stores.

Also, make the following changes:
- Remove function isUnalignedLoadStore and use a switch-case statement to
  determine whether an instruction is an unaligned load or store.

- Define helper function CreateMCInst which generates an instance of an MCInst
  from an opcode and a list of operands.

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

12 years agoMark flag neverHasSideEffects of pattern-less instructions that do not have
Akira Hatanaka [Wed, 28 Mar 2012 00:21:37 +0000 (00:21 +0000)]
Mark flag neverHasSideEffects of pattern-less instructions that do not have
any side effects.

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

12 years agoMSVC doesn't like the mixing of declarations and statements in a .c file.
Francois Pichet [Tue, 27 Mar 2012 23:52:22 +0000 (23:52 +0000)]
MSVC doesn't like the mixing of declarations and statements in a .c file.

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

12 years agoAdd a note about a cute little fabs optimization.
Benjamin Kramer [Tue, 27 Mar 2012 22:42:42 +0000 (22:42 +0000)]
Add a note about a cute little fabs optimization.

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

12 years agoAdd two missed instcombines related to compares with nsw arithmetic.
Benjamin Kramer [Tue, 27 Mar 2012 22:03:19 +0000 (22:03 +0000)]
Add two missed instcombines related to compares with nsw arithmetic.

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

12 years agoTry to use the CWD if the path to the GCDA output is not available (e.g., the
Bill Wendling [Tue, 27 Mar 2012 21:17:04 +0000 (21:17 +0000)]
Try to use the CWD if the path to the GCDA output is not available (e.g., the
executable has been moved to another machine). If that's not available
(read-only or something), then exit gracefully.
<rdar://problem/11111686>

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

12 years agoRemove trailing white space.
Akira Hatanaka [Tue, 27 Mar 2012 20:35:51 +0000 (20:35 +0000)]
Remove trailing white space.

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

12 years agoUse a SmallVector and linear lookup instead of a DenseSet - SourceMap values
Lang Hames [Tue, 27 Mar 2012 19:10:45 +0000 (19:10 +0000)]
Use a SmallVector and linear lookup instead of a DenseSet - SourceMap values
will always be tiny sets, so DenseSet is overkill (SmallSet won't work as we
need iteration support).

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

12 years agoAdd member EmitNOAT and its setter and getter functions to class MipsFunctionInfo.
Akira Hatanaka [Tue, 27 Mar 2012 19:08:42 +0000 (19:08 +0000)]
Add member EmitNOAT and its setter and getter functions to class MipsFunctionInfo.
If EmitNOAT is true, directives ".set noat" and ".set at" are emitted at the
beginning and end of a function.

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

12 years agoAdd a test for the previous commit. Also, remove two tests that were
Eric Christopher [Tue, 27 Mar 2012 18:35:57 +0000 (18:35 +0000)]
Add a test for the previous commit. Also, remove two tests that were
testing a) the wrong behavior or b) something that I'm already testing
in the new test.

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

12 years agoUse DW_AT_low_pc for a single entry point into a routine.
Eric Christopher [Tue, 27 Mar 2012 18:35:54 +0000 (18:35 +0000)]
Use DW_AT_low_pc for a single entry point into a routine.

Fixes PR10105

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

12 years agoReapply r153423; the original commit was fine. The failing test, distray, had
Chad Rosier [Tue, 27 Mar 2012 17:44:52 +0000 (17:44 +0000)]
Reapply r153423; the original commit was fine.  The failing test, distray, had
undefined behavior, which Rafael was kind enough to fix.

Original commit message for r153423:
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.

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

12 years agoARMLoadStoreOptimizer invalidates register liveness.
Jakob Stoklund Olesen [Tue, 27 Mar 2012 17:33:52 +0000 (17:33 +0000)]
ARMLoadStoreOptimizer invalidates register liveness.

This pass tries to update kill flags, but there are still many bugs.
Passes after the load/store optimizer don't need accurate liveness, so
don't even try.

<rdar://problem/11101911>

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

12 years agoPrint SSA and liveness tracking flags in MF::print().
Jakob Stoklund Olesen [Tue, 27 Mar 2012 17:17:16 +0000 (17:17 +0000)]
Print SSA and liveness tracking flags in MF::print().

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

12 years agoBranch folding may invalidate liveness.
Jakob Stoklund Olesen [Tue, 27 Mar 2012 17:06:09 +0000 (17:06 +0000)]
Branch folding may invalidate liveness.

Branch folding can use a register scavenger to update liveness
information when required. Don't do that if liveness information is
already invalid.

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

12 years agoInvalidate liveness in Thumb2ITBlockPass.
Jakob Stoklund Olesen [Tue, 27 Mar 2012 17:06:06 +0000 (17:06 +0000)]
Invalidate liveness in Thumb2ITBlockPass.

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

12 years agofix what looks like a real logic bug, found by PVS-Studio (part of PR12357)
Chris Lattner [Tue, 27 Mar 2012 16:27:21 +0000 (16:27 +0000)]
fix what looks like a real logic bug, found by PVS-Studio (part of PR12357)

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

12 years agoAdd an MRI::tracksLiveness() flag.
Jakob Stoklund Olesen [Tue, 27 Mar 2012 15:13:58 +0000 (15:13 +0000)]
Add an MRI::tracksLiveness() flag.

Late optimization passes like branch folding and tail duplication can
transform the machine code in a way that makes it expensive to keep the
register liveness information up to date. There is a fuzzy line between
register allocation and late scheduling where the liveness information
degrades.

The MRI::tracksLiveness() flag makes the line clear: While true,
liveness information is accurate, and can be used for register
scavenging. Once the flag is false, liveness information is not
accurate, and can only be used as a hint.

Late passes generally don't need the liveness information, but they will
sometimes use the register scavenger to help update it. The scavenger
enforces strict correctness, and we have to spend a lot of code to
update register liveness that may never be used.

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

12 years agollvm/docs/*.html: Fix markups.
NAKAMURA Takumi [Tue, 27 Mar 2012 11:25:16 +0000 (11:25 +0000)]
llvm/docs/*.html: Fix markups.

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

12 years agoMake a seemingly tiny change to the inliner and fix the generated code
Chandler Carruth [Tue, 27 Mar 2012 10:48:28 +0000 (10:48 +0000)]
Make a seemingly tiny change to the inliner and fix the generated code
size bloat. Unfortunately, I expect this to disable the majority of the
benefit from r152737. I'm hopeful at least that it will fix PR12345. To
explain this requires... quite a bit of backstory I'm afraid.

TL;DR: The change in r152737 actually did The Wrong Thing for
linkonce-odr functions. This change makes it do the right thing. The
benefits we saw were simple luck, not any actual strategy. Benchmark
numbers after a mini-blog-post so that I've written down my thoughts on
why all of this works and doesn't work...

To understand what's going on here, you have to understand how the
"bottom-up" inliner actually works. There are two fundamental modes to
the inliner:

1) Standard fixed-cost bottom-up inlining. This is the mode we usually
   think about. It walks from the bottom of the CFG up to the top,
   looking at callsites, taking information about the callsite and the
   called function and computing th expected cost of inlining into that
   callsite. If the cost is under a fixed threshold, it inlines. It's
   a touch more complicated than that due to all the bonuses, weights,
   etc. Inlining the last callsite to an internal function gets higher
   weighth, etc. But essentially, this is the mode of operation.

2) Deferred bottom-up inlining (a term I just made up). This is the
   interesting mode for this patch an r152737. Initially, this works
   just like mode #1, but once we have the cost of inlining into the
   callsite, we don't just compare it with a fixed threshold. First, we
   check something else. Let's give some names to the entities at this
   point, or we'll end up hopelessly confused. We're considering
   inlining a function 'A' into its callsite within a function 'B'. We
   want to check whether 'B' has any callers, and whether it might be
   inlined into those callers. If so, we also check whether inlining 'A'
   into 'B' would block any of the opportunities for inlining 'B' into
   its callers. We take the sum of the costs of inlining 'B' into its
   callers where that inlining would be blocked by inlining 'A' into
   'B', and if that cost is less than the cost of inlining 'A' into 'B',
   then we skip inlining 'A' into 'B'.

Now, in order for #2 to make sense, we have to have some confidence that
we will actually have the opportunity to inline 'B' into its callers
when cheaper, *and* that we'll be able to revisit the decision and
inline 'A' into 'B' if that ever becomes the correct tradeoff. This
often isn't true for external functions -- we can see very few of their
callers, and we won't be able to re-consider inlining 'A' into 'B' if
'B' is external when we finally see more callers of 'B'. There are two
cases where we believe this to be true for C/C++ code: functions local
to a translation unit, and functions with an inline definition in every
translation unit which uses them. These are represented as internal
linkage and linkonce-odr (resp.) in LLVM. I enabled this logic for
linkonce-odr in r152737.

Unfortunately, when I did that, I also introduced a subtle bug. There
was an implicit assumption that the last caller of the function within
the TU was the last caller of the function in the program. We want to
bonus the last caller of the function in the program by a huge amount
for inlining because inlining that callsite has very little cost.
Unfortunately, the last caller in the TU of a linkonce-odr function is
*not* the last caller in the program, and so we don't want to apply this
bonus. If we do, we can apply it to one callsite *per-TU*. Because of
the way deferred inlining works, when it sees this bonus applied to one
callsite in the TU for 'B', it decides that inlining 'B' is of the
*utmost* importance just so we can get that final bonus. It then
proceeds to essentially force deferred inlining regardless of the actual
cost tradeoff.

The result? PR12345: code bloat, code bloat, code bloat. Another result
is getting *damn* lucky on a few benchmarks, and the over-inlining
exposing critically important optimizations. I would very much like
a list of benchmarks that regress after this change goes in, with
bitcode before and after. This will help me greatly understand what
opportunities the current cost analysis is missing.

Initial benchmark numbers look very good. WebKit files that exhibited
the worst of PR12345 went from growing to shrinking compared to Clang
with r152737 reverted.

- Bootstrapped Clang is 3% smaller with this change.
- Bootstrapped Clang -O0 over a single-source-file of lib/Lex is 4%
  faster with this change.

Please let me know about any other performance impact you see. Thanks to
Nico for reporting and urging me to actually fix, Richard Smith, Duncan
Sands, Manuel Klimek, and Benjamin Kramer for talking through the issues
today.

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

12 years agoPrune some includes
Craig Topper [Tue, 27 Mar 2012 07:54:11 +0000 (07:54 +0000)]
Prune some includes

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

12 years agoRemove unnecessary llvm:: qualifications
Craig Topper [Tue, 27 Mar 2012 07:21:54 +0000 (07:21 +0000)]
Remove unnecessary llvm:: qualifications

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

12 years agoPass the llvm IR pointer value and offset to the constructor of
Akira Hatanaka [Tue, 27 Mar 2012 03:13:56 +0000 (03:13 +0000)]
Pass the llvm IR pointer value and offset to the constructor of
MachinePointerInfo when getStore is called to create a node that stores an
argument passed in register to the stack. Without this change, the post RA
scheduler will fail to discover the dependencies between the stores
instructions and the instructions that load from a structure passed by value.

The link to the related discussion is here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-March/048055.html

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

12 years agoFix bug in LowerConstantPool.
Akira Hatanaka [Tue, 27 Mar 2012 02:55:31 +0000 (02:55 +0000)]
Fix bug in LowerConstantPool.

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

12 years agoAdd T9 to the list of live-in registers of the entry basic block.
Akira Hatanaka [Tue, 27 Mar 2012 02:46:25 +0000 (02:46 +0000)]
Add T9 to the list of live-in registers of the entry basic block.

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

12 years agoRetrieve and add the offset of a symbol in applyFixup rather than retrieve and
Akira Hatanaka [Tue, 27 Mar 2012 02:33:05 +0000 (02:33 +0000)]
Retrieve and add the offset of a symbol in applyFixup rather than retrieve and
set it in MipsMCCodeEmitter::getMachineOpValue. Assert in getMachineOpValue if
MachineOperand MO is of an unexpected type.

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

12 years agoDefine function MipsGetSymAndOffset which returns a fixup's symbol and the
Akira Hatanaka [Tue, 27 Mar 2012 02:04:18 +0000 (02:04 +0000)]
Define function MipsGetSymAndOffset which returns a fixup's symbol and the
offset applied to it.

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

12 years agoPost-ra LICM should take care not to hoist an instruction that would clobber a
Evan Cheng [Tue, 27 Mar 2012 01:50:58 +0000 (01:50 +0000)]
Post-ra LICM should take care not to hoist an instruction that would clobber a
register that's read by the preheader terminator.

rdar://11095580

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

12 years agoRewrite computation of Value in adjustFixupValue so that the upper 48-bits are
Akira Hatanaka [Tue, 27 Mar 2012 01:50:08 +0000 (01:50 +0000)]
Rewrite computation of Value in adjustFixupValue so that the upper 48-bits are
cleared. No functionality change.

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

12 years agoDuring MachineCopyPropagation a register may be the source operand of multiple
Lang Hames [Tue, 27 Mar 2012 00:44:47 +0000 (00:44 +0000)]
During MachineCopyPropagation a register may be the source operand of multiple
copies being considered for removal. Make sure to track all of the copies,
rather than just the most recent encountered, by holding a DenseSet instead of
an unsigned in SrcMap.

No test case - couldn't reduce something with a sane size.

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

12 years agoReserve hardware registers.
Akira Hatanaka [Tue, 27 Mar 2012 00:40:56 +0000 (00:40 +0000)]
Reserve hardware registers.

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

12 years agoARM has a peephole optimization which looks for a def / use pair. The def
Evan Cheng [Mon, 26 Mar 2012 23:31:00 +0000 (23:31 +0000)]
ARM has a peephole optimization which looks for a def / use pair. The def
produces a 32-bit immediate which is consumed by the use. It tries to
fold the immediate by breaking it into two parts and fold them into the
immmediate fields of two uses. e.g
       movw    r2, #40885
       movt    r3, #46540
       add     r0, r0, r3
=>
       add.w   r0, r0, #3019898880
       add.w   r0, r0, #30146560
;
However, this transformation is incorrect if the user produces a flag. e.g.
       movw    r2, #40885
       movt    r3, #46540
       adds    r0, r0, r3
=>
       add.w   r0, r0, #3019898880
       adds.w  r0, r0, #30146560
Note the adds.w may not set the carry flag even if the original sequence
would.

rdar://11116189

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

12 years agoAdd a debug option to dump PBQP graphs during register allocation.
Lang Hames [Mon, 26 Mar 2012 23:07:23 +0000 (23:07 +0000)]
Add a debug option to dump PBQP graphs during register allocation.

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

12 years agoSCEV fix: Handle loop invariant loads.
Andrew Trick [Mon, 26 Mar 2012 22:33:59 +0000 (22:33 +0000)]
SCEV fix: Handle loop invariant loads.

Fixes PR11882: NULL dereference in ComputeLoadConstantCompareExitLimit.

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

12 years agoAdd 'undef's to make SWIG happier. Patch by Baozeng Ding.
Bill Wendling [Mon, 26 Mar 2012 22:15:12 +0000 (22:15 +0000)]
Add 'undef's to make SWIG happier. Patch by Baozeng Ding.

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

12 years agoAdd InitializeNativeTargetDisassembler function.
Eric Christopher [Mon, 26 Mar 2012 21:56:56 +0000 (21:56 +0000)]
Add InitializeNativeTargetDisassembler function.

Patch by Ojab.

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

12 years agoUnit test for PR11950: LSR crash.
Andrew Trick [Mon, 26 Mar 2012 21:45:37 +0000 (21:45 +0000)]
Unit test for PR11950: LSR crash.

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

12 years agoUse the file in the inlined die rather than the compile unit for
Eric Christopher [Mon, 26 Mar 2012 21:38:38 +0000 (21:38 +0000)]
Use the file in the inlined die rather than the compile unit for
backtrace locations.

Testcase forthcoming, but I wanted to get some testing here.

Should fix:

PR12323
PR12314
rdar://11091100

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

12 years ago153465 was incorrect. In this code we wanted to check that the pointer operand is...
Nadav Rotem [Mon, 26 Mar 2012 21:00:53 +0000 (21:00 +0000)]
153465 was incorrect. In this code we wanted to check that the pointer operand is of pointer type (and not vector type).

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

12 years agoMade RuntimeDyldMachO support vanilla i386
Sean Callanan [Mon, 26 Mar 2012 20:45:52 +0000 (20:45 +0000)]
Made RuntimeDyldMachO support vanilla i386
relocations.  The algorithm is the same as
that for x86_64.  Scattered relocations, a
feature present in i386 but not on x86_64,
are not yet supported.

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

12 years agoPR12357: The pointer was used before it was checked.
Nadav Rotem [Mon, 26 Mar 2012 20:39:18 +0000 (20:39 +0000)]
PR12357: The pointer was used before it was checked.

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

12 years agoLSR ivchain bug fix: corner case with ConstantExpr.
Andrew Trick [Mon, 26 Mar 2012 20:28:37 +0000 (20:28 +0000)]
LSR ivchain bug fix: corner case with ConstantExpr.

Fixes PR11950.

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

12 years agocomment typo
Andrew Trick [Mon, 26 Mar 2012 20:28:35 +0000 (20:28 +0000)]
comment typo

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

12 years agoeliminate an unneeded branch, part of PR12357
Chris Lattner [Mon, 26 Mar 2012 19:13:57 +0000 (19:13 +0000)]
eliminate an unneeded branch, part of PR12357

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

12 years agofix a failure path to print the right thing, part of PR12357
Chris Lattner [Mon, 26 Mar 2012 19:11:51 +0000 (19:11 +0000)]
fix a failure path to print the right thing, part of PR12357

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

12 years agoTidy.
Eric Christopher [Mon, 26 Mar 2012 19:09:40 +0000 (19:09 +0000)]
Tidy.

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

12 years agoTidy.
Eric Christopher [Mon, 26 Mar 2012 19:09:38 +0000 (19:09 +0000)]
Tidy.

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

12 years agoRevert r153423 as this is causing failures on our internal nightly testers.
Chad Rosier [Mon, 26 Mar 2012 18:07:14 +0000 (18:07 +0000)]
Revert r153423 as this is causing failures on our internal nightly testers.

Original commit message:
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loading a boolean value.

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

12 years agoLSR cleanup: potential bug caught by PVS-Studio.
Andrew Trick [Mon, 26 Mar 2012 18:03:16 +0000 (18:03 +0000)]
LSR cleanup: potential bug caught by PVS-Studio.

Thanks Andrey.

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

12 years agodocs/lit: Add some notes on the lit test run output format.
Daniel Dunbar [Mon, 26 Mar 2012 18:01:14 +0000 (18:01 +0000)]
docs/lit: Add some notes on the lit test run output format.

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

12 years ago[tsan] treat vtable pointer updates in a special way (requires tbaa); fix a bug ...
Kostya Serebryany [Mon, 26 Mar 2012 17:35:03 +0000 (17:35 +0000)]
[tsan] treat vtable pointer updates in a special way (requires tbaa); fix a bug (forgot to return true after instrumenting); make sure the tsan tests are run

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

12 years agoNo need to do an expensive stable sort for a bunch of integers.
Benjamin Kramer [Mon, 26 Mar 2012 14:17:26 +0000 (14:17 +0000)]
No need to do an expensive stable sort for a bunch of integers.

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

12 years agoAdd missing include of <new>
Douglas Gregor [Mon, 26 Mar 2012 14:04:17 +0000 (14:04 +0000)]
Add missing include of <new>

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

12 years agoFix GetMainExecutable on kFreeBSD.
Anton Korobeynikov [Mon, 26 Mar 2012 12:05:51 +0000 (12:05 +0000)]
Fix GetMainExecutable on kFreeBSD.
Patch by Sylvestre Ledru!

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

12 years agoRemove stale CBackend tests.
Benjamin Kramer [Mon, 26 Mar 2012 11:16:50 +0000 (11:16 +0000)]
Remove stale CBackend tests.

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

12 years agoTableGen: Don't emit the llvm intrinsic -> gcc builtin table, its only user was the...
Benjamin Kramer [Mon, 26 Mar 2012 11:08:03 +0000 (11:08 +0000)]
TableGen: Don't emit the llvm intrinsic -> gcc builtin table, its only user was the c backend.

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

12 years agoPrune some includes and forward declarations.
Craig Topper [Mon, 26 Mar 2012 06:58:25 +0000 (06:58 +0000)]
Prune some includes and forward declarations.

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

12 years agoAdd a debug statement.
Eric Christopher [Mon, 26 Mar 2012 06:10:32 +0000 (06:10 +0000)]
Add a debug statement.

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

12 years agoAdd some fixes to the configure script for isInf and add
Eric Christopher [Mon, 26 Mar 2012 02:09:01 +0000 (02:09 +0000)]
Add some fixes to the configure script  for isInf and add
--enable-libcpp to projects/sample.

Patch by Dmitri Shubin with additional fixes by me.

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

12 years agoUpdate documentation for old api changes.
Eric Christopher [Mon, 26 Mar 2012 01:56:34 +0000 (01:56 +0000)]
Update documentation for old api changes.

Fixes PR12050

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

12 years agoUse the new range metadata in computeMaskedBits and add a new optimization to
Rafael Espindola [Mon, 26 Mar 2012 01:44:11 +0000 (01:44 +0000)]
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.

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

12 years agoPrune includes and replace uses of ARMRegisterInfo.h with ARMBaeRegisterInfo.h
Craig Topper [Mon, 26 Mar 2012 00:45:15 +0000 (00:45 +0000)]
Prune includes and replace uses of ARMRegisterInfo.h with ARMBaeRegisterInfo.h

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

12 years agoReplace uses of ARMBaseInstrInfo and ARMTargetMachine with the Base versions.
Craig Topper [Sun, 25 Mar 2012 23:49:58 +0000 (23:49 +0000)]
Replace uses of ARMBaseInstrInfo and ARMTargetMachine with the Base versions.

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

12 years agoTeach instsimplify how to simplify comparisons of pointers which are
Chandler Carruth [Sun, 25 Mar 2012 21:28:14 +0000 (21:28 +0000)]
Teach instsimplify how to simplify comparisons of pointers which are
constant-offsets of a common base using the generic GEP-walking logic
I added for computing pointer differences in the same situation.

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

12 years agoSwitch the pointer-difference simplification logic to only work with
Chandler Carruth [Sun, 25 Mar 2012 20:43:07 +0000 (20:43 +0000)]
Switch the pointer-difference simplification logic to only work with
inbounds GEPs. This isn't really necessary for simplifying pointer
differences, but I'm planning to re-use the same code to simplify
pointer comparisons where it is necessary. Since real code almost
exclusively uses inbounds GEPs, it doesn't seem worth it to support the
extra complexity of turning it on and off. If anyone would like that
back, feel free to shout. Note that instcombine will still catch any of
these patterns.

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

12 years agoPrune some includes and forward declarations.
Craig Topper [Sun, 25 Mar 2012 18:10:17 +0000 (18:10 +0000)]
Prune some includes and forward declarations.

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

12 years agoPrune some includes and forward declarations.
Craig Topper [Sun, 25 Mar 2012 18:09:44 +0000 (18:09 +0000)]
Prune some includes and forward declarations.

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

12 years agoThis file is no longer needed (DejaGNU-isms removed from code)
Eli Bendersky [Sun, 25 Mar 2012 12:43:54 +0000 (12:43 +0000)]
This file is no longer needed (DejaGNU-isms removed from code)

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

12 years agos/restrict/describe/
Rafael Espindola [Sun, 25 Mar 2012 11:14:35 +0000 (11:14 +0000)]
s/restrict/describe/
Thanks Duncan.

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

12 years agoTeach the function cloner (and thus the inliner) to simplify PHINodes
Chandler Carruth [Sun, 25 Mar 2012 10:34:54 +0000 (10:34 +0000)]
Teach the function cloner (and thus the inliner) to simplify PHINodes
aggressively. There are lots of dire warnings about this being expensive
that seem to predate switching to the TrackingVH-based value remapper
that is automatically updated on RAUW. This makes it easy to not just
prune single-entry PHIs, but to fully simplify PHIs, and to recursively
simplify the newly inlined code to propagate PHINode simplifications.

This introduces a bit of a thorny problem though. We may end up
simplifying a branch condition to a constant when we fold PHINodes, and
we would like to nuke any dead blocks resulting from this so that time
isn't wasted continually analyzing them, but this isn't easy. Deleting
basic blocks *after* they are fully cloned and mapped into the new
function currently requires manually updating the value map. The last
piece of the simplification-during-inlining puzzle will require either
switching to WeakVH mappings or some other piece of refactoring. I've
left a FIXME in the testcase about this.

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

12 years agoFix lit failure on cmake-clang-x64_64-linux bot, apparently due to its having
Eli Bendersky [Sun, 25 Mar 2012 09:42:28 +0000 (09:42 +0000)]
Fix lit failure on cmake-clang-x64_64-linux bot, apparently due to its having
a very (*very*) old version of Python (2.4?)

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

12 years agoContinue cleanup of LIT, getting rid of the remaining artifacts from dejagnu
Eli Bendersky [Sun, 25 Mar 2012 09:02:19 +0000 (09:02 +0000)]
Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu

* Removed test/lib/llvm.exp - it is no longer needed
* Deleted the dg.exp reading code from test/lit.cfg. There are no dg.exp files
  left in the test suite so this code is no longer required. test/lit.cfg is
  now much shorter and clearer
* Removed a lot of duplicate code in lit.local.cfg files that need access to
  the root configuration, by adding a "root" attribute to the TestingConfig
  object. This attribute is dynamically computed to provide the same
  information as was previously provided by the custom getRoot functions.
* Documented the config.root attribute in docs/CommandGuide/lit.pod

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

12 years agoMove the instruction simplification of callsite arguments in the inliner
Chandler Carruth [Sun, 25 Mar 2012 04:03:40 +0000 (04:03 +0000)]
Move the instruction simplification of callsite arguments in the inliner
to instead rely on much more generic and powerful instruction
simplification in the function cloner (and thus inliner).

This teaches the pruning function cloner to use instsimplify rather than
just the constant folder to fold values during cloning. This can
simplify a large number of things that constant folding alone cannot
begin to touch. For example, it will realize that 'or' and 'and'
instructions with certain constant operands actually become constants
regardless of what their other operand is. It also can thread back
through the caller to perform simplifications that are only possible by
looking up a few levels. In particular, GEPs and pointer testing tend to
fold much more heavily with this change.

This should (in some cases) have a positive impact on compile times with
optimizations on because the inliner itself will simply avoid cloning
a great deal of code. It already attempted to prune proven-dead code,
but now it will be use the stronger simplifications to prove more code
dead.

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

12 years agoAdd an asserting ValueHandle to the block simplification code which will
Chandler Carruth [Sun, 25 Mar 2012 03:29:25 +0000 (03:29 +0000)]
Add an asserting ValueHandle to the block simplification code which will
fire if anything ever invalidates the assumption of a terminator
instruction being unchanged throughout the routine.

I've convinced myself that the current definition of simplification
precludes such a transformation, so I think getting some asserts
coverage that we don't violate this agreement is sufficient to make this
code safe for the foreseeable future.

Comments to the contrary or other suggestions are of course welcome. =]
The bots are now happy with this code though, so it appears the bug here
has indeed been fixed.

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