oota-llvm.git
10 years agoARM: suuport .tlsdescseq directive
Saleem Abdulrasool [Thu, 30 Jan 2014 04:02:47 +0000 (04:02 +0000)]
ARM: suuport .tlsdescseq directive

This enhances the ARMAsmParser to handle .tlsdescseq directives.  This is a
slightly special relocation.  We must be able to generate them, but not consume
them in assembly.  The relocation is meant to assist the linker in generating a
TLS descriptor sequence.  The ELF target streamer is enhanced to append
additional fixups into the current segment and that is used to emit the new
R_ARM_TLS_DESCSEQ relocations.

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

10 years agoARM: support TLS descriptor relocations
Saleem Abdulrasool [Thu, 30 Jan 2014 04:02:38 +0000 (04:02 +0000)]
ARM: support TLS descriptor relocations

Add support for tlsdesc relocations which are part of the ABI, marked as
experimental.  These relocations permit the linker to perform TLS reference
optimizations.

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

10 years agoARM: support tlscall relocations
Saleem Abdulrasool [Thu, 30 Jan 2014 04:02:31 +0000 (04:02 +0000)]
ARM: support tlscall relocations

This adds support for TLS CALL relocations.  TLS CALL relocations are used to
indicate to the linker to generate appropriate entries to resolve TLS references
via an appropriate function invocation (e.g. __tls_get_addr(PLT)).

In order to accomodate the linker relaxation of the TLS access model for the
references (GD/LD -> IE, IE -> LE), the relocation addend must be incomplete.
This requires that the partial inplace value is also incomplete (i.e. 0).  We
simply avoid the offset value calculation at the time of the fixup adjustment in
the ARM assembler backend.

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

10 years agoRevert "[Stackmaps] Record the stack size of each function that contains a stackmap...
Juergen Ributzka [Thu, 30 Jan 2014 03:34:02 +0000 (03:34 +0000)]
Revert "[Stackmaps] Record the stack size of each function that contains a stackmap/patchpoint intrinsic."

This reverts commit r200444 to unbreak buildbots.

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

10 years ago[Stackmaps] Record the stack size of each function that contains a stackmap/patchpoin...
Juergen Ributzka [Thu, 30 Jan 2014 03:06:14 +0000 (03:06 +0000)]
[Stackmaps] Record the stack size of each function that contains a stackmap/patchpoint intrinsic.

Reviewed by Andy

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

10 years agoSimplify the handling of iterators in ObjectFile.
Rafael Espindola [Thu, 30 Jan 2014 02:49:50 +0000 (02:49 +0000)]
Simplify the handling of iterators in ObjectFile.

None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().

This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.

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

10 years agoExtend the preserve_most/all calling convention description in LangRef about the
Juergen Ributzka [Thu, 30 Jan 2014 02:39:00 +0000 (02:39 +0000)]
Extend the preserve_most/all calling convention description in LangRef about the
fact that the argument registers will be preserved too.

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

10 years agoReland r200340 - 'Add line table debug info to COFF files when using a win32 triple'
Timur Iskhodzhanov [Thu, 30 Jan 2014 01:39:17 +0000 (01:39 +0000)]
Reland r200340 - 'Add line table debug info to COFF files when using a win32 triple'

This incorporates a couple of fixes reviewed at http://llvm-reviews.chandlerc.com/D2651

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

10 years agoadd a bunch of LLVM_OVERRIDE before I start refactoring these.
Rafael Espindola [Thu, 30 Jan 2014 01:17:42 +0000 (01:17 +0000)]
add a bunch of LLVM_OVERRIDE before I start refactoring these.

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

10 years agoRemove dead code.
Rafael Espindola [Thu, 30 Jan 2014 01:10:21 +0000 (01:10 +0000)]
Remove dead code.

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

10 years agoRevert r200431 due to bot failures.
Manman Ren [Thu, 30 Jan 2014 00:53:27 +0000 (00:53 +0000)]
Revert r200431 due to bot failures.

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

10 years agoFix TLS handling in ELF's getAddress and llvm-nm to print 'D' for it.
Rafael Espindola [Thu, 30 Jan 2014 00:42:30 +0000 (00:42 +0000)]
Fix TLS handling in ELF's getAddress and llvm-nm to print 'D' for it.

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

10 years agoPGO branch weight: update edge weights in SelectionDAGBuilder.
Manman Ren [Thu, 30 Jan 2014 00:24:37 +0000 (00:24 +0000)]
PGO branch weight: update edge weights in SelectionDAGBuilder.

When converting from "or + br" to two branches, or converting from
"and + br" to two branches, we correctly update the edge weights of
the two branches.

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

10 years agoPGO branch weight: update edge weights in IfConverter.
Manman Ren [Wed, 29 Jan 2014 23:18:47 +0000 (23:18 +0000)]
PGO branch weight: update edge weights in IfConverter.

This commit only handles IfConvertTriangle. To update edge weights
of a successor, one interface is added to MachineBasicBlock:
/// Set successor weight of a given iterator.
setSuccWeight(succ_iterator I, uint32_t weight)

An existing testing case test/CodeGen/Thumb2/v8_IT_5.ll is updated,
since we now correctly update the edge weights, the cold block
is placed at the end of the function and we jump to the cold block.

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

10 years agoMove range handling for a function to endFunction rather than
Eric Christopher [Wed, 29 Jan 2014 23:05:43 +0000 (23:05 +0000)]
Move range handling for a function to endFunction rather than
when we create the subprogram DIE.

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

10 years agoIf we use DW_AT_ranges we need to specify a base address that ranges
Eric Christopher [Wed, 29 Jan 2014 22:22:56 +0000 (22:22 +0000)]
If we use DW_AT_ranges we need to specify a base address that ranges
are relative to in the compile unit. Currently let's just use 0...

Thanks to Greg Clayton for the catch!

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

10 years agoTurn on CU ranges if we've got multiple compile units in the same
Eric Christopher [Wed, 29 Jan 2014 22:06:27 +0000 (22:06 +0000)]
Turn on CU ranges if we've got multiple compile units in the same
module since there's no range guarantee that we could make given
output order. This also fixes up the testcases that have multiple
CUs to have the correct range offset.

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

10 years agoMake the compile unit map a MapVector so that we can assume a stable
Eric Christopher [Wed, 29 Jan 2014 22:06:23 +0000 (22:06 +0000)]
Make the compile unit map a MapVector so that we can assume a stable
output ordering.

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

10 years agoFix formatting of comment.
Eric Christopher [Wed, 29 Jan 2014 22:06:21 +0000 (22:06 +0000)]
Fix formatting of comment.

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

10 years agollvm-cov: Accept the long forms of gcov options
Justin Bogner [Wed, 29 Jan 2014 21:31:47 +0000 (21:31 +0000)]
llvm-cov: Accept the long forms of gcov options

This is a bit imperfect, as these options don't show up in the help as
is and single dash variants are accepted, which differs from gcov.
Unfortunately, this seems to be as good as it gets with the cl::opt
machinery, so it'll do as an incremental step.

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

10 years agollvm-cov: Improve help message text
Justin Bogner [Wed, 29 Jan 2014 21:31:45 +0000 (21:31 +0000)]
llvm-cov: Improve help message text

This Properly capitalizes and clarifies the help output from
llvm-cov. It also puts the llvm-only / non-gcov-compatible options in
their own category.

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

10 years agollvm-cov: Expect a source file as a positional parameter
Justin Bogner [Wed, 29 Jan 2014 21:31:34 +0000 (21:31 +0000)]
llvm-cov: Expect a source file as a positional parameter

Currently, llvm-cov isn't command-line compatible with gcov, which
accepts a source file name as its first parameter and infers the gcno
and gcda file names from that. This change keeps our -gcda and -gcno
options available for convenience in overriding this behaviour, but
adds the required parameter and inference behaviour as a compatible
default.

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

10 years agoRemove C++11ism from r200407.
Jordan Rose [Wed, 29 Jan 2014 19:14:23 +0000 (19:14 +0000)]
Remove C++11ism from r200407.

Oops!

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

10 years agoMC: Better management of macro arguments
David Majnemer [Wed, 29 Jan 2014 18:57:46 +0000 (18:57 +0000)]
MC: Better management of macro arguments

The linux kernel makes uses of a GAS `feature' which substitutes nothing
for macro arguments which aren't specified.

Proper support for these kind of macro arguments necessitated a cleanup of
differences between `GAS' and `Darwin' dialect macro processing.

Differential Revision: http://llvm-reviews.chandlerc.com/D2634

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

10 years agoLoopVectorizer: Add a test case for unrolling of small loops that need a runtime
Arnold Schwaighofer [Wed, 29 Jan 2014 18:55:44 +0000 (18:55 +0000)]
LoopVectorizer: Add a test case for unrolling of small loops that need a runtime
check.

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

10 years ago[CommandLine] Aliases require an value if their target requires a value.
Jordan Rose [Wed, 29 Jan 2014 18:54:17 +0000 (18:54 +0000)]
[CommandLine] Aliases require an value if their target requires a value.

This can still be overridden by explicitly setting a value requirement on the
alias option, but by default it should be the same.

PR18649

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

10 years agoAdd support for PC-relative non-extern relocations to RuntimeDyldMachO.
Lang Hames [Wed, 29 Jan 2014 18:31:35 +0000 (18:31 +0000)]
Add support for PC-relative non-extern relocations to RuntimeDyldMachO.

Also replaces testcase for r180790 (support for absolute non-externs relocs)
with a more robust version.

<rdar://problem/15864721>

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

10 years ago[X86][SchedModel] Fix typos in the definitions of the ports for Haswell.
Quentin Colombet [Wed, 29 Jan 2014 18:26:59 +0000 (18:26 +0000)]
[X86][SchedModel] Fix typos in the definitions of the ports for Haswell.

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

10 years agoTest commit
Oliver Stannard [Wed, 29 Jan 2014 16:01:24 +0000 (16:01 +0000)]
Test commit

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

10 years ago[mips][msa] Add fill.d instruction.
Matheus Almeida [Wed, 29 Jan 2014 15:12:02 +0000 (15:12 +0000)]
[mips][msa] Add fill.d instruction.

This instruction is only available on Mips64 cores
that implement the MSA ASE.

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

10 years ago[mips][msa] CHECK-DAG-ize MSA 2r_vector_scalar.ll test.
Matheus Almeida [Wed, 29 Jan 2014 14:32:03 +0000 (14:32 +0000)]
[mips][msa] CHECK-DAG-ize MSA 2r_vector_scalar.ll test.

This update is a preparation for the addition of Mips64 MSA tests.

No functional changes.

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

10 years ago[mips][msa] Add copy_{u,s}.d.
Matheus Almeida [Wed, 29 Jan 2014 14:05:28 +0000 (14:05 +0000)]
[mips][msa] Add copy_{u,s}.d.

These instructions are only available on Mips64 cores
that implement the MSA ASE.

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

10 years ago[mips][msa] CHECK-DAG-ize MSA elm_copy.ll test.
Matheus Almeida [Wed, 29 Jan 2014 13:51:34 +0000 (13:51 +0000)]
[mips][msa] CHECK-DAG-ize MSA elm_copy.ll test.

This update is a preparation for the addition of Mips64 MSA tests.

No functional changes.

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

10 years ago[LPM] Fix PR18643, another scary place where loop transforms failed to
Chandler Carruth [Wed, 29 Jan 2014 13:16:53 +0000 (13:16 +0000)]
[LPM] Fix PR18643, another scary place where loop transforms failed to
preserve loop simplify of enclosing loops.

The problem here starts with LoopRotation which ends up cloning code out
of the latch into the new preheader it is buidling. This can create
a new edge from the preheader into the exit block of the loop which
breaks LoopSimplify form. The code tries to fix this by splitting the
critical edge between the latch and the exit block to get a new exit
block that only the latch dominates. This sadly isn't sufficient.

The exit block may be an exit block for multiple nested loops. When we
clone an edge from the latch of the inner loop to the new preheader
being built in the outer loop, we create an exiting edge from the outer
loop to this exit block. Despite breaking the LoopSimplify form for the
inner loop, this is fine for the outer loop. However, when we split the
edge from the inner loop to the exit block, we create a new block which
is in neither the inner nor outer loop as the new exit block. This is
a predecessor to the old exit block, and so the split itself takes the
outer loop out of LoopSimplify form. We need to split every edge
entering the exit block from inside a loop nested more deeply than the
exit block in order to preserve all of the loop simplify constraints.

Once we try to do that, a problem with splitting critical edges
surfaces. Previously, we tried a very brute force to update LoopSimplify
form by re-computing it for all exit blocks. We don't need to do this,
and doing this much will sometimes but not always overlap with the
LoopRotate bug fix. Instead, the code needs to specifically handle the
cases which can start to violate LoopSimplify -- they aren't that
common. We need to see if the destination of the split edge was a loop
exit block in simplified form for the loop of the source of the edge.
For this to be true, all the predecessors need to be in the exact same
loop as the source of the edge being split. If the dest block was
originally in this form, we have to split all of the deges back into
this loop to recover it. The old mechanism of doing this was
conservatively correct because at least *one* of the exiting blocks it
rewrote was the DestBB and so the DestBB's predecessors were fixed. But
this is a much more targeted way of doing it. Making it targeted is
important, because ballooning the set of edges touched prevents
LoopRotate from being able to split edges *it* needs to split to
preserve loop simplify in a coherent way -- the critical edge splitting
would sometimes find the other edges in need of splitting but not
others.

Many, *many* thanks for help from Nick reducing these test cases
mightily. And helping lots with the analysis here as this one was quite
tricky to track down.

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

10 years agoRemove -arm-enable-ehabi from Android build rules. It's enabled by default.
Evgeniy Stepanov [Wed, 29 Jan 2014 12:36:18 +0000 (12:36 +0000)]
Remove -arm-enable-ehabi from Android build rules. It's enabled by default.

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

10 years agoDocument EHABI enabled by default
Renato Golin [Wed, 29 Jan 2014 12:04:13 +0000 (12:04 +0000)]
Document EHABI enabled by default

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

10 years agoEnable EHABI by default
Renato Golin [Wed, 29 Jan 2014 11:50:56 +0000 (11:50 +0000)]
Enable EHABI by default

After all hard work to implement the EHABI and with the test-suite
passing, it's time to turn it on by default and allow users to
disable it as a work-around while we fix the eventual bugs that show
up.

This commit also remove the -arm-enable-ehabi-descriptors, since we
want the tables to be printed every time the EHABI is turned on
for non-Darwin ARM targets.

Although MCJIT EHABI is not working yet (needs linking with the right
libraries), this commit also fixes some relocations on MCJIT regarding
the EH tables/lib calls, and update some tests to avoid using EH tables
when none are needed.

The EH tests in the test-suite that were previously disabled on ARM
now pass with these changes, so a follow-up commit on the test-suite
will re-enable them.

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

10 years agoMC: Reorganize macro MC test along dialect lines
David Majnemer [Wed, 29 Jan 2014 09:18:43 +0000 (09:18 +0000)]
MC: Reorganize macro MC test along dialect lines

This commit seeks to do two things:
 - Run the surfeit of tests under the Darwin dialect.  This ends up
   affecting tests which assumed that spaces could deliminate arguments.
 - The GAS dialect tests should limit their surface area to things that
   could plausibly work under GAS. For example, Darwin style arguments
   have no business being in such a test.

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

10 years ago[asan] simplify a test
Kostya Serebryany [Wed, 29 Jan 2014 07:35:43 +0000 (07:35 +0000)]
[asan] simplify a test

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

10 years agoDelete the Matchers stored in the SmallVectors in SwitchOpcodeMatcher/SwitchTypeMatcher.
Craig Topper [Wed, 29 Jan 2014 07:06:07 +0000 (07:06 +0000)]
Delete the Matchers stored in the SmallVectors in SwitchOpcodeMatcher/SwitchTypeMatcher.

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

10 years ago[Sparc] Use %r_disp32 for pc_rel entries in FDE as well.
Venkatraman Govindaraju [Wed, 29 Jan 2014 06:59:20 +0000 (06:59 +0000)]
[Sparc] Use %r_disp32 for pc_rel entries in FDE as well.

This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo.

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

10 years agoRevert r200340, "Add line table debug info to COFF files when using a win32 triple."
NAKAMURA Takumi [Wed, 29 Jan 2014 06:05:38 +0000 (06:05 +0000)]
Revert r200340, "Add line table debug info to COFF files when using a win32 triple."

It was incompatible with --target=i686-win32.

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

10 years agoNormalize the style in llvm-nm.cpp.
Rafael Espindola [Wed, 29 Jan 2014 04:56:19 +0000 (04:56 +0000)]
Normalize the style in llvm-nm.cpp.

It had grown fairly inconsistent. I am about to change it quite a bit to also
use the object api when handling IR files.

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

10 years ago[Sparc] Use %r_disp32 for pc_rel entries in gcc_except_table and eh_frame.
Venkatraman Govindaraju [Wed, 29 Jan 2014 04:51:35 +0000 (04:51 +0000)]
[Sparc] Use %r_disp32 for pc_rel entries in gcc_except_table and eh_frame.

Otherwise, assembler (gas) fails to assemble them with error message "operation
combines symbols in different segments". This is because MC computes
pc_rel entries with subtract expression between labels from different sections.

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

10 years ago[LPM] Fix PR18642, a pretty nasty bug in IndVars that "never mattered"
Chandler Carruth [Wed, 29 Jan 2014 04:40:19 +0000 (04:40 +0000)]
[LPM] Fix PR18642, a pretty nasty bug in IndVars that "never mattered"
because of the inside-out run of LoopSimplify in the LoopPassManager and
the fact that LoopSimplify couldn't be "preserved" across two
independent LoopPassManagers.

Anyways, in that case, IndVars wasn't correctly preserving an LCSSA PHI
node because it thought it was rewriting (via SCEV) the incoming value
to a loop invariant value. While it may well be invariant for the
current loop, it may be rewritten in terms of an enclosing loop's
values. This in and of itself is fine, as the LCSSA PHI node in the
enclosing loop for the inner loop value we're rewriting will have its
own LCSSA PHI node if used outside of the enclosing loop. With me so
far?

Well, the current loop and the enclosing loop may share an exiting
block and exit block, and when they do they also share LCSSA PHI nodes.
In this case, its not valid to RAUW through the LCSSA PHI node.

Expected crazy test included.

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

10 years agoLoopVectorizer: Don't count the induction variable multiple times
Arnold Schwaighofer [Wed, 29 Jan 2014 04:36:12 +0000 (04:36 +0000)]
LoopVectorizer: Don't count the induction variable multiple times

When estimating register pressure, don't count the induction variable mulitple
times. It is unlikely to be unrolled. This is currently disabled and hidden
behind a flag ("enable-ind-var-reg-heur").

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

10 years agoWe do use pipefail these days. Update the test.
Rafael Espindola [Wed, 29 Jan 2014 04:08:05 +0000 (04:08 +0000)]
We do use pipefail these days. Update the test.

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

10 years ago[SparcV9] Use correct register class (I64RegClass) to hold the address of _GLOBAL_OF...
Venkatraman Govindaraju [Wed, 29 Jan 2014 03:35:08 +0000 (03:35 +0000)]
[SparcV9] Use correct register class (I64RegClass) to hold the address of  _GLOBAL_OFFSET_TABLE_ in sparcv9.

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

10 years agoUse a raw_stream to implement the mangler.
Rafael Espindola [Wed, 29 Jan 2014 02:30:38 +0000 (02:30 +0000)]
Use a raw_stream to implement the mangler.

This is a bit more convenient for some callers, but more importantly, it is
easier to implement correctly. Doing this removes the patching of already
printed data that was used for fastcall, fixing a crash with private fastcall
symbols.

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

10 years ago[AArch64 NEON] Lower SELECT_CC with vector operand.
Kevin Qin [Wed, 29 Jan 2014 01:57:30 +0000 (01:57 +0000)]
[AArch64 NEON] Lower SELECT_CC with vector operand.

When the scalar compare is between floating point and operands are
vector, we custom lower SELECT_CC to use NEON SIMD compare for
generating less instructions.

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

10 years ago[ARM] Remove superfluous inline asm mode switch test
David Woodhouse [Wed, 29 Jan 2014 00:49:28 +0000 (00:49 +0000)]
[ARM] Remove superfluous inline asm mode switch test

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

10 years agoRemove unnecessary call to pthread_mutexattr_setpshared()
Mark Seaborn [Wed, 29 Jan 2014 00:20:44 +0000 (00:20 +0000)]
Remove unnecessary call to pthread_mutexattr_setpshared()

The default value of this attribute is PTHREAD_PROCESS_PRIVATE, so
there's no point in calling pthread_mutexattr_setpshared() to set
that.

See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getpshared.html

This removes some ifdefs that tend to need to be extended for other
platforms (e.g. for NaCl).

Note that this call was in the first implementation of Mutex, added in
r22403, so it doesn't appear to have been added in response to a
performance problem.

Differential Revision: http://llvm-reviews.chandlerc.com/D2633

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

10 years agoMC: Clean up error paths in AsmParser::parseMacroArgument
David Majnemer [Wed, 29 Jan 2014 00:07:39 +0000 (00:07 +0000)]
MC: Clean up error paths in AsmParser::parseMacroArgument

Use an RAII object Instead of inserting a call to
AsmLexer::setSkipSpace(true) in all error paths.

No functional change.

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

10 years agoMake createObjectFile's signature a bit less error prone.
Rafael Espindola [Wed, 29 Jan 2014 00:02:26 +0000 (00:02 +0000)]
Make createObjectFile's signature a bit less error prone.

This will be better with c++11, but right now file_magic converts to bool,
which makes the api really easy to misuse.

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

10 years ago[Sparc] Fix breakage in r200345
David Woodhouse [Tue, 28 Jan 2014 23:38:16 +0000 (23:38 +0000)]
[Sparc] Fix breakage in r200345

Oops. Don't do build tests on patches like that with --enable-targets=x86_64

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

10 years agoFinish bringing file_type to the llvm style (other than its name).
Rafael Espindola [Tue, 28 Jan 2014 23:36:39 +0000 (23:36 +0000)]
Finish bringing file_type to the llvm style (other than its name).

I assume that the name is file_type because it is the name of a c++11 type that
we will use once we convert, but at least our current implementation can look
like llvm code.

Thanks to David Blakie for the push.

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

10 years agoBe more explicit about which overloaded variant to use. Caught by ASan!
Nick Kledzik [Tue, 28 Jan 2014 23:25:13 +0000 (23:25 +0000)]
Be more explicit about which overloaded variant to use. Caught by ASan!

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

10 years agoConvert to the inner enum so the compiler can warn about it in switches.
Rafael Espindola [Tue, 28 Jan 2014 23:15:56 +0000 (23:15 +0000)]
Convert to the inner enum so the compiler can warn about it in switches.

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

10 years agoTests for mode switching
David Woodhouse [Tue, 28 Jan 2014 23:13:30 +0000 (23:13 +0000)]
Tests for mode switching

1. test that inlineasm works
2. test that relaxable instructions are re-encoded in the correct mode.

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

10 years agoDelete MCSubtargetInfo data members from target MCCodeEmitter classes
David Woodhouse [Tue, 28 Jan 2014 23:13:25 +0000 (23:13 +0000)]
Delete MCSubtargetInfo data members from target MCCodeEmitter classes

The subtarget info is explicitly passed to the EncodeInstruction
method and we should use that subtarget info to influence any
encoding decisions.

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

10 years agoPropagate MCSubtargetInfo through TableGen's getBinaryCodeForInstr()
David Woodhouse [Tue, 28 Jan 2014 23:13:18 +0000 (23:13 +0000)]
Propagate MCSubtargetInfo through TableGen's getBinaryCodeForInstr()

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

10 years agoExplictly pass MCSubtargetInfo to MCCodeEmitter::EncodeInstruction()
David Woodhouse [Tue, 28 Jan 2014 23:13:07 +0000 (23:13 +0000)]
Explictly pass MCSubtargetInfo to MCCodeEmitter::EncodeInstruction()

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

10 years agoKeep the MCSubtargetInfo in the MCRelxableFragment class.
David Woodhouse [Tue, 28 Jan 2014 23:12:53 +0000 (23:12 +0000)]
Keep the MCSubtargetInfo in the MCRelxableFragment class.

Needed to fix PR18303 to correctly re-encode the instruction if it
is relaxed.

We keep a copy of the MCSubtargetInfo to make sure that we are not
effected by future changes to the subtarget info coming from the
assembler (e.g. when parsing .code 16 directived).

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

10 years agoModify MCObjectStreamer EmitInstTo* interface
David Woodhouse [Tue, 28 Jan 2014 23:12:49 +0000 (23:12 +0000)]
Modify MCObjectStreamer EmitInstTo* interface

Add MCSubtargetInfo parameter
virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &);
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &);

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

10 years agoChange MCStreamer EmitInstruction interface to take subtarget info
David Woodhouse [Tue, 28 Jan 2014 23:12:42 +0000 (23:12 +0000)]
Change MCStreamer EmitInstruction interface to take subtarget info

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

10 years agoDisable the COFF tests on non-X86 archs
Timur Iskhodzhanov [Tue, 28 Jan 2014 21:47:33 +0000 (21:47 +0000)]
Disable the COFF tests on non-X86 archs

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

10 years agoAdd line table debug info to COFF files when using a win32 triple.
Timur Iskhodzhanov [Tue, 28 Jan 2014 21:33:27 +0000 (21:33 +0000)]
Add line table debug info to COFF files when using a win32 triple.

Reviewed at http://llvm-reviews.chandlerc.com/D2232

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

10 years agoUse the proper SDK when building iOS sim builds of LLVM and/or Mac OS X builds.
Owen Anderson [Tue, 28 Jan 2014 19:57:18 +0000 (19:57 +0000)]
Use the proper SDK when building iOS sim builds of LLVM and/or Mac OS X builds.

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

10 years agofix templates to work with pre c++11
Nick Kledzik [Tue, 28 Jan 2014 19:33:09 +0000 (19:33 +0000)]
fix templates to work with pre c++11

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

10 years ago[mips] Fix ELF header flags.
Matheus Almeida [Tue, 28 Jan 2014 19:24:11 +0000 (19:24 +0000)]
[mips] Fix ELF header flags.

As opposed to GCC/GAS the default ABI for Mips64 is n64.
Compatibility bit should be set if o32 ABI is used when targeting Mips64.

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

10 years agoAdd BumpPtrAllocator::allocateCopy() utilities
Nick Kledzik [Tue, 28 Jan 2014 19:21:27 +0000 (19:21 +0000)]
Add BumpPtrAllocator::allocateCopy() utilities

Makes it easy to use BumpPtrAllocator to make a copy of StringRef strings.

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

10 years ago[NVPTX] Fix emitting aggregate parameters
Gautam Chakrabarti [Tue, 28 Jan 2014 18:35:29 +0000 (18:35 +0000)]
[NVPTX] Fix emitting aggregate parameters

The code was missing the case for aggregate parameters and
hence was emitting them as .b0 type. Also fixed a couple
of comments.

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

10 years ago[X86] Add extra rules for combining vselect dag nodes into movsd.
Andrea Di Biagio [Tue, 28 Jan 2014 18:14:21 +0000 (18:14 +0000)]
[X86] Add extra rules for combining vselect dag nodes into movsd.

This improves the fix committed at revision 199683 adding the
following new target specific combine rules:

1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
        (v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))

2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
        (v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))

3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
        (v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))

4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
        (v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))

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

10 years agotypo
Adrian Prantl [Tue, 28 Jan 2014 18:13:47 +0000 (18:13 +0000)]
typo

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

10 years agoFix pr14893.
Rafael Espindola [Tue, 28 Jan 2014 16:56:46 +0000 (16:56 +0000)]
Fix pr14893.

When simplifycfg moves an instruction, it must drop metadata it doesn't know
is still valid with the preconditions changes. In particular, it must drop
the range and tbaa metadata.

The patch implements this with an utility function to drop all metadata not
in a white list.

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

10 years agoThe llvm_headers_do_not_build project needs to be excluded from the default build...
Aaron Ballman [Tue, 28 Jan 2014 16:07:10 +0000 (16:07 +0000)]
The llvm_headers_do_not_build project needs to be excluded from the default build, otherwise it gets built (at least in Visual Studio 2013).

Thanks to chapuni200000 for help with this in IRC!

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

10 years ago[DAGCombiner] Avoid introducing an illegal build_vector when folding a sign_extend.
Andrea Di Biagio [Tue, 28 Jan 2014 12:53:56 +0000 (12:53 +0000)]
[DAGCombiner] Avoid introducing an illegal build_vector when folding a sign_extend.

Make sure that we don't introduce illegal build_vector dag nodes
when trying to fold a sign_extend of a build_vector.

This fixes a regression introduced by r200234.
Added test CodeGen/X86/fold-vector-sext-crash.ll
to verify that llc no longer crashes with an assertion failure
due to an illegal build_vector of type MVT::v4i64.

Thanks to Ilia Filippov for spotting this regression and for
providing a reproducible test case.

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

10 years ago[CMake] llvm_update_compile_flags(name) doesn't require source files. TARGET PROPERTY...
NAKAMURA Takumi [Tue, 28 Jan 2014 11:40:04 +0000 (11:40 +0000)]
[CMake] llvm_update_compile_flags(name) doesn't require source files. TARGET PROPERTY SOURCES has them.

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

10 years agoProvide a stub Target Streamer implementation for PPC MachO
Iain Sandoe [Tue, 28 Jan 2014 11:03:17 +0000 (11:03 +0000)]
Provide a stub Target Streamer implementation for PPC MachO

At present, this handles .tc (error) and needs to be expanded to deal properly with .machine

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

10 years ago[CMake] Prune CMAKE_CXX_FLAGS stuff in llvm_process_sources.
NAKAMURA Takumi [Tue, 28 Jan 2014 09:48:19 +0000 (09:48 +0000)]
[CMake] Prune CMAKE_CXX_FLAGS stuff in llvm_process_sources.

It is the final step to deprecate contextual CMAKE_CXX_FLAGS.

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

10 years ago[CMake] Enhance llvm_update_compile_flags(name sources) to handle LLVM_REQUIRES_EH...
NAKAMURA Takumi [Tue, 28 Jan 2014 09:44:06 +0000 (09:44 +0000)]
[CMake] Enhance llvm_update_compile_flags(name sources) to handle LLVM_REQUIRES_EH and LLVM_REQUIRES_RTTI.

LLVM_REQUIRES_EH implies LLVM_REQUIRES_RTTI. It is as same behavior as Makefile.rule's.
llvm/examples/ExceptionDemo is affected. (It was built with -fno-rtti.)

For MSVC, Remove flags like "/EHsc /GR" in HandleLLVMOptions, or CL.EXE complains with flags like "/GR /GR-".

llvm_update_compile_flags() updates source file property if the target contains *.c.
COMPILE_FLAGS in target properties affects both C++ and C!

LLVM_NO_RTTI is deprecated. It was introduced by me and was my mistake.

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

10 years ago[CMake] Apply -ffunction-data-sectinos not only to CMAKE_CXX_FLAGS, but also to CMAKE...
NAKAMURA Takumi [Tue, 28 Jan 2014 09:44:00 +0000 (09:44 +0000)]
[CMake] Apply -ffunction-data-sectinos not only to CMAKE_CXX_FLAGS, but also to CMAKE_C_FLAGS.

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

10 years ago[CMake] Move -ffunction-data-sections stuff to HandleLLVMOptions.
NAKAMURA Takumi [Tue, 28 Jan 2014 09:43:55 +0000 (09:43 +0000)]
[CMake] Move -ffunction-data-sections stuff to HandleLLVMOptions.

With this tweaks, also unittests are compiled with -ffunction-sections.

It's hard to control contextual CMAKE_CXX_FLAGS. We should get rid of twiddling it as possible.

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

10 years ago[CMake] Let llvm_process_sources check not only *.cpp but also *.c.
NAKAMURA Takumi [Tue, 28 Jan 2014 09:43:49 +0000 (09:43 +0000)]
[CMake] Let llvm_process_sources check not only *.cpp but also *.c.

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

10 years ago[CMake] Put lli-child-target into the Folder "Misc".
NAKAMURA Takumi [Tue, 28 Jan 2014 09:43:41 +0000 (09:43 +0000)]
[CMake] Put lli-child-target into the Folder "Misc".

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

10 years ago[vectorizer] Completely disable the block frequency guidance of the loop
Chandler Carruth [Tue, 28 Jan 2014 09:10:41 +0000 (09:10 +0000)]
[vectorizer] Completely disable the block frequency guidance of the loop
vectorizer, placing it behind an off-by-default flag.

It turns out that block frequency isn't what we want at all, here or
elsewhere. This has been I think a nagging feeling for several of us
working with it, but Arnold has given some really nice simple examples
where the results are so comprehensively wrong that they aren't useful.

I'm planning to email the dev list with a summary of why its not really
useful and a couple of ideas about how to better structure these types
of heuristics.

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

10 years agoHandle spilling the PPC GPRC_NOR0 register class
Hal Finkel [Tue, 28 Jan 2014 05:32:58 +0000 (05:32 +0000)]
Handle spilling the PPC GPRC_NOR0 register class

GPRC_NOR0 is not a subclass of GPRC (because it also contains the ZERO pseudo
register). As a result, we also need to check for it in the spilling code.

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

10 years agoImprove handling of EnforceSmallerThan. Remove all types that are smaller from the...
Craig Topper [Tue, 28 Jan 2014 04:49:01 +0000 (04:49 +0000)]
Improve handling of EnforceSmallerThan. Remove all types that are smaller from the larger set not just the smallest type from the smaller set. Ensure 'smaller' vectors have the same or fewer total bits. Similar for 'larger' vectors.

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

10 years agoMC: Add a .debug section that we'll soon use to emit debug info into COFF files
Timur Iskhodzhanov [Tue, 28 Jan 2014 03:48:44 +0000 (03:48 +0000)]
MC: Add a .debug section that we'll soon use to emit debug info into COFF files

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

10 years agoR600/SI: Add pattern for truncating i32 to i1
Michel Danzer [Tue, 28 Jan 2014 03:01:16 +0000 (03:01 +0000)]
R600/SI: Add pattern for truncating i32 to i1

Fixes half a dozen piglit tests with radeonsi.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200283 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix the DWARF EH encodings for Sparc PIC code.
Jakob Stoklund Olesen [Tue, 28 Jan 2014 02:52:26 +0000 (02:52 +0000)]
Fix the DWARF EH encodings for Sparc PIC code.

Also emit the stubs that were generated for references to typeinfo
symbols.

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

10 years agoUpdate optimization passes to handle inalloca arguments
Reid Kleckner [Tue, 28 Jan 2014 02:38:36 +0000 (02:38 +0000)]
Update optimization passes to handle inalloca arguments

Summary:
I searched Transforms/ and Analysis/ for 'ByVal' and updated those call
sites to check for inalloca if appropriate.

I added tests for any change that would allow an optimization to fire on
inalloca.

Reviewers: nlewycky

Differential Revision: http://llvm-reviews.chandlerc.com/D2449

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

10 years agox86: add implicit defs for cpuid
Reid Kleckner [Tue, 28 Jan 2014 02:08:22 +0000 (02:08 +0000)]
x86: add implicit defs for cpuid

This avoids miscompiling MS inline asm in LLVM where we have to infer
clobbers.  Test case forthcoming in Clang.

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

10 years ago[LPM] Fix PR18616 where the shifts to the loop pass manager to extract
Chandler Carruth [Tue, 28 Jan 2014 01:25:38 +0000 (01:25 +0000)]
[LPM] Fix PR18616 where the shifts to the loop pass manager to extract
LCSSA from it caused a crasher with the LoopUnroll pass.

This crasher is really nasty. We destroy LCSSA form in a suprising way.
When unrolling a loop into an outer loop, we not only need to restore
LCSSA form for the outer loop, but for all children of the outer loop.
This is somewhat obvious in retrospect, but hey!

While this seems pretty heavy-handed, it's not that bad. Fundamentally,
we only do this when we unroll a loop, which is already a heavyweight
operation. We're unrolling all of these hypothetical inner loops as
well, so their size and complexity is already on the critical path. This
is just adding another pass over them to re-canonicalize.

I have a test case from PR18616 that is great for reproducing this, but
pretty useless to check in as it relies on many 10s of nested empty
loops that get unrolled and deleted in just the right order. =/ What's
worse is that investigating this has exposed another source of failure
that is likely to be even harder to test. I'll try to come up with test
cases for these fixes, but I want to get the fixes into the tree first
as they're causing crashes in the wild.

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

10 years ago[TLI] Add a new hook to TargetLowering to query the target if a load of a constant...
Juergen Ributzka [Tue, 28 Jan 2014 01:20:14 +0000 (01:20 +0000)]
[TLI] Add a new hook to TargetLowering to query the target if a load of a constant should be converted to simply the constant itself.

Before this patch we used getIntImmCost from TargetTransformInfo to determine if
a load of a constant should be converted to just a constant, but the threshold
for this was set to an arbitrary value. This value works well for the two
targets (X86 and ARM) that implement this target-hook, but it isn't
target-independent at all.

Now targets have the possibility to decide directly if this optimization should
be performed. The default value is set to false to preserve the current
behavior. The target hook has been moved to TargetLowering, which removed the
last use and need of TargetTransformInfo in SelectionDAG.

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

10 years agoLoopVectorize: Support conditional stores by scalarizing
Arnold Schwaighofer [Tue, 28 Jan 2014 01:01:53 +0000 (01:01 +0000)]
LoopVectorize: Support conditional stores by scalarizing

The vectorizer takes a loop like this and widens all instructions except for the
store. The stores are scalarized/unrolled and hidden behind an "if" block.

  for (i = 0; i < 128; ++i) {
    if (a[i] < 10)
      a[i] += val;
  }

  for (i = 0; i < 128; i+=2) {
    v = a[i:i+1];
    v0 = (extract v, 0) + 10;
    v1 = (extract v, 1) + 10;
    if (v0 < 10)
      a[i] = v0;
    if (v1 < 10)
      a[i] = v1;
  }

The vectorizer relies on subsequent optimizations to sink instructions into the
conditional block where they are anticipated.

The flag "vectorize-num-stores-pred" controls whether and how many stores to
handle this way. Vectorization of conditional stores is disabled per default for
now.

This patch also adds a change to the heuristic when the flag
"enable-loadstore-runtime-unroll" is enabled (off by default). It unrolls small
loops until load/store ports are saturated. This heuristic uses TTI's
getMaxUnrollFactor as a measure for load/store ports.

I also added a second flag -enable-cond-stores-vec. It will enable vectorization
of conditional stores. But there is no cost model for vectorization of
conditional stores in place yet so this will not do good at the moment.

rdar://15892953

Results for x86-64 -O3 -mavx +/- -mllvm -enable-loadstore-runtime-unroll
-vectorize-num-stores-pred=1 (before the BFI change):

 Performance Regressions:
   Benchmarks/Ptrdist/yacr2/yacr2 7.35% (maze3() is identical but 10% slower)
   Applications/siod/siod         2.18%
 Performance improvements:
   mesa                          -4.42%
   libquantum                    -4.15%

 With a patch that slightly changes the register heuristics (by subtracting the
 induction variable on both sides of the register pressure equation, as the
 induction variable is probably not really unrolled):

 Performance Regressions:
   Benchmarks/Ptrdist/yacr2/yacr2  7.73%
   Applications/siod/siod          1.97%

 Performance Improvements:
   libquantum                    -13.05% (we now also unroll quantum_toffoli)
   mesa                           -4.27%

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

10 years agoRevert r199871 and replace it with a simple check in the debug info
Eric Christopher [Tue, 28 Jan 2014 00:49:26 +0000 (00:49 +0000)]
Revert r199871 and replace it with a simple check in the debug info
code to see if we're emitting a function into a non-default
text section. This is still a less-than-ideal solution, but more
contained than r199871 to determine whether or not we're emitting
code into an array of comdat sections.

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

10 years agoReformat slightly.
Eric Christopher [Mon, 27 Jan 2014 23:50:03 +0000 (23:50 +0000)]
Reformat slightly.

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

10 years agoPGO branch weight: keep halving the weights until they can fit into
Manman Ren [Mon, 27 Jan 2014 23:39:03 +0000 (23:39 +0000)]
PGO branch weight: keep halving the weights until they can fit into
uint32.

When folding branches to common destination, the updated branch weights
can exceed uint32 by more than factor of 2. We should keep halving the
weights until they can fit into uint32.

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

10 years agoFix the "#ifndef HAVE_SYS_WAIT_H" code path in Program.inc to compile
Mark Seaborn [Mon, 27 Jan 2014 22:53:07 +0000 (22:53 +0000)]
Fix the "#ifndef HAVE_SYS_WAIT_H" code path in Program.inc to compile

Without this fix, WaitResult is not defined.

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