oota-llvm.git
9 years agoFix comparison functions.
Richard Trieu [Sat, 28 Mar 2015 02:37:33 +0000 (02:37 +0000)]
Fix comparison functions.

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

9 years agoDebugInfo: Fix testcases with invalid MDSubprogram nodes
Duncan P. N. Exon Smith [Sat, 28 Mar 2015 02:26:45 +0000 (02:26 +0000)]
DebugInfo: Fix testcases with invalid MDSubprogram nodes

Fix testcases that don't pass the verifier after a WIP patch to check
`MDSubprogram` operands more effectively.  I found the following issues:

  - When `isDefinition: false`, the `variables:` field might point at
    `!{i32 786468}`, or at a tuple that pointed at an empty tuple with
    the comment "previously: invalid DW_TAG_base_type" (I vaguely recall
    adding those comments during an upgrade script).  In these cases, I
    just dropped the array.
  - The `variables:` field might point at something like `!{!{!8}}`,
    where `!8` was an `MDLocation`.  I removed the extra layer of
    indirection.
  - Invalid `type:` (not an `MDSubroutineType`).

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

9 years ago[CodeGen] "PromoteInteger" f32 to f64 doesn't make sense.
Ahmed Bougacha [Sat, 28 Mar 2015 01:22:37 +0000 (01:22 +0000)]
[CodeGen] "PromoteInteger" f32 to f64 doesn't make sense.

The original f32->f64 promotion logic was refactored into roughly the
currently shape in r37781. However, starting with r132263, the
legalizer has been split into different kinds, and the previous
"Promote" (which did the right thing) was search-and-replace'd into
"PromoteInteger". The divide gradually deepened, with type legalization
("PromoteInteger") being separated from ops legalization
("Promote", which still works for floating point ops).

Fast-forward to today: there's no in-tree target with legal f64 but
illegal f32 (rather: no tests were harmed in the making of this patch).

With such a target, i.e., if you trick the legalizer into going through
the PromoteInteger path for FP, you get the expected brokenness.
For instance, there's no PromoteIntRes_FADD (the name itself sounds
wrong), so we'll just hit some assert in the PromoteInteger path.

Don't pretend we can promote f32 to f64. Instead, always soften.

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

9 years ago[ARM] Enable changing instprinter's behavior based on the per-function
Akira Hatanaka [Fri, 27 Mar 2015 23:41:42 +0000 (23:41 +0000)]
[ARM] Enable changing instprinter's behavior based on the per-function
subtarget.

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

9 years agoclang-format ARMInstPrinter.{h,cpp} before I make changes to these files.
Akira Hatanaka [Fri, 27 Mar 2015 23:24:22 +0000 (23:24 +0000)]
clang-format ARMInstPrinter.{h,cpp} before I make changes to these files.

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

9 years ago[SCEV] Look at backedge dominating conditions.
Sanjoy Das [Fri, 27 Mar 2015 23:18:08 +0000 (23:18 +0000)]
[SCEV] Look at backedge dominating conditions.

Summary:
This change teaches ScalarEvolution::isLoopBackedgeGuardedByCond to look
at edges within the loop body that dominate the latch.  We don't do an
exhaustive search for all possible edges, but only a quick walk up the
dom tree.

Reviewers: atrick, hfinkel

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8627

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

9 years agoVerifier: Check operands of MDType subclasses and MDCompileUnit
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 23:05:04 +0000 (23:05 +0000)]
Verifier: Check operands of MDType subclasses and MDCompileUnit

Add verify checks for `MDType` subclasses and for `MDCompileUnit`.
These new checks don't yet incorporate everything from `Verify()`, but
at least they sanity check the operands.  Also downcast accessors as
possible.

A lot of these accessors can't be downcast as far as we'd like because
of arrays of typed objects (stored in a generic `MDTuple`) and
`MDString`-based type references.  Eventually I'll port over `DIRef<>`
and `DITypedArray<>` from `DebugInfo.h` to clean those up as well.

Updated bitrotted testcases separately in r233415 and r233443 to reduce
churn on the off-chance this needs to be reverted.

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

9 years agoDebugInfo: Require non-null in DIBuilder::retainType()
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 23:00:49 +0000 (23:00 +0000)]
DebugInfo: Require non-null in DIBuilder::retainType()

Assert that a non-null value is being passed in.  Note that I fixed the
one offender in clang in r233443.

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

9 years agoFixing a bug with optimized catch-all handlers in WinEHPrepare
Andrew Kaylor [Fri, 27 Mar 2015 22:31:12 +0000 (22:31 +0000)]
Fixing a bug with optimized catch-all handlers in WinEHPrepare

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

9 years agoVerifier: Call verifyModule() from llc and opt
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 22:04:28 +0000 (22:04 +0000)]
Verifier: Call verifyModule() from llc and opt

Change `llc` and `opt` to run `verifyModule()`.  This ensures that we
check the full module before `FunctionPass::doInitialization()` ever
gets called (I was getting crashes in `DwarfDebug` instead of verifier
failures when testing a WIP patch that checks operands of compile
units).  In `opt`, also move up debug-info-stripping so that it still
runs before verification.

There was a fair bit of broken code that was sitting in tree.
Interestingly, some were cases of a `select` that referred to itself in
`-instcombine` tests (apparently an intermediate result).  I split them
off to `*-noverify.ll` tests with RUN lines like this:

    opt < %s -S -disable-verify -instcombine | opt -S | FileCheck %s

This avoids verifying the input file (so we can get the broken code into
`-instcombine), but still verifies the output with a second call to
`opt` (to verify that `-instcombine` will clean it up like it should).

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

9 years ago[CMake] Removing duplicates from the list of test suites to generate targets for.
Chris Bieneman [Fri, 27 Mar 2015 21:45:49 +0000 (21:45 +0000)]
[CMake] Removing duplicates from the list of test suites to generate targets for.

Not doing this causes some headaches for users migrating from autoconf to CMake.

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

9 years agofix typo and 80-col; NFC
Sanjay Patel [Fri, 27 Mar 2015 21:45:18 +0000 (21:45 +0000)]
fix typo and 80-col; NFC

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

9 years agoAdd two small structs for readability in place of std::pair and std::tuple. NFC.
Rafael Espindola [Fri, 27 Mar 2015 21:34:24 +0000 (21:34 +0000)]
Add two small structs for readability in place of std::pair and std::tuple. NFC.

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

9 years agoConstrain the type of a parameter now that callers without this constraint have been...
David Blaikie [Fri, 27 Mar 2015 20:56:11 +0000 (20:56 +0000)]
Constrain the type of a parameter now that callers without this constraint have been removed.

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

9 years agoDebugInfo: Fix bad debug info for compile units and types
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 20:46:33 +0000 (20:46 +0000)]
DebugInfo: Fix bad debug info for compile units and types

Fix debug info in these tests, which started failing with a WIP patch to
verify compile units and types.  The problems look like they were all
caused by bitrot.  They fell into these categories:

  - Using `!{i32 0}` instead of `!{}`.
  - Using `!{null}` instead of `!{}`.
  - Using `!MDExpression()` instead of `!{}`.
  - Using `!8` instead of `!{!8}`.
  - `file:` references that pointed at `MDCompileUnit`s instead of the
    same `MDFile` as the compile unit.
  - `file:` references that were numerically off-by-one or (off-by-ten).

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

9 years ago[R600/SI] Fix testcase check line.
Ahmed Bougacha [Fri, 27 Mar 2015 20:41:42 +0000 (20:41 +0000)]
[R600/SI] Fix testcase check line.

Missing colon, instruction typo.

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

9 years ago[AArch64InstPrinter] Use the feature bits of the subtarget passed to the print
Akira Hatanaka [Fri, 27 Mar 2015 20:37:20 +0000 (20:37 +0000)]
[AArch64InstPrinter] Use the feature bits of the subtarget passed to the print
method.

This enables the instprinter to print a different system register name based on
the feature bits of the per-function subtarget.

Differential Revision: http://reviews.llvm.org/D8668

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

9 years ago[MCInstPrinter] Enable MCInstPrinter to change its behavior based on the
Akira Hatanaka [Fri, 27 Mar 2015 20:36:02 +0000 (20:36 +0000)]
[MCInstPrinter] Enable MCInstPrinter to change its behavior based on the
per-function subtarget.

Currently, code-gen passes the default or generic subtarget to the constructors
of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which
enables some targets (AArch64, ARM, and X86) to change their instprinter's
behavior based on the subtarget feature bits. Since the backend can now use
different subtargets for each function, instprinter has to be changed to use the
per-function subtarget rather than the default subtarget.

This patch takes the first step towards enabling instprinter to change its
behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to
AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the
various print methods table-gen auto-generates.

I will follow up with changes to instprinters of AArch64, ARM, and X86.

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

9 years ago[CodeGen] Don't attempt a tail-call with a non-forwarded explicit sret.
Ahmed Bougacha [Fri, 27 Mar 2015 20:35:49 +0000 (20:35 +0000)]
[CodeGen] Don't attempt a tail-call with a non-forwarded explicit sret.

Tailcalls are only OK with forwarded sret pointers. With explicit sret,
one approximation is to check that the pointer isn't an Instruction, as
in that case it might point into some local memory (alloca). That's not
OK with tailcalls.

Explicit sret counterpart to r233409.
Differential Revison: http://reviews.llvm.org/D8510

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

9 years ago[CodeGen] Don't attempt a tail-call with implicit sret.
Ahmed Bougacha [Fri, 27 Mar 2015 20:28:30 +0000 (20:28 +0000)]
[CodeGen] Don't attempt a tail-call with implicit sret.

Tailcalls are only OK with forwarded sret pointers. With sret demotion,
they're not, as we'd have a pointer into a soon-to-be-dead stack frame.

Differential Revison: http://reviews.llvm.org/D8510

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

9 years agoRecommit r233116 better: Remove a redundant instcombine involving bitcasts of geps...
David Blaikie [Fri, 27 Mar 2015 20:13:55 +0000 (20:13 +0000)]
Recommit r233116 better: Remove a redundant instcombine involving bitcasts of geps of bitcasts

This just didn't need to be here at all, but the assertion I tried to
add wasn't appropriate either - the circumstance isn't impossible, it's
just not important to deal with it here - the gep-rooted version of this
instcombine will handle this case, we don't need to duplicate it for the
case where the gep happens to be used in a bitcast.

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

9 years agoR600/SI: Fix VOP2 VI encoding
Marek Olsak [Fri, 27 Mar 2015 19:10:06 +0000 (19:10 +0000)]
R600/SI: Fix VOP2 VI encoding

Broken by "R600/SI: Refactor VOP2 instruction defs".

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

9 years ago[asan] Speed up isInterestingAlloca check
Anna Zaks [Fri, 27 Mar 2015 18:52:01 +0000 (18:52 +0000)]
[asan] Speed up isInterestingAlloca check

We make many redundant calls to isInterestingAlloca in the AddressSanitzier
pass. This is especially inefficient for allocas that have many uses. Let's
cache the results to speed up compilation.

The compile time improvements depend on the input. I did not see much
difference on benchmarks; however, I have a test case where compile time
goes from minutes to under a second.

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

9 years ago[bpf] add support for bpf pseudo instruction
Alexei Starovoitov [Fri, 27 Mar 2015 18:51:42 +0000 (18:51 +0000)]
[bpf] add support for bpf pseudo instruction

Expose bpf pseudo load instruction via intrinsic. It is used by front-ends that
can encode file descriptors directly into IR instead of relying on relocations.

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

9 years ago[RegisterCoalescer] Refine the terminal rule to still consider the terminal
Quentin Colombet [Fri, 27 Mar 2015 18:37:15 +0000 (18:37 +0000)]
[RegisterCoalescer] Refine the terminal rule to still consider the terminal
nodes.
When a node is terminal it is pushed at the end of the list of the copies to
coalesce instead of being completely ignored. In effect, this reduces its
priority over non-terminal nodes.

Because of that, we do not miss the rematerialization opportunities, nor the
copies that can be merged with more complex, than the terminal rule,
interference checks.

Related to PR22768.

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

9 years agoLLParser: Require non-null scope for MDLocation and MDLocalVariable
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 17:56:39 +0000 (17:56 +0000)]
LLParser: Require non-null scope for MDLocation and MDLocalVariable

Change `LLParser` to require a non-null `scope:` field for both
`MDLocation` and `MDLocalVariable`.  There's no need to wait for the
verifier for this check.  This also allows their `::getImpl()` methods
to assert that the incoming scope is non-null.

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

9 years agoRemove superfluous .str() and replace std::string concatenation with Twine.
Yaron Keren [Fri, 27 Mar 2015 17:51:30 +0000 (17:51 +0000)]
Remove superfluous .str() and replace std::string concatenation with Twine.

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

9 years agoAdd a -raw option to the -section mode of llvm-objdump.
Adrian Prantl [Fri, 27 Mar 2015 17:31:15 +0000 (17:31 +0000)]
Add a -raw option to the -section mode of llvm-objdump.

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

9 years agoVerifier: Check fields of MDVariable subclasses
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 17:29:58 +0000 (17:29 +0000)]
Verifier: Check fields of MDVariable subclasses

Check fields from `MDLocalVariable` and `MDGlobalVariable` and change
the accessors to downcast to the right types.  `getType()` still returns
`Metadata*` since it could be an `MDString`-based reference.

Since local variables require non-null scopes, I also updated `LLParser`
to require a `scope:` field.

A number of testcases had grown bitrot and started failing with this
patch; I committed them separately in r233349.  If I just broke your
out-of-tree testcases, you're probably hitting similar problems (so have
a look there).

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

9 years agoDebugInfo: Fix another bitrotted testcase
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 17:29:11 +0000 (17:29 +0000)]
DebugInfo: Fix another bitrotted testcase

Fix another case of a missing `scope:` field on an `MDLocalVariable`.

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

9 years ago[AArch64] Don't store available subtarget features in AArch64SysReg::SysRegMapper
Vladimir Sukharev [Fri, 27 Mar 2015 17:11:29 +0000 (17:11 +0000)]
[AArch64] Don't store available subtarget features in AArch64SysReg::SysRegMapper

Subtarget features must not be a part of the target machine. So, they are now not being stored in SysRegMapper, but provided each time fromString()/toString() are called

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8655

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

9 years agoCMake: enable installing utils
Derek Schuff [Fri, 27 Mar 2015 16:53:06 +0000 (16:53 +0000)]
CMake: enable installing utils

Added a new boolean CMake flag, LLVM_INSTALL_UTILS. When set,
the 'install' target will include in the bin directory the
utils binaries - e.g. FileCheck. This mirrors the autoconfig
behavior.

Test Plan:
Locally verified that utils binaries are copied when flag is set,
and not copied when flag is not set.

Reviewers: jfb, dschuff, beanz

Reviewed By: beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8587

Patch by Mircea Trofin

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

9 years agoWork around pr23045 and make it easier to reproduce.
Rafael Espindola [Fri, 27 Mar 2015 15:55:06 +0000 (15:55 +0000)]
Work around pr23045 and make it easier to reproduce.

Dropping old debug format requires the entire module to be read upfront.

This was failing only with the gold plugin, but that is just because
llvm-link was not upgrading metadata.

The new testcase using llvm-link shows the problem.

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

9 years agoClose unique sections when switching away from them.
Rafael Espindola [Fri, 27 Mar 2015 15:01:40 +0000 (15:01 +0000)]
Close unique sections when switching away from them.

It is not possible to switch back to unique secitons, so close them
automatically when switching away.

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

9 years agoFix subprogram-linkonce-weak.ll and subprogram-linkonce-weak-odr.ll for Windows.
Yaron Keren [Fri, 27 Mar 2015 13:52:12 +0000 (13:52 +0000)]
Fix subprogram-linkonce-weak.ll and subprogram-linkonce-weak-odr.ll for Windows.

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

9 years ago[Support] Remove statically initialized yet dead code.
Benjamin Kramer [Fri, 27 Mar 2015 11:01:53 +0000 (11:01 +0000)]
[Support] Remove statically initialized yet dead code.

The last user of this code vanished with r223368, but this function still was
around being executed on every process start, allocating some memory and then
never being used again. No functional change.

Also avoids occasional complaints about the benign leak in this function, like
PR23037.

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

9 years agoReapply r233175 and r233183: float2int.
James Molloy [Fri, 27 Mar 2015 10:36:57 +0000 (10:36 +0000)]
Reapply r233175 and r233183: float2int.

This re-adds float2int to the tree, after fixing PR23038. It turns
out the argument to APSInt() is true-if-unsigned, rather than
true-if-signed :(. Added testcase and explanatory comment.

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

9 years agoComplete the MachineScheduler fix made way back in r210390.
Andrew Trick [Fri, 27 Mar 2015 06:10:13 +0000 (06:10 +0000)]
Complete the MachineScheduler fix made way back in r210390.

"Fix the MachineScheduler's logic for updating ready times for in-order.
 Now the scheduler updates a node's ready time as soon as it is
 scheduled, before releasing dependent nodes."

This fix was only made in one variant of the ScheduleDAGMI driver.
Francois de Ferriere reported the issue in the other bit of code where
it was also needed.
I never got around to coming up with a test case, but it's an
obvious fix that shouldn't be delayed any longer.
I'll try to refactor this code a little better.

I did verify performance on a wide variety of targets and saw no
negative impact with this fix.

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

9 years ago[NFC] Fix typo in comment.
Sanjoy Das [Fri, 27 Mar 2015 06:06:48 +0000 (06:06 +0000)]
[NFC] Fix typo in comment.

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

9 years ago[NFC] Fix typo in comment.
Sanjoy Das [Fri, 27 Mar 2015 06:01:56 +0000 (06:01 +0000)]
[NFC] Fix typo in comment.

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

9 years agoCode cleanup [NFC]
Philip Reames [Fri, 27 Mar 2015 05:53:16 +0000 (05:53 +0000)]
Code cleanup [NFC]

The assertion here was more expensive then it needed to be.  We're only inserting allocas in the entry block, so we only need to consider ones in the entry block.

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

9 years agoMore code cleanup [NFC]
Philip Reames [Fri, 27 Mar 2015 05:47:00 +0000 (05:47 +0000)]
More code cleanup [NFC]

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

9 years agoMore code cleanup [NFC]
Philip Reames [Fri, 27 Mar 2015 05:39:32 +0000 (05:39 +0000)]
More code cleanup [NFC]

Minor naming, one potentially unsafe cast

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

9 years agoCode simplification and style cleanup
Philip Reames [Fri, 27 Mar 2015 05:34:44 +0000 (05:34 +0000)]
Code simplification and style cleanup

All the removed assertions are either implied locally by the assert at the top of the function or properties of the verifier.

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

9 years agoRequire a GC strategy be specified for functions which use gc.statepoint
Philip Reames [Fri, 27 Mar 2015 05:09:33 +0000 (05:09 +0000)]
Require a GC strategy be specified for functions which use gc.statepoint

This was discussed a while back and I left it optional for migration.  Since it's been far more than the 'week or two' that was discussed, time to actually make this manditory.

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

9 years agoAllow explicit spill slots to be specified for a gc.statepoint
Philip Reames [Fri, 27 Mar 2015 04:52:48 +0000 (04:52 +0000)]
Allow explicit spill slots to be specified for a gc.statepoint

This patch adds support for explicitly provided spill slots in the GC arguments of a gc.statepoint.  This is somewhat analogous to gcroot, but leverages the STATEPOINT MI node and StackMap infrastructure.  The motivation for this is:
1) The stack spilling code for gc.statepoints hasn't advanced as fast as I'd like.  One major option is to give up on doing spilling in the backend and do it at the IR level instead.  We'd give up the ability to have gc values in registers, but that's a minor cost in practice.  We are not neccessarily moving in that direction, but having the ability to prototype such a thing cheaply is interesting.
2) I want to port the gcroot lowering to use the statepoint infastructure.  Given the metadata printers for gcroot expect a fixed set of stack roots, it's easiest to just reuse the explicit stack slots and pass them directly to the underlying statepoint.

I'm holding off on the documentation for the new feature until I'm reasonable sure this is going to stick around.

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

9 years agoReintroduce the SelectionDAG scheduler test for r233351.
Andrew Trick [Fri, 27 Mar 2015 04:42:52 +0000 (04:42 +0000)]
Reintroduce the SelectionDAG scheduler test for r233351.

This test returns nonnative integer types which aren't supported on all targets.
The real issue with the SelectionDAG scheduler is with x86 EFLAGS.

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

9 years agoWinEH: Create a parent frame alloca for HandlerType xdata tables
David Majnemer [Fri, 27 Mar 2015 04:17:07 +0000 (04:17 +0000)]
WinEH: Create a parent frame alloca for HandlerType xdata tables

We don't have any logic to emit those tables yet, so the SDAG lowering
of this intrinsic is just a stub.  We can see the intrinsic in the
prepared IR, though.

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

9 years agoThis test should have been target specific. I missed that.
Andrew Trick [Fri, 27 Mar 2015 04:04:35 +0000 (04:04 +0000)]
This test should have been target specific. I missed that.

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

9 years agoRefactor Code inside LoopVectorizer's function isInductionVariable.
Karthik Bhat [Fri, 27 Mar 2015 03:44:15 +0000 (03:44 +0000)]
Refactor Code inside LoopVectorizer's function isInductionVariable.
This patch exposes LoopVectorizer's isInductionVariable function as common
a functionality.
http://reviews.llvm.org/D8608

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

9 years agoFix a bug in SelectionDAG scheduling backtracking code: PR22304.
Andrew Trick [Fri, 27 Mar 2015 03:44:13 +0000 (03:44 +0000)]
Fix a bug in SelectionDAG scheduling backtracking code: PR22304.

It can happen (by line CurSU->isPending = true; // This SU is not in
AvailableQueue right now.) that a SUnit is mark as available but is
not in the AvailableQueue. For SUnit being selected for scheduling
both conditions must be met.

This patch mainly defensively protects from invalid removing a node
from a queue. Sometimes nodes are marked isAvailable but are not in
the queue because they have been defered due to some hazard.

Patch by Pawel Bylica!

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

9 years agoRevert r233175 and r233183 with it. This pulls float2int back out of the tree, due...
Nick Lewycky [Fri, 27 Mar 2015 02:00:11 +0000 (02:00 +0000)]
Revert r233175 and r233183 with it. This pulls float2int back out of the tree, due to PR23038.

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

9 years agoDebugInfo: Update testcases with invalid variables
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 01:58:34 +0000 (01:58 +0000)]
DebugInfo: Update testcases with invalid variables

Fix testcases whose variables are invalid.  I'm working on a patch that
adds `Verifier` checks for `MDLocalVariable` (and `MDGlobalVariable`),
and these failed because:

  - `scope:` fields need to point at `MDLocalScope` and can't be null.
  - `file:` fields need to point at `MDFile`.
  - `inlinedAt:` fields need to point at `MDLocation`.

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

9 years ago[AsmPrinter] Don't assert on GOT equivalent non-constant users.
Ahmed Bougacha [Fri, 27 Mar 2015 01:40:54 +0000 (01:40 +0000)]
[AsmPrinter] Don't assert on GOT equivalent non-constant users.

We used to dyn_cast<Constant> in the recursive call, but cast<> in the
initial one, and there can be non-Constant initial users.

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

9 years agoDIBuilder: Change a few helpers to return downcasted MDNodes
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 00:34:10 +0000 (00:34 +0000)]
DIBuilder: Change a few helpers to return downcasted MDNodes

Change `getNonCompileUnitScope()` to return `MDScope` and
`getConstantAsMetadata()` to return `ConstantAsMetadata`.  This will
make it easier to start requiring more type safety in the debug info
hierarchy.

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

9 years agoAsmWriter: Cleanup debug info fields with MDFieldPrinter, NFC
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 00:17:42 +0000 (00:17 +0000)]
AsmWriter: Cleanup debug info fields with MDFieldPrinter, NFC

Move all the `MDNode` field helper methods into a new class,
`MDFieldPrinter`, and add helpers for integers, bools, and `DW_*`
symbolic constants.  This reduces a ton of code duplication, and makes
it more mechanical to update `AsmWriter` to print broken code in the
context of stricter accessors (like in r233322).

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

9 years agoDeduplicate a bunch of setOpActions into an MVT range-for. NFC.
Ahmed Bougacha [Thu, 26 Mar 2015 23:21:03 +0000 (23:21 +0000)]
Deduplicate a bunch of setOpActions into an MVT range-for. NFC.

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

9 years ago[CodeGen] Report error rather than crash when unable to makeLibCall.
Ahmed Bougacha [Thu, 26 Mar 2015 22:46:58 +0000 (22:46 +0000)]
[CodeGen] Report error rather than crash when unable to makeLibCall.

Also, make the assumption explicit in the header.

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

9 years ago[CodeGen] Don't pretend we can expand f16 libcalls.
Ahmed Bougacha [Thu, 26 Mar 2015 22:44:58 +0000 (22:44 +0000)]
[CodeGen] Don't pretend we can expand f16 libcalls.

We used to mark a bunch of libm nodes as Expand for f16.  There are no
libcalls we can use for those, so we eventually just hit an unhelpful
llvm_unreachable in ExpandFPLibCall.

Instead, just ignore them altogether.  If nothing else changes, we'll
then get the more descriptive and pleasant "Cannot select" fatal error.

There's an argument to be made for consistency, but f16 is already
special in all the good ways, and as long as there's no f16 support in
the ops expander (this patch), as well as the Soften/Expand float
legalizers (which, when hit, will currently segfault), I think there's
no point in even pretending we can legalize any of this.

This shouldn't affect anything that's not already broken.

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

9 years agoUse movw/movt instead of constant pool loads to lower byval parameter copies
Derek Schuff [Thu, 26 Mar 2015 22:11:00 +0000 (22:11 +0000)]
Use movw/movt instead of constant pool loads to lower byval parameter copies

Summary:
The ARM backend can use a loop to implement copying byval parameters before
a call. In non-thumb2 mode it uses a constant pool load to materialize the
trip count. For targets that need movt instead (e.g. Native Client), use
the same code as in thumb2 mode to materialize the trip count.

Reviewers: jfb, t.p.northover

Differential Revision: http://reviews.llvm.org/D8442

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

9 years agoVerifier: Check accessors of MDLocation
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 22:05:04 +0000 (22:05 +0000)]
Verifier: Check accessors of MDLocation

Check accessors of `MDLocation`, and change them to `cast<>` down to the
right types.  Also add type-safe factory functions.

All the callers that handle broken code need to use the new versions of
the accessors (`getRawScope()` instead of `getScope()`) that still
return `Metadata*`.  This is also necessary for things like
`MDNodeKeyImpl<MDLocation>` (in LLVMContextImpl.h) that need to unique
the nodes when their operands might still be forward references of the
wrong type.

In the `Value` hierarchy, consumers that handle broken code use
`getOperand()` directly.  However, debug info nodes have a ton of
operands, and their order (even their existence) isn't stable yet.  It's
safer and more maintainable to add an explicit "raw" accessor on the
class itself.

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

9 years agoDefault to armv7 cpu for NaCl when march=arm
Derek Schuff [Thu, 26 Mar 2015 21:58:46 +0000 (21:58 +0000)]
Default to armv7 cpu for NaCl when march=arm

Summary:
When the arch is given as "arm" clang uses the default target CPU from
LLVM to determine what the real arch should be (i.e. "arm" becomes
"armv4t" because LLVM's getARMCPUForArch falls back to "arm7tdmi").
Default to "cortex-a8" so that we end up with "armv7" in clang.

the nacl-direct.c test in clang also covers this case.

Differential Revision: http://reviews.llvm.org/D8589

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

9 years agoFix PR23025.
Rafael Espindola [Thu, 26 Mar 2015 21:11:00 +0000 (21:11 +0000)]
Fix PR23025.

There is something in link.exe that requires a relocation to use a
global symbol. Not doing so breaks the chrome build on windows.

This patch sets isWeak for that to work. To compensate,
we then need to look past those symbols when not creating relocations.

This patch includes an ELF test that matches GNU as behaviour.

I am still reducing the chrome build issue and will add a test
once that is done.

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

9 years agoFix rare case where APInt divide algorithm applied un-needed transformation.
Yaron Keren [Thu, 26 Mar 2015 19:45:19 +0000 (19:45 +0000)]
Fix rare case where APInt divide algorithm applied un-needed transformation.

APInt uses Knuth's D algorithm for long division. In rare cases the
implementation applied a transformation that was not needed.

Added unit tests for long division. KnuthDiv() procedure is fully covered.
There is a case in APInt::divide() that I believe is never used (marked with
a comment) as all users of divide() handle trivial cases earlier.

Patch by Pawel Bylica!

  http://reviews.llvm.org/D8448

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

9 years ago[ADT][CMake][AutoConf] Fail-fast iterators for DenseMap
Sanjoy Das [Thu, 26 Mar 2015 19:25:01 +0000 (19:25 +0000)]
[ADT][CMake][AutoConf] Fail-fast iterators for DenseMap

Summary:
This patch is an attempt at making `DenseMapIterator`s "fail-fast".
Fail-fast iterators that have been invalidated due to insertion into
the host `DenseMap` deterministically trip an assert (in debug mode)
on access, instead of non-deterministically hitting memory corruption
issues.

Enabling fail-fast iterators breaks the LLVM C++ ABI, so they are
predicated on `LLVM_ENABLE_ABI_BREAKING_CHECKS`.
`LLVM_ENABLE_ABI_BREAKING_CHECKS` by default flips with
`LLVM_ENABLE_ASSERTS`, but can be clamped to ON or OFF using the CMake /
autoconf build system.

Reviewers: chandlerc, dexonsmith, rnk, zturner

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8351

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

9 years ago[ARM] Fix some non-portable shell syntax in r233301's tests
Justin Bogner [Thu, 26 Mar 2015 19:24:13 +0000 (19:24 +0000)]
[ARM] Fix some non-portable shell syntax in r233301's tests

The "|&" operator isn't POSIX, so it can fail depending on the host's
default shell. Avoid it.

There were also a couple of places that did "2>1", but this creates a
file called "1". They clearly meant "2>&1".

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

9 years agoIgnore compile_commands.json only at the root of the tree.
Paul Robinson [Thu, 26 Mar 2015 18:55:42 +0000 (18:55 +0000)]
Ignore compile_commands.json only at the root of the tree.
Can avoid a problem if tools/clang/tools/extra is in the tree.

Patch by Douglas Yung!

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

9 years agoSupress MSVC padding warning in alignment test
Andrew Kaylor [Thu, 26 Mar 2015 18:48:42 +0000 (18:48 +0000)]
Supress MSVC padding warning in alignment test

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

9 years agoAdds an option to disable ARM ld/st optim pass
Renato Golin [Thu, 26 Mar 2015 18:38:04 +0000 (18:38 +0000)]
Adds an option to disable ARM ld/st optim pass

Enabled by default, but it's useful when debugging with llc.

Patch by Ranjeet Singh.

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

9 years agoReapply "Linker: Drop function pointers for overridden subprograms"
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 18:35:30 +0000 (18:35 +0000)]
Reapply "Linker: Drop function pointers for overridden subprograms"

This reverts commit r233254, effectively reapplying r233164 (and its
successors), with an additional testcase for when subprograms match
exactly.  This fixes PR22792 (again).

I'm using the same approach, but I've moved up the call to
`stripReplacedSubprograms()`.  The function pointers need to be dropped
before mapping any metadata from the source module, or else this can
drop the function from new subprograms that have merged (via Metadata
uniquing) with the old ones.  Dropping the pointers first prevents them
from merging.

**** The original commit message follows. ****

Linker: Drop function pointers for overridden subprograms

Instead of dropping subprograms that have been overridden, just set
their function pointers to `nullptr`.  This is a minor adjustment to the
stop-gap fix for PR21910 committed in r224487, and fixes the crasher
from PR22792.

The problem that r224487 put a band-aid on: how do we find the canonical
subprogram for a `Function`?  Since the backend currently relies on
`DebugInfoFinder` (which does a naive in-order traversal of compile
units and picks the first subprogram) for this, r224487 tried dropping
non-canonical subprograms.

Dropping subprograms fails because the backend *also* builds up a map
from subprogram to compile unit (`DwarfDebug::SPMap`) based on the
subprogram lists.  A missing subprogram causes segfaults later when an
inlined reference (such as in this testcase) is created.

Instead, just drop the `Function` pointer to `nullptr`, which nicely
mirrors what happens when an already-inlined `Function` is optimized
out.  We can't really be sure that it's the same definition anyway, as
the testcase demonstrates.

This still isn't completely satisfactory.  Two flaws at least that I can
think of:

  - I still haven't found a straightforward way to make this symmetric
    in the IR.  (Interestingly, the DWARF output is already symmetric,
    and I've tested for that to be sure we don't regress.)
  - Using `DebugInfoFinder` to find the canonical subprogram for a
    function is kind of crazy.  We should just attach metadata to the
    function, like this:

        define weak i32 @foo(i32, i32) !dbg !MDSubprogram(...) {

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

9 years ago[ARM] Add v8.1a "Rounding Double Multiply Add/Subtract" extension
Vladimir Sukharev [Thu, 26 Mar 2015 18:29:02 +0000 (18:29 +0000)]
[ARM] Add v8.1a "Rounding Double Multiply Add/Subtract" extension

Reviewers: t.p.northover

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8503

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

9 years ago[AArch64] Rename Pairs to Mappings in AArch64NamedImmMapper
Vladimir Sukharev [Thu, 26 Mar 2015 17:57:39 +0000 (17:57 +0000)]
[AArch64] Rename Pairs to Mappings in AArch64NamedImmMapper

Third element is to be added soon to "struct AArch64NamedImmMapper::Mapping". So its instances are renamed from ...Pairs to ...Mappings

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8582

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

9 years ago[AArch64] Move initializations of AArch64NamedImmMapper out of void AArch64Operand...
Vladimir Sukharev [Thu, 26 Mar 2015 17:29:53 +0000 (17:29 +0000)]
[AArch64] Move initializations of AArch64NamedImmMapper out of void AArch64Operand::print(...)

class AArch64NamedImmMapper is to become dependent of SubTargetFeatures, while class AArch64Operand don't have access to the latter.

So, AArch64NamedImmMapper constructor invocations are refactored away from methods of AArch64Operand.

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8579

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

9 years ago[SCEV] Revert bailout added in r75511.
Sanjoy Das [Thu, 26 Mar 2015 17:28:26 +0000 (17:28 +0000)]
[SCEV] Revert bailout added in r75511.

Summary:
With the introduction of MarkPendingLoopPredicates in r157092, I don't
think the bailout is needed anymore.

Reviewers: atrick, nicholas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8624

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

9 years agorevert inadvertent change
Sanjay Patel [Thu, 26 Mar 2015 17:19:24 +0000 (17:19 +0000)]
revert inadvertent change

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

9 years agocomment cleanup; NFC
Sanjay Patel [Thu, 26 Mar 2015 17:18:17 +0000 (17:18 +0000)]
comment cleanup; NFC

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

9 years agoRemove outdated README-SSE.txt entries.
Benjamin Kramer [Thu, 26 Mar 2015 17:12:16 +0000 (17:12 +0000)]
Remove outdated README-SSE.txt entries.

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

9 years agoInstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0
Benjamin Kramer [Thu, 26 Mar 2015 17:12:06 +0000 (17:12 +0000)]
InstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0

Anding and comparing with zero can be done in a single instruction on
most archs so this is a bit cheaper.

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

9 years ago[AArch64, ARM] Add v8.1a architecture and generic cpu
Vladimir Sukharev [Thu, 26 Mar 2015 17:05:54 +0000 (17:05 +0000)]
[AArch64, ARM] Add v8.1a architecture and generic cpu

New architecture and cpu added, following http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: t.p.northover

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8505

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

9 years agoUse SDValue bool checks; NFC intended
Sanjay Patel [Thu, 26 Mar 2015 16:55:43 +0000 (16:55 +0000)]
Use SDValue bool checks; NFC intended

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

9 years agofix indent; NFC
Sanjay Patel [Thu, 26 Mar 2015 16:55:17 +0000 (16:55 +0000)]
fix indent; NFC

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

9 years ago[SLSR] handle candidate form &B[i * S]
Jingyue Wu [Thu, 26 Mar 2015 16:49:24 +0000 (16:49 +0000)]
[SLSR] handle candidate form &B[i * S]

Summary:
This patch enhances SLSR to handle another candidate form &B[i * S]. If
we found two candidates

S1: X = &B[i * S]
S2: Y = &B[i' * S]

and S1 dominates S2, we can replace S2 with

Y = &X[(i' - i) * S]

Test Plan:
slsr-gep.ll
X86/no-slsr.ll: verify that we do not run SLSR on GEPs that already fit into
an addressing mode

Reviewers: eliben, atrick, meheff, hfinkel

Reviewed By: hfinkel

Subscribers: sanjoy, llvm-commits

Differential Revision: http://reviews.llvm.org/D7459

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

9 years agoSometimes report_fatal_error is called when there is not a handler function used...
Aaron Ballman [Thu, 26 Mar 2015 16:24:38 +0000 (16:24 +0000)]
Sometimes report_fatal_error is called when there is not a handler function used to fail gracefully. In that case, RunInterruptHandlers is called, which attempts to enter a critical section object. Ensure that the critical section is properly initialized so that this code functions properly, and tools like clang-tidy do not crash in Debug builds.

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

9 years ago[mips] Move the setATReg definition inside the MipsAssemblerOptions class. NFC.
Toma Tabacu [Thu, 26 Mar 2015 13:08:55 +0000 (13:08 +0000)]
[mips] Move the setATReg definition inside the MipsAssemblerOptions class. NFC.

Summary: This groups all of the MipsAssemblerOptions functionality together, making it more reader-friendly.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8445

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

9 years ago[X86][FastIsel] Teach how to select vector load instructions.
Andrea Di Biagio [Thu, 26 Mar 2015 11:29:02 +0000 (11:29 +0000)]
[X86][FastIsel] Teach how to select vector load instructions.

This patch teaches fast-isel how to select 128-bit vector load instructions.
Added test CodeGen/X86/fast-isel-vecload.ll

Differential Revision: http://reviews.llvm.org/D8605

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

9 years agoRevert "Linker: Drop function pointers for overridden subprograms"
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:27:45 +0000 (05:27 +0000)]
Revert "Linker: Drop function pointers for overridden subprograms"

This reverts commit r233164 and its testcase follow-ups in r233165,
r233207, r233214, and r233221.  It apparently unleashed an LTO bootstrap
failure, at least on Darwin:

http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3376/

I'm reproducing now.

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

9 years agobugpoint: Verify input files
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:03:10 +0000 (05:03 +0000)]
bugpoint: Verify input files

Like r233229 for `llvm-link`, start verifying input files to `bugpoint`.

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

9 years agobugpoint: Return early after error, NFC
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:03:06 +0000 (05:03 +0000)]
bugpoint: Return early after error, NFC

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

9 years ago[RegisterCoalescer] Add a rule to consider more profitable copies first when
Quentin Colombet [Thu, 26 Mar 2015 01:01:48 +0000 (01:01 +0000)]
[RegisterCoalescer] Add a rule to consider more profitable copies first when
those are in the same basic block.
The previous approach was the topological order of the basic block.

By default this rule is disabled.

Related to PR22768.

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

9 years agoTestcase for r233239.
Eric Christopher [Thu, 26 Mar 2015 00:57:33 +0000 (00:57 +0000)]
Testcase for r233239.

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

9 years agoAdd computeFSAdditions to the function based subtarget creation
Eric Christopher [Thu, 26 Mar 2015 00:50:23 +0000 (00:50 +0000)]
Add computeFSAdditions to the function based subtarget creation
for PPC due to some unfortunate default setting via TargetMachine
creation. I've added a FIXME on how this can be unraveled in the
backend and a test to make sure we successfully legalize 64-bit things
if we say we're 64-bits.

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

9 years agollvm-link: Verify input modules
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 23:22:10 +0000 (23:22 +0000)]
llvm-link: Verify input modules

Otherwise, broken input modules can cause assertions.  I've updated two
of the testcases that started failing (modules that had `Require` flags
but didn't meet their own requirements), but Rafael and I decided that
test/Linker/2011-08-22-ResolveAlias.ll should just be deleted outright
-- it's a leftover of the way llvm-gcc used to implement weakref.

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

9 years agoFix typo in comment.
Nico Weber [Wed, 25 Mar 2015 22:34:16 +0000 (22:34 +0000)]
Fix typo in comment.

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

9 years ago[ValueTracking] Fix PR23011.
Sanjoy Das [Wed, 25 Mar 2015 22:33:53 +0000 (22:33 +0000)]
[ValueTracking] Fix PR23011.

Summary:
`ComputeNumSignBits` returns incorrect results for `srem` instructions.
This change fixes the issue and adds a test case.

Reviewers: nadav, nicholas, atrick

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8600

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

9 years ago[DAGCombiner] Add support for TRUNCATE + FP_EXTEND vector constant folding
Simon Pilgrim [Wed, 25 Mar 2015 22:30:31 +0000 (22:30 +0000)]
[DAGCombiner] Add support for TRUNCATE + FP_EXTEND vector constant folding

This patch adds supports for the vector constant folding of TRUNCATE and FP_EXTEND instructions and tidies up the SINT_TO_FP and UINT_TO_FP instructions to match.

It also moves the vector constant folding for the FNEG and FABS instructions to use the DAG.getNode() functionality like the other unary instructions.

Differential Revision: http://reviews.llvm.org/D8593

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

9 years agoLinker: Stop using -gmlt test/Linker/subprogram-linkonce-weak.ll
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 21:36:41 +0000 (21:36 +0000)]
Linker: Stop using -gmlt test/Linker/subprogram-linkonce-weak.ll

As dblaikie pointed out, if I stop setting `emissionKind: 2` then the
backend won't do magical things on Linux vs. Darwin.  I had wrongly
assumed that there were stricter requirements on the input if we weren't
in line-tables-only mode, but apparently not.

With that knowledge, clean up this testcase a little more.

  - Set `emissionKind: 1`.
  - Add back checks for the weak version of @foo.
  - Check more robustly that we have the right subprograms by checking
    the `DW_AT_decl_file` and `DW_AT_decl_line` which now show up.
  - Check the line table in isolation (since it's no longer doubling as
    an indirect test for the subprogram of the weak version of @foo).

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

9 years agoFix remaining MSVC warning
Andrew Kaylor [Wed, 25 Mar 2015 21:33:24 +0000 (21:33 +0000)]
Fix remaining MSVC warning

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

9 years agoRegisterCoalescer: Fix implicit def handling in register coalescer
Matthias Braun [Wed, 25 Mar 2015 21:18:24 +0000 (21:18 +0000)]
RegisterCoalescer: Fix implicit def handling in register coalescer

If liveranges induced by an IMPLICIT_DEF get completely covered by a
proper liverange the IMPLICIT_DEF instructions and its corresponding
definitions have to be removed from the live ranges. This has to happen
in the subregister live ranges as well (I didn't see this case earlier
because in most programs only some subregisters are covered and the
IMPLCIT_DEF won't get removed).

No testcase, I spent hours trying to create one for one of the public
targets, but ultimately failed because I couldn't manage to properly
control the placement of COPY and IMPLICIT_DEF instructions from an .ll
file.

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

9 years agoMachineVerifier: slightly simplify code that is only called with vregs
Matthias Braun [Wed, 25 Mar 2015 21:18:22 +0000 (21:18 +0000)]
MachineVerifier: slightly simplify code that is only called with vregs

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

9 years agoLinker: Loosen checks slightly from r233207
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 20:51:21 +0000 (20:51 +0000)]
Linker: Loosen checks slightly from r233207

According to at least one bot [1], function prologues aren't always
empty for these functions.  Skip that part of the follow-up check.

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