OSDN Git Service

android-x86/external-llvm.git
7 years agoMIRParser/MIRPrinter: Compute isSSA instead of printing/parsing it.
Matthias Braun [Wed, 24 Aug 2016 01:32:41 +0000 (01:32 +0000)]
MIRParser/MIRPrinter: Compute isSSA instead of printing/parsing it.

Specifying isSSA is an extra line at best and results in invalid MI at
worst. Compute the value instead.

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

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

7 years agoIncrease the size of the sigaltstack used by LLVM signal handlers. 8KB is not
Richard Smith [Wed, 24 Aug 2016 00:54:49 +0000 (00:54 +0000)]
Increase the size of the sigaltstack used by LLVM signal handlers. 8KB is not
sufficient in some cases; increase to 64KB, which should be enough for anyone :)

Patch by github.com/bryant!

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

7 years agoMachineModuleInfo: Avoid dummy constructor, use INITIALIZE_TM_PASS
Matthias Braun [Wed, 24 Aug 2016 00:42:05 +0000 (00:42 +0000)]
MachineModuleInfo: Avoid dummy constructor, use INITIALIZE_TM_PASS

Change this pass constructor to just accept a const TargetMachine * and
use INITIALIZE_TM_PASS, that way we can get rid of the dummy
constructor. The pass will still fail when calling the default
constructor leading to TM == nullptr, this is no different than before
but is more in line what other codegen passes are doing and avoids the
dummy constructor.

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

7 years ago[ADCE] Add control dependence computation
David Callahan [Wed, 24 Aug 2016 00:10:06 +0000 (00:10 +0000)]
[ADCE] Add control dependence computation

Summary:
This is part of a serious of patches to evolve ADCE.cpp to support
removing of unnecessary control flow.

This patch adds the ability to compute control dependences using
the iterated dominance frontier. We extend the liveness propagation
to alternate between data and control dependences until convergences.

Modify the pass manager intergation to compute the post-dominator tree
needed for iterator dominance frontier.

We still force all terminators live for now until we add code to
handlinge removing control flow in a later patch.

No changes to effective behavior with this patch

Previous patches:

D23225 [ADCE] Modify data structures to support removing control flow
D23065 [ADCE] Refactor anticipating new functionality (NFC)
D23102 [ADCE] Refactoring for new functionality (NFC)

Reviewers: nadav, majnemer, mehdi_amini

Subscribers: twoh, freik, llvm-commits

Differential Revision: https://reviews.llvm.org/D23559

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

7 years ago[stackmaps] Remove an unneeded member variable [NFC]
Philip Reames [Tue, 23 Aug 2016 23:58:08 +0000 (23:58 +0000)]
[stackmaps] Remove an unneeded member variable [NFC]

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

7 years ago[libFuzzer] fix link in docs
Kostya Serebryany [Tue, 23 Aug 2016 23:43:08 +0000 (23:43 +0000)]
[libFuzzer] fix link in docs

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

7 years ago[libFuzzer] collect 64 states for value profile, not 65
Kostya Serebryany [Tue, 23 Aug 2016 23:37:37 +0000 (23:37 +0000)]
[libFuzzer] collect 64 states for value profile, not 65

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

7 years ago[libFuzzer] docs on value profile
Kostya Serebryany [Tue, 23 Aug 2016 23:36:21 +0000 (23:36 +0000)]
[libFuzzer] docs on value profile

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

7 years ago[stackmaps] More extraction of common code [NFCI]
Philip Reames [Tue, 23 Aug 2016 23:33:29 +0000 (23:33 +0000)]
[stackmaps] More extraction of common code [NFCI]

General cleanup before starting to work on the part I want to actually change.

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

7 years ago[LoopUnroll] By default disable unrolling when optimizing for size.
Michael Zolotukhin [Tue, 23 Aug 2016 23:13:15 +0000 (23:13 +0000)]
[LoopUnroll] By default disable unrolling when optimizing for size.

Summary:
In clang commit r268509 we started to invoke loop-unroll pass from the
driver even under -Os. However, we happen to not initialize optsize
thresholds properly, which si fixed with this change.

r268509 led to some big compile time regressions, because we started to
unroll some loops that we didn't unroll before. With this change I hope
to recover most of the regressions. We still are slightly slower than
before, because we do some checks here and there in loop-unrolling
before we bail out, but at least the slowdown is not that huge now.

Reviewers: hfinkel, chandlerc

Subscribers: mzolotukhin, llvm-commits

Differential Revision: https://reviews.llvm.org/D23388

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

7 years agoDon't use "return {...}" to initialize a std::tuple. This has only been valid
Richard Smith [Tue, 23 Aug 2016 22:21:58 +0000 (22:21 +0000)]
Don't use "return {...}" to initialize a std::tuple. This has only been valid
since 2015 (n4387), though it's allowed by a library DR so new implementations
accept it in their C++11 modes...

This should unbreak the build with libstdc++ 4.9.

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

7 years ago#ifdef out validation code when asserts are disabled to remove unused variable
Richard Smith [Tue, 23 Aug 2016 22:14:15 +0000 (22:14 +0000)]
#ifdef out validation code when asserts are disabled to remove unused variable
warnings.

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

7 years agoRemove unused data member to unbreak -Werror builds.
Richard Smith [Tue, 23 Aug 2016 22:10:46 +0000 (22:10 +0000)]
Remove unused data member to unbreak -Werror builds.

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

7 years agoRevert r279564. It introduces undefined behavior (binding a reference to a
Richard Smith [Tue, 23 Aug 2016 22:08:27 +0000 (22:08 +0000)]
Revert r279564. It introduces undefined behavior (binding a reference to a
dereferenced null pointer) in MachineModuleInfo::MachineModuleInfo that causes
-Werror builds (including several buildbots) to fail.

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

7 years agoGlobalISel: add some G_TRUNCs to make icmp test valid MIR.
Tim Northover [Tue, 23 Aug 2016 22:07:31 +0000 (22:07 +0000)]
GlobalISel: add some G_TRUNCs to make icmp test valid MIR.

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

7 years ago[InstCombine] use local variables for repeated values; NFCI
Sanjay Patel [Tue, 23 Aug 2016 22:05:55 +0000 (22:05 +0000)]
[InstCombine] use local variables for repeated values; NFCI

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

7 years ago[MC] Support .dc directives in assembler parser
Petr Hosek [Tue, 23 Aug 2016 21:34:53 +0000 (21:34 +0000)]
[MC] Support .dc directives in assembler parser

While these directives are mostly aliases for the existing integer
and float value directives, some of them like .dc.a have no direct
equivalents and are sometimes being used for convenience.

Differential Revision: https://reviews.llvm.org/D23810

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

7 years ago[ThinLTO] Add caching to the new LTO API
Mehdi Amini [Tue, 23 Aug 2016 21:30:12 +0000 (21:30 +0000)]
[ThinLTO] Add caching to the new LTO API

Add the ability to plug a cache on the LTO API.
I tried to write such that a linker implementation can
control the cache backend. This is intrusive and I'm
not totally happy with it, but I can't figure out a
better design right now.

Differential Revision: https://reviews.llvm.org/D23599

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

7 years ago[InstCombine] move foldICmpShrConstConst() contents to foldICmpShrConst(); NFCI
Sanjay Patel [Tue, 23 Aug 2016 21:25:13 +0000 (21:25 +0000)]
[InstCombine] move foldICmpShrConstConst() contents to foldICmpShrConst(); NFCI

There will only be 3 lines of code in foldICmpShrConst() when the cleanup is done,
so it doesn't make much sense to have a separate function for a single fold.

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

7 years ago[stackmaps] Extract out magic constants [NFCI]
Philip Reames [Tue, 23 Aug 2016 21:21:43 +0000 (21:21 +0000)]
[stackmaps] Extract out magic constants [NFCI]

This is a first step towards clarifying the exact MI semantics of stackmap's "live values".

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

7 years agoMachineFunction: Introduce NoPHIs property
Matthias Braun [Tue, 23 Aug 2016 21:19:49 +0000 (21:19 +0000)]
MachineFunction: Introduce NoPHIs property

I want to compute the SSA property of .mir files automatically in
upcoming patches. The problem with this is that some inputs will be
reported as static single assignment with some passes claiming not to
support SSA form.  In reality though those passes do not support PHI
instructions => Track the presence of PHI instructions separate from the
SSA property.

Differential Revision: https://reviews.llvm.org/D22719

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

7 years agoGlobalISel: add forgotten test-case for G_ICMP
Tim Northover [Tue, 23 Aug 2016 21:11:36 +0000 (21:11 +0000)]
GlobalISel: add forgotten test-case for G_ICMP

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

7 years ago[InstCombine] remove icmp shr folds that are already handled by InstSimplify
Sanjay Patel [Tue, 23 Aug 2016 21:01:35 +0000 (21:01 +0000)]
[InstCombine] remove icmp shr folds that are already handled by InstSimplify

AFAICT, these already worked in all cases for scalar types, and I enhanced
the code to work for vector types in:
https://reviews.llvm.org/rL279543

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

7 years agoGlobalISel: make truncate/extend casts uniform
Tim Northover [Tue, 23 Aug 2016 21:01:33 +0000 (21:01 +0000)]
GlobalISel: make truncate/extend casts uniform

They really should have both types represented, but early variants were created
before MachineInstrs could have multiple types so they're rather ambiguous.

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

7 years agoGlobalISel: legalize integer comparisons on AArch64.
Tim Northover [Tue, 23 Aug 2016 21:01:26 +0000 (21:01 +0000)]
GlobalISel: legalize integer comparisons on AArch64.

Next step is doing both legalizations at the same time! Marvel at GlobalISel's
cunning.

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

7 years agoGlobalISel: legalize conditional branches on AArch64.
Tim Northover [Tue, 23 Aug 2016 21:01:20 +0000 (21:01 +0000)]
GlobalISel: legalize conditional branches on AArch64.

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

7 years agoCodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses
Matthias Braun [Tue, 23 Aug 2016 20:58:29 +0000 (20:58 +0000)]
CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses

Re-apply this commit with the deletion of a MachineFunction delegated to
a separate pass to avoid use after free when doing this directly in
AsmPrinter.

This patch removes the MachineFunctionAnalysis. Instead we keep a
map from IR Function to MachineFunction in the MachineModuleInfo.

This allows the insertion of ModulePasses into the codegen pipeline
without breaking it because the MachineFunctionAnalysis gets dropped
before a module pass.

Peak memory should stay unchanged without a ModulePass in the codegen
pipeline: Previously the MachineFunction was freed at the end of a codegen
function pipeline because the MachineFunctionAnalysis was dropped; With
this patch the MachineFunction is freed after the AsmPrinter has
finished.

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

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

7 years ago[ValueTracking] Use a function_ref to avoid multiple instantiations
David Majnemer [Tue, 23 Aug 2016 20:52:00 +0000 (20:52 +0000)]
[ValueTracking] Use a function_ref to avoid multiple instantiations

No functional change intended, this should just be a code size
improvement.

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

7 years ago[SLP] Avoid signed integer overflow
Matthew Simpson [Tue, 23 Aug 2016 20:48:50 +0000 (20:48 +0000)]
[SLP] Avoid signed integer overflow

The test case included with r279125 exposed an existing signed integer
overflow. Since getTreeCost can return INT_MAX, we can't sum this cost together
with other costs, such as getReductionCost.

This patch removes the possibility of assigning a cost of INT_MAX. Since we
were previously using INT_MAX as an indicator for "should not vectorize", we
now explicitly check this condition with "isTreeTinyAndNotFullyVectorizable"
before computing a cost.

This patch adds a run-line to the test case used for r279125 that ensures we
don't vectorize. Previously, this line would vectorize the test case by chance
due to undefined behavior in the cost calculation.

Differential Revision: https://reviews.llvm.org/D23723

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

7 years agoRemove unused translation unit.
Zachary Turner [Tue, 23 Aug 2016 20:08:02 +0000 (20:08 +0000)]
Remove unused translation unit.

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

7 years agoUpdate coding standards for include style.
Zachary Turner [Tue, 23 Aug 2016 20:07:32 +0000 (20:07 +0000)]
Update coding standards for include style.

Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D23591

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

7 years ago[LTO] Fix test following r279550
Mehdi Amini [Tue, 23 Aug 2016 19:32:41 +0000 (19:32 +0000)]
[LTO] Fix test following r279550

The output name changed, but it was passing locally
using the old output still present in the build dir.

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

7 years agoGlobalISel: extend legalizer interface to handle multiple types.
Tim Northover [Tue, 23 Aug 2016 19:30:42 +0000 (19:30 +0000)]
GlobalISel: extend legalizer interface to handle multiple types.

Instructions like G_ICMP have multiple types that may need to be legalized (the
boolean output and nearly arbitrary inputs in this case). So the legalizer must
be capable of deciding what to do for each of them separately.

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

7 years agoGlobalISel: mark pointer casts legal on AArch64.
Tim Northover [Tue, 23 Aug 2016 19:30:38 +0000 (19:30 +0000)]
GlobalISel: mark pointer casts legal on AArch64.

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

7 years ago[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)
Mehdi Amini [Tue, 23 Aug 2016 18:39:15 +0000 (18:39 +0000)]
[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)

This adds a test for r279532, thanks David Li for noticing :)

Recommit r279545 after committing first a dependent patch.

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

7 years agoStop always creating and running an LTO compilation if there is not a single LTO...
Mehdi Amini [Tue, 23 Aug 2016 18:39:12 +0000 (18:39 +0000)]
Stop always creating and running an LTO compilation if there is not a single LTO object

Summary:
I assume there was a use case, so maybe this strawman patch will help
clarifying if it is legit.
In any case the current situation is not legit: a ThinLTO compilation
should not trigger an unexpected full LTO compilation.
Right now, adding a --save-temps option triggers this and makes the
number of output differs.

Reviewers: tejohnson

Subscribers: pcc, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D23600

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

7 years agoRevert "[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled...
Mehdi Amini [Tue, 23 Aug 2016 18:25:59 +0000 (18:25 +0000)]
Revert "[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)"

This reverts commit r279545, test is failing, my Output dir was dirty and making the test pass.

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

7 years agoGlobalISel: legalize 1-bit load/store and mark 8/16 bit variants legal on AArch64.
Tim Northover [Tue, 23 Aug 2016 18:20:09 +0000 (18:20 +0000)]
GlobalISel: legalize 1-bit load/store and mark 8/16 bit variants legal on AArch64.

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

7 years ago[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)
Mehdi Amini [Tue, 23 Aug 2016 18:12:55 +0000 (18:12 +0000)]
[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)

This adds a test for r279532, thanks David Li for noticing :)

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

7 years ago[CMake] [OCaml] Add -DLLVM_ENABLE_OCAMLDOC switch
Peter Zotov [Tue, 23 Aug 2016 18:07:16 +0000 (18:07 +0000)]
[CMake] [OCaml] Add -DLLVM_ENABLE_OCAMLDOC switch

Patch by Michael Gorny.

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

7 years ago[InstSimplify] allow icmp with constant folds for splat vectors, part 2
Sanjay Patel [Tue, 23 Aug 2016 18:00:51 +0000 (18:00 +0000)]
[InstSimplify] allow icmp with constant folds for splat vectors, part 2

Completes the m_APInt changes for simplifyICmpWithConstant().

Other commits in this series:
https://reviews.llvm.org/rL279492
https://reviews.llvm.org/rL279530
https://reviews.llvm.org/rL279534
https://reviews.llvm.org/rL279538

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

7 years agoPossible fix of test failures on win bots
Xinliang David Li [Tue, 23 Aug 2016 18:00:41 +0000 (18:00 +0000)]
Possible fix of test failures on win bots

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

7 years ago[InstSimplify] allow icmp with constant folds for splat vectors, part 1
Sanjay Patel [Tue, 23 Aug 2016 17:30:56 +0000 (17:30 +0000)]
[InstSimplify] allow icmp with constant folds for splat vectors, part 1

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

7 years ago[SelectionDAG] Use a union of bitfield structs for SDNode::SubclassData.
Justin Lebar [Tue, 23 Aug 2016 17:18:11 +0000 (17:18 +0000)]
[SelectionDAG] Use a union of bitfield structs for SDNode::SubclassData.

Summary:
This greatly simplifies our handling of SDNode::SubclassData.

NFC, hopefully.  :)

See discussion in D23035 for discussion about the design API of these
bitfields.

Reviewers: chandlerc

Subscribers: llvm-commits, rnk

Differential Revision: https://reviews.llvm.org/D23036

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

7 years ago[CodeGen] Convert a loop to a for-each loop. NFC
Justin Lebar [Tue, 23 Aug 2016 17:18:07 +0000 (17:18 +0000)]
[CodeGen] Convert a loop to a for-each loop. NFC

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

7 years agoFix some Clang-tidy modernize-use-using and Include What You Use warnings; other...
Eugene Zelenko [Tue, 23 Aug 2016 17:14:32 +0000 (17:14 +0000)]
Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.

Differential revision: https://reviews.llvm.org/D23789

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

7 years ago[InstSimplify] add tests to show missing vector icmp folds
Sanjay Patel [Tue, 23 Aug 2016 17:13:38 +0000 (17:13 +0000)]
[InstSimplify] add tests to show missing vector icmp folds

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

7 years ago[ThinLTO] Make sure the Context used for the ThinLTO backend has all the appropriate...
Mehdi Amini [Tue, 23 Aug 2016 16:53:34 +0000 (16:53 +0000)]
[ThinLTO] Make sure the Context used for the ThinLTO backend has all the appropriate options

An important performance setting on the LLVMContext for LTO is
enableDebugTypeODRUniquing(), this adds an automatic merging of
debug information in the context based on type ids.

Also, the lto::Config includes a diagnostic handler that needs to
be set on the Context, as well as the setDiscardValueNames() setting.

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

7 years ago[InstSimplify] move icmp with constant tests to another file; NFC
Sanjay Patel [Tue, 23 Aug 2016 16:46:53 +0000 (16:46 +0000)]
[InstSimplify] move icmp with constant tests to another file; NFC

...because like the corresponding code, this is just too big to keep adding to.
And the next step is to add a vector version of each of these tests to show
missed folds.

Also, auto-generate CHECK lines and add comments for the tests that correspond to
the source code.

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

7 years agoFix some more asserts after r279466.
Pete Cooper [Tue, 23 Aug 2016 16:23:45 +0000 (16:23 +0000)]
Fix some more asserts after r279466.

That commit added a new version of Intrinsic::getName which should only
be called when the intrinsic has no overloaded types.  There are several
debugging paths, such as SDNode::dump which are printing the name of the
intrinsic but don't have the overloaded types.  These paths should be ok
to just print the name instead of crashing.

The fix here is ultimately to just add a 'None' second argument as that
calls the overload capable getName, which is less efficient, but this is a
debugging path anyway, and not perf critical.

Thanks to Björn Pettersson for pointing out that there were more crashes.

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

7 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2dq & (v)cvttpd2dq intrins...
Simon Pilgrim [Tue, 23 Aug 2016 16:11:21 +0000 (16:11 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2dq & (v)cvttpd2dq intrinsics implicitly zeroes the upper half of the xmm

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

7 years ago[Hexagon] Packetize return value setup with the return instruction
Krzysztof Parzyszek [Tue, 23 Aug 2016 16:01:01 +0000 (16:01 +0000)]
[Hexagon] Packetize return value setup with the return instruction

Commit r279241 unintentionally reverted that ability.

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

7 years agoFix windows build failure
Xinliang David Li [Tue, 23 Aug 2016 16:00:54 +0000 (16:00 +0000)]
Fix windows build failure

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

7 years agoRename unittests/ADT/ilistTest.cpp to ilistTestTemp.cpp (temporarily)
Duncan P. N. Exon Smith [Tue, 23 Aug 2016 15:56:50 +0000 (15:56 +0000)]
Rename unittests/ADT/ilistTest.cpp to ilistTestTemp.cpp (temporarily)

I'll rename this to IListTest.cpp after a waiting period (tonight?
tomorrow?), with a full explanation in that commit.

First, I'm moving it aside because Git doesn't play well with case-only
filename changes on case-insensitive file systems (and I suspect the
same is true of SVN).  This two-stage change should help to avoid
spurious failures on bots that don't do clean checkouts.

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

7 years ago[Profile] refactor meta data copying/swapping code
Xinliang David Li [Tue, 23 Aug 2016 15:39:03 +0000 (15:39 +0000)]
[Profile] refactor meta data copying/swapping code

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

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

7 years agoWork around PR29097 to get the module bots going again.
Adrian Prantl [Tue, 23 Aug 2016 15:38:59 +0000 (15:38 +0000)]
Work around PR29097 to get the module bots going again.
This replaces an =default constructor with an explicit definition.

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

7 years ago[X86][AVX] Updated fptosi_2f64_to_4i32 test to show missed opportunity to implicit...
Simon Pilgrim [Tue, 23 Aug 2016 15:10:39 +0000 (15:10 +0000)]
[X86][AVX] Updated fptosi_2f64_to_4i32 test to show missed opportunity to implicit zero the upper elements

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

7 years ago[X86][AVX] Add v2i32 fp to int conversion tests
Simon Pilgrim [Tue, 23 Aug 2016 15:00:52 +0000 (15:00 +0000)]
[X86][AVX] Add v2i32 fp to int conversion tests

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

7 years ago[X86][AVX] Add AVX2/AVX512 fp to int conversion tests
Simon Pilgrim [Tue, 23 Aug 2016 14:37:35 +0000 (14:37 +0000)]
[X86][AVX] Add AVX2/AVX512 fp to int conversion tests

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

7 years ago[lanai] Use const instead of constexpr
Jacques Pienaar [Tue, 23 Aug 2016 14:36:53 +0000 (14:36 +0000)]
[lanai] Use const instead of constexpr

The windows build bot did not like constexpr.

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

7 years agoFix SystemZ hang caused by r279105
Elliot Colp [Tue, 23 Aug 2016 14:03:02 +0000 (14:03 +0000)]
Fix SystemZ hang caused by r279105

The change in r279105 causes an infinite loop in some cases, as it sets the upper bits of an AND mask constant, which DAGCombiner::SimplifyDemandedBits then unsets.
This patch reverts that part of the behaviour, instead relying on .td peepholes to perform the transformation to NILL. I reapplied my original fix for the problem addressed by r279105 (unsetting the upper bits, which prevents a compiler abort for a different reason).

Differential Revision: https://reviews.llvm.org/D23781

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

7 years ago[LTOCodeGenerator] Reduce code duplication. NFCI.
Davide Italiano [Tue, 23 Aug 2016 12:32:57 +0000 (12:32 +0000)]
[LTOCodeGenerator] Reduce code duplication. NFCI.

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

7 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps intrinsics implicitly...
Simon Pilgrim [Tue, 23 Aug 2016 11:26:28 +0000 (11:26 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps intrinsics implicitly zeroes the upper half of the xmm

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

7 years agoLLVMLanaDesc: Update libdesp.
NAKAMURA Takumi [Tue, 23 Aug 2016 10:47:40 +0000 (10:47 +0000)]
LLVMLanaDesc: Update libdesp.

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

7 years agoChange the target's name, s/LanaiMCTargetDesc/LanaiDesc/g.
NAKAMURA Takumi [Tue, 23 Aug 2016 10:43:01 +0000 (10:43 +0000)]
Change the target's name, s/LanaiMCTargetDesc/LanaiDesc/g.

"AllTargetsDescs" in llvm-mc/CMakeLists.txt expects not ${target}MCTargetDesc, but ${target}Desc.

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

7 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps implicitly zeroes...
Simon Pilgrim [Tue, 23 Aug 2016 10:35:24 +0000 (10:35 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps implicitly zeroes the upper half of the xmm

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

7 years ago[ARM] Generate consistent frame records for Thumb2
Oliver Stannard [Tue, 23 Aug 2016 09:19:22 +0000 (09:19 +0000)]
[ARM] Generate consistent frame records for Thumb2

There is not an official documented ABI for frame pointers in Thumb2,
but we should try to emit something which is useful.

We use r7 as the frame pointer for Thumb code, which currently means
that if a function needs to save a high register (r8-r11), it will get
pushed to the stack between the frame pointer (r7) and link register
(r14). This means that while a stack unwinder can follow the chain of
frame pointers up the stack, it cannot know the offset to lr, so does
not know which functions correspond to the stack frames.

To fix this, we need to push the callee-saved registers in two batches,
with the first push saving the low registers, fp and lr, and the second
push saving the high registers. This is already implemented, but
previously only used for iOS. This patch turns it on for all Thumb2
targets when frame pointers are required by the ABI, and the frame
pointer is r7 (Windows uses r11, so this isn't a problem there). If
frame pointer elimination is enabled we still emit a single push/pop
even if we need a frame pointer for other reasons, to avoid increasing
code size.

We must also ensure that lr is pushed to the stack when using a frame
pointer, so that we end up with a complete frame record. Situations that
could cause this were rare, because we already push lr in most
situations so that we can return using the pop instruction.

Differential Revision: https://reviews.llvm.org/D23516

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

7 years agoGVNHoist: Use the pass version of MemorySSA and preserve it.
Daniel Berlin [Tue, 23 Aug 2016 05:42:41 +0000 (05:42 +0000)]
GVNHoist: Use the pass version of MemorySSA and preserve it.

Summary: GVNHoist: Use the pass version of MemorySSA and preserve it.

Reviewers: sebpop, george.burgess.iv

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23782

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

7 years agoRevert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove MachineFunctionA...
Matthias Braun [Tue, 23 Aug 2016 05:17:11 +0000 (05:17 +0000)]
Revert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses"

Reverting while tracking down a use after free.

This reverts commit r279502.

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

7 years agoCodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses
Matthias Braun [Tue, 23 Aug 2016 03:20:09 +0000 (03:20 +0000)]
CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses

This patch removes the MachineFunctionAnalysis. Instead we keep a
map from IR Function to MachineFunction in the MachineModuleInfo.

This allows the insertion of ModulePasses into the codegen pipeline
without breaking it because the MachineFunctionAnalysis gets dropped
before a module pass.

Peak memory should stay unchanged without a ModulePass in the codegen
pipeline: Previously the MachineFunction was freed at the end of a codegen
function pipeline because the MachineFunctionAnalysis was dropped; With
this patch the MachineFunction is freed after the AsmPrinter has
finished.

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

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

7 years agoBranchRelaxation: Fix handling of blocks with multiple conditional
Matt Arsenault [Tue, 23 Aug 2016 01:30:30 +0000 (01:30 +0000)]
BranchRelaxation: Fix handling of blocks with multiple conditional
branches

Looping over all terminators exposed AArch64 tests hitting
an assert from analyzeBranch failing. I believe these cases
were miscompiled before.

e.g.
  fcmp s0, s1
  b.ne LBB0_1
  b.vc LBB0_2
  b LBB0_2
LBB0_1:
  ; Large block
LBB0_2:
 ; ...

Both of the individual conditional branches need to
be expanded, since neither can reach the final block.

Split the original block into ones which analyzeBranch
will be able to understand.

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

7 years ago[lanai] Make Lanai backend non-experimental
Jacques Pienaar [Tue, 23 Aug 2016 01:06:44 +0000 (01:06 +0000)]
[lanai] Make Lanai backend non-experimental

Summary:
Add Lanai backend to default targets.

Discussion of proposal: http://lists.llvm.org/pipermail/llvm-dev/2016-July/102480.html. ISA added in r279149.

Reviewers: jyknight, rengolin, eliben, chandlerc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22530

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

7 years ago[lanai] Exit early in Mem Alu combiner if sentinel reach.
Jacques Pienaar [Tue, 23 Aug 2016 01:04:41 +0000 (01:04 +0000)]
[lanai] Exit early in Mem Alu combiner if sentinel reach.

LanaiMemAluCombiner could try to query the debug value of a list sentinel. Add check to exit early instead.

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

7 years ago[MemorySSA] Remove unused field. NFC.
George Burgess IV [Mon, 22 Aug 2016 23:40:01 +0000 (23:40 +0000)]
[MemorySSA] Remove unused field. NFC.

Given that we're not currently using blocker info, and whether or not we
will end up using it it is unclear, don't waste 8 (or 4) bytes of memory
per path node.

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

7 years ago[InstSimplify] add helper function for SimplifyICmpInst(); NFCI
Sanjay Patel [Mon, 22 Aug 2016 23:12:02 +0000 (23:12 +0000)]
[InstSimplify] add helper function for SimplifyICmpInst(); NFCI

And add a FIXME because the helper excludes folds for vectors. It's
not clear yet how many of these are actually testable (and therefore
necessary?) because later analysis uses computeKnownBits and other
methods to catch many of these cases.

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

7 years agoFix crash from assert in r279466.
Pete Cooper [Mon, 22 Aug 2016 22:27:05 +0000 (22:27 +0000)]
Fix crash from assert in r279466.

The assert in r279466 checks that we call the correct version of
Intrinsic::getName.  The version which accepts only an ID should not
be used for intrinsics with overloaded types.  The global-isel
code was calling the wrong version.  The test CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
will ensure that we call the correct version from now on.

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

7 years agoADT: Separate some list manipulation API into ilist_base, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 22:21:07 +0000 (22:21 +0000)]
ADT: Separate some list manipulation API into ilist_base, NFC

Separate algorithms in iplist<T> that don't depend on T into ilist_base,
and unit test them.

While I was adding unit tests for these algorithms anyway, I also added
unit tests for ilist_node_base and ilist_sentinel<T>.

To make the algorithms and unit tests easier to write, I also did the
following minor changes as a drive-by:
- encapsulate Prev/Next in ilist_node_base to so that algorithms are
  easier to read, and
- update ilist_node_access API to take nodes by reference.

There should be no real functionality change here.

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

7 years agoFix header comment for unittests/ADT/ilistTest.cpp
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 22:04:16 +0000 (22:04 +0000)]
Fix header comment for unittests/ADT/ilistTest.cpp

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

7 years ago[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.
Tim Shen [Mon, 22 Aug 2016 21:59:26 +0000 (21:59 +0000)]
[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.

Summary: Before the change, *Opt never actually gets updated by the end
of toNext(), so for every next time the loop has to start over from
child_begin(). This bug doesn't affect the correctness, since Visited prevents
it from re-entering the same node again; but it's slow.

Reviewers: dberris, dblaikie, dannyb

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23649

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

7 years ago[InstCombine] change param type from Instruction to BinaryOperator for icmp helpers...
Sanjay Patel [Mon, 22 Aug 2016 21:24:29 +0000 (21:24 +0000)]
[InstCombine] change param type from Instruction to BinaryOperator for icmp helpers; NFCI

This saves some casting in the helper functions and eases some further refactoring.

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

7 years ago[GraphTraits] Replace all NodeType usage with NodeRef
Tim Shen [Mon, 22 Aug 2016 21:09:30 +0000 (21:09 +0000)]
[GraphTraits] Replace all NodeType usage with NodeRef

This should finish the GraphTraits migration.

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

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

7 years agoADT: Remove ilist_*sentinel_traits, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 20:51:00 +0000 (20:51 +0000)]
ADT: Remove ilist_*sentinel_traits, NFC

Remove all the dead code around ilist_*sentinel_traits.  This is a
follow-up to gutting them as part of r279314 (originally r278974),
staged to prevent broken builds in sub-projects.

Uses were removed from clang in r279457 and lld in r279458.

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

7 years ago[InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat constant...
Sanjay Patel [Mon, 22 Aug 2016 20:45:06 +0000 (20:45 +0000)]
[InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat constant vectors

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

7 years agoAdd ADT headers to the cmake headers directory for LLVMSupport. NFC.
Pete Cooper [Mon, 22 Aug 2016 20:38:53 +0000 (20:38 +0000)]
Add ADT headers to the cmake headers directory for LLVMSupport.  NFC.

Xcode and MSVC list the headers and source files for each library.

LLVMSupport lists included the source files for ADT but not the headers.  This
add the ADT headers so that they are browsable by the UI.

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

7 years agoAdd comments and an assert to follow-up on r279113. NFC.
Pete Cooper [Mon, 22 Aug 2016 20:18:28 +0000 (20:18 +0000)]
Add comments and an assert to follow-up on r279113.  NFC.

Philip commented on r279113 to ask for better comments as to
when to use the different versions of getName.  Its also possible
to assert in the simple case that we aren't an overloaded intrinsic
as those have to use the more capable version of getName.

Thanks for the comments Philip.

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

7 years agoIDFCalculator: Remove unused field.
Daniel Berlin [Mon, 22 Aug 2016 19:52:23 +0000 (19:52 +0000)]
IDFCalculator: Remove unused field.

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

7 years agoAMDGPU: Split SILowerControlFlow into two pieces
Matt Arsenault [Mon, 22 Aug 2016 19:33:16 +0000 (19:33 +0000)]
AMDGPU: Split SILowerControlFlow into two pieces

Do most of the lowering in a pre-RA pass. Keep the skip jump
insertion late, plus a few other things that require more
work to move out.

One concern I have is now there may be COPY instructions
which do not have the necessary implicit exec uses
if they will be lowered to v_mov_b32.

This has a positive effect on SGPR usage in shader-db.

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

7 years agoMSSA: Factor out phi node placement
Daniel Berlin [Mon, 22 Aug 2016 19:14:30 +0000 (19:14 +0000)]
MSSA: Factor out phi node placement

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

7 years agoMSSA: Only rename accesses whose defining access is nullptr
Daniel Berlin [Mon, 22 Aug 2016 19:14:16 +0000 (19:14 +0000)]
MSSA: Only rename accesses whose defining access is nullptr

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

7 years ago[SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy [Mon, 22 Aug 2016 19:07:15 +0000 (19:07 +0000)]
[SimplifyCFG] Rewrite SinkThenElseCodeToEnd

[Recommitting now an unrelated assertion in SROA is sorted out]

The new version has several advantages:
  1) IMSHO it's more readable and neater
  2) It handles loads and stores properly
  3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.

With this change we can now finally sink load-modify-store idioms such as:

    if (a)
      return *b += 3;
    else
      return *b += 4;

    =>

    %z = load i32, i32* %y
    %.sink = select i1 %a, i32 5, i32 7
    %b = add i32 %z, %.sink
    store i32 %b, i32* %y
    ret i32 %b

When this works for switches it'll be even more powerful.

Round 4. This time we should handle all instructions correctly, and not replace any operands that need to be constant with variables.

This was really hard to determine safely, so the helper function should be put into the Instruction API. I'll do that as a followup.

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

7 years ago[SROA] Remove incorrect assertion
James Molloy [Mon, 22 Aug 2016 18:49:42 +0000 (18:49 +0000)]
[SROA] Remove incorrect assertion

Confirmed with aprantl, this assertion is incorrect - code can get here (for example 80-bit FP types) and if it does it's benign. This is exposed by a completely unrelated patch of mine, so stop the compiler falling over.

Original differential: http://reviews.llvm.org/D16187
aprantl's advice to remove assertion: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/382129.html

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

7 years ago[SSP] Do not set __guard_local to hidden for OpenBSD SSP
Tim Shen [Mon, 22 Aug 2016 18:26:27 +0000 (18:26 +0000)]
[SSP] Do not set __guard_local to hidden for OpenBSD SSP

__guard_local is defined as long on OpenBSD. If the source file contains
a definition of __guard_local, it mismatches with the int8 pointer type
used in LLVM. In that case, Module::getOrInsertGlobal() returns a
cast operation instead of a GlobalVariable. Trying to set the
visibility on the cast operation leads to random segfaults (seen when
compiling the OpenBSD kernel, which also runs with stack protection).

In the kernel, the hidden attribute does not matter. For userspace code,
__guard_local is defined as hidden in the startup code. If a program
re-defines __guard_local, the definition from the startup code will
either win or the linker complains about multiple definitions
(depending on whether the re-defined __guard_local is placed in the
common segment or not).

It also matches what gcc on OpenBSD does.

Thanks Stefan Kempf <sisnkemp@gmail.com> for the patch!

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

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

7 years ago[InstCombine] Allow sinking from unique predecessor with multiple edges
Jun Bum Lim [Mon, 22 Aug 2016 18:21:56 +0000 (18:21 +0000)]
[InstCombine] Allow sinking from unique predecessor with multiple edges

Summary: We can allow sinking if the single user block has only one unique predecessor, regardless of the number of edges. Note that a switch statement with multiple cases can have the same destination.

Reviewers: mcrosier, majnemer, spatel, reames

Subscribers: reames, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D23722

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

7 years agoRevert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"
James Molloy [Mon, 22 Aug 2016 18:13:12 +0000 (18:13 +0000)]
Revert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"

This reverts commit r279443. It caused buildbot failures.

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

7 years ago[SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy [Mon, 22 Aug 2016 17:40:23 +0000 (17:40 +0000)]
[SimplifyCFG] Rewrite SinkThenElseCodeToEnd

The new version has several advantages:
  1) IMSHO it's more readable and neater
  2) It handles loads and stores properly
  3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.

With this change we can now finally sink load-modify-store idioms such as:

    if (a)
      return *b += 3;
    else
      return *b += 4;

    =>

    %z = load i32, i32* %y
    %.sink = select i1 %a, i32 5, i32 7
    %b = add i32 %z, %.sink
    store i32 %b, i32* %y
    ret i32 %b

When this works for switches it'll be even more powerful.

Round 4. This time we should handle all instructions correctly, and not replace any operands that need to be constant with variables.

This was really hard to determine safely, so the helper function should be put into the Instruction API. I'll do that as a followup.

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

7 years ago[X86][AVX] Don't use SubVectorBroadcast if there are additional users of the chain...
Simon Pilgrim [Mon, 22 Aug 2016 16:47:55 +0000 (16:47 +0000)]
[X86][AVX] Don't use SubVectorBroadcast if there are additional users of the chain (PR29088)

We could improve on this by making X86SubVBroadcast a full memory intrinsic similar to X86vzload

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

7 years agoFix Gold Plugin after API change in the LTO API (constify callback type)
Mehdi Amini [Mon, 22 Aug 2016 16:41:58 +0000 (16:41 +0000)]
Fix Gold Plugin after API change in the LTO API (constify callback type)

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

7 years ago[mips][ias] Support .dtprel[d]word and .tprel[d]word directives
Simon Atanasyan [Mon, 22 Aug 2016 16:18:42 +0000 (16:18 +0000)]
[mips][ias] Support .dtprel[d]word and .tprel[d]word directives

Assembler directives .dtprelword, .dtpreldword, .tprelword, and
.tpreldword generates relocations R_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL64,
R_MIPS_TLS_TPREL32, and R_MIPS_TLS_TPREL64 respectively.

The main motivation for this patch is to be able to write test cases
for checking correctness of the LLD linker's behaviour.

Differential Revision: https://reviews.llvm.org/D23669

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

7 years ago[LTO] Constify the Module Hook function (NFC)
Mehdi Amini [Mon, 22 Aug 2016 16:17:40 +0000 (16:17 +0000)]
[LTO] Constify the Module Hook function (NFC)

It use to be non-const for the sole purpose of custom handling of
commons symbol. This is moved now in the regular LTO handling now
and such we can constify the callback.

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

7 years agoReset isUndef when removing subreg from a def operand
Krzysztof Parzyszek [Mon, 22 Aug 2016 14:50:12 +0000 (14:50 +0000)]
Reset isUndef when removing subreg from a def operand

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