OSDN Git Service

android-x86/external-llvm.git
7 years agoUpdate expected result for or-branch.ll . NFC
Amaury Sechet [Tue, 23 May 2017 05:42:54 +0000 (05:42 +0000)]
Update expected result for or-branch.ll . NFC

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

7 years agoCosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambig...
Galina Kistanova [Tue, 23 May 2017 05:00:10 +0000 (05:00 +0000)]
Cosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else].

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

7 years agoTypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]
NAKAMURA Takumi [Tue, 23 May 2017 04:49:24 +0000 (04:49 +0000)]
TypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]

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

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:20:52 +0000 (01:20 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

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

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:07:19 +0000 (01:07 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

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

7 years agoFIX: Remove debugging assert left in previous commit
David Blaikie [Tue, 23 May 2017 00:31:24 +0000 (00:31 +0000)]
FIX: Remove debugging assert left in previous commit

Sorry for the bot noise.

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

7 years agolibDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs...
David Blaikie [Tue, 23 May 2017 00:30:42 +0000 (00:30 +0000)]
libDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs residing there

NFC, just an optimization. Will be building on this for DWP support
shortly.

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

7 years agoSupport for taking the max of module flags when linking, use for PIE/PIC
Teresa Johnson [Tue, 23 May 2017 00:08:00 +0000 (00:08 +0000)]
Support for taking the max of module flags when linking, use for PIE/PIC

Summary:
Add Max ModFlagBehavior, which can be used to take the max of two
module flag values when merging modules. Use it for the PIE and PIC
levels.

This avoids an error when we try to import from a module built -fpic
into a module built -fPIC, for example. For both PIE and PIC levels,
this will be legal, since the code generation gets more conservative
as the level is increased. Therefore we can take the max instead of
somehow trying to block importing between modules compiled with
different levels.

Reviewers: tmsriram, pcc

Subscribers: llvm-commits

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

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

7 years ago[InstSimplify] Fix the indentation throughout the interface header file.
Craig Topper [Mon, 22 May 2017 23:50:40 +0000 (23:50 +0000)]
[InstSimplify] Fix the indentation throughout the interface header file.

The forward declarations and the SimplifyQuery class at the beginning of the namespace weren't indented. But the closing brace for SimplifyQuery and everything after it were indented.

This commit makes the whole file consistent to no identation per coding standards. The signature of every function in this file changed a few weeks ago so this isn't a big disturbance to the revision history.

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

7 years ago[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.
Davide Italiano [Mon, 22 May 2017 23:47:11 +0000 (23:47 +0000)]
[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.

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

7 years ago[NewPM] Add a temporary cl::opt() to test NewGVN.
Davide Italiano [Mon, 22 May 2017 23:41:40 +0000 (23:41 +0000)]
[NewPM] Add a temporary cl::opt() to test NewGVN.

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

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Mon, 22 May 2017 22:46:31 +0000 (22:46 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

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

7 years ago[CodeGen] Fix uninitialized variables exposed by r303084
Vitaly Buka [Mon, 22 May 2017 21:33:54 +0000 (21:33 +0000)]
[CodeGen] Fix uninitialized variables exposed by r303084

All other calls of analyzeBranch reset PredTBB and PredFBB, so I assume it's
expected behavior.

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

7 years agoInstructionSimplify: don't speculate about Constants changing.
Tim Northover [Mon, 22 May 2017 21:28:08 +0000 (21:28 +0000)]
InstructionSimplify: don't speculate about Constants changing.

When presented with an icmp/select pair, we can end up asking what would happen
if we replaced one constant with another in an instruction. This is a mistake,
while non-constant Values could become a constant, constants cannot change and
trying to do so can lead to completely invalid IR (a GEP referencing a
non-existant field in the original case).

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

7 years agoInfer relocation model from module flags in relocatable LTO link.
Evgeniy Stepanov [Mon, 22 May 2017 21:11:35 +0000 (21:11 +0000)]
Infer relocation model from module flags in relocatable LTO link.

Fix for PR33096.

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

7 years agoImplement various flavors of type merging.
Zachary Turner [Mon, 22 May 2017 21:07:43 +0000 (21:07 +0000)]
Implement various flavors of type merging.

Previous algotirhm assumed that types and ids are in a single
unified stream.  For inputs that come from object files, this
is the case.  But if the input is already a PDB, or is the result
of a previous merge, then the types and ids will already have
been split up, in which case we need an algorithm that can
accept operate on independent streams of types and ids that
refer across stream boundaries to each other.

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

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

7 years agoMake TypeSerializer's StringMap use the same allocator.
Zachary Turner [Mon, 22 May 2017 21:07:14 +0000 (21:07 +0000)]
Make TypeSerializer's StringMap use the same allocator.

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

7 years agoDon't generate line&scope debug info for meta-instructions.
Adrian Prantl [Mon, 22 May 2017 20:47:09 +0000 (20:47 +0000)]
Don't generate line&scope debug info for meta-instructions.

MachineInstructions that don't generate any code (such as
IMPLICIT_DEFs) should not generate any debug info either.

Fixes PR33107.

https://bugs.llvm.org/show_bug.cgi?id=33107

This reapplies r303566 without any modifications. The stage2 build
failures persisted even after reverting this patch, and looking back
through history, it looks like these tests are flaky.

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

7 years agoFix update VP metadata after inlining for instrumentation PGO
Teresa Johnson [Mon, 22 May 2017 20:28:18 +0000 (20:28 +0000)]
Fix update VP metadata after inlining for instrumentation PGO

Summary:
With instrumentation profiling, when updating the VP metadata after
an inline, VP metadata on the inlined copy was inadvertantly having
all counts zeroed out. This was causing indirect calls from code inlined
during the call step to be marked as cold in the ThinLTO summaries and
not imported.

The CallerBFI needs to be passed down so that the CallSiteCount can be
computed from the profile summary info. With Sample PGO this was working
since the count is extracted from the branch weight metadata on the
call being inlined (even before we stopped looking at metadata for
non-sample PGO in r302844 this largely wasn't working for instrumentation
PGO since only promoted indirect calls would be getting inlined and have
the metadata).

Added an instrumentation PGO test and renamed the sample PGO test.

Reviewers: danielcdh, eraman

Subscribers: mehdi_amini, llvm-commits

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

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

7 years ago[Hexagon] Fix definitions of vector predicate loads and stores
Krzysztof Parzyszek [Mon, 22 May 2017 20:02:53 +0000 (20:02 +0000)]
[Hexagon] Fix definitions of vector predicate loads and stores

This fixes http://llvm.org/PR33048.

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

7 years ago[DataLayout] Add llvm_unreachable to the default of a nested switch statement that...
Craig Topper [Mon, 22 May 2017 19:28:36 +0000 (19:28 +0000)]
[DataLayout] Add llvm_unreachable to the default of a nested switch statement that covers all values given to it by the outer switch. NFC

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

7 years agoRevert "Don't generate line&scope debug info for meta-instructions."
Adrian Prantl [Mon, 22 May 2017 18:50:12 +0000 (18:50 +0000)]
Revert "Don't generate line&scope debug info for meta-instructions."

This reverts commit r303566 while investigating a stage2 buildbot failure.

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

7 years ago[AMDGPU] Narrow lshl from 64 to 32 bit if possible
Stanislav Mekhanoshin [Mon, 22 May 2017 16:58:10 +0000 (16:58 +0000)]
[AMDGPU] Narrow lshl from 64 to 32 bit if possible

Turn expensive 64 bit shift into 32 bit if shift does not overflow int:
shl (ext x) => zext (shl x)

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

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

7 years ago[PartialInlining] Add internal options to enable partial inlining in pass pipeline...
Xinliang David Li [Mon, 22 May 2017 16:41:57 +0000 (16:41 +0000)]
[PartialInlining] Add internal options to enable partial inlining in pass pipeline (off by default)

1. Legacy: -mllvm -enable-partial-inlining
2. New:  -mllvm -enable-npm-partial-inlining -fexperimental-new-pass-manager

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

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

7 years agoDon't generate line&scope debug info for meta-instructions.
Adrian Prantl [Mon, 22 May 2017 16:21:02 +0000 (16:21 +0000)]
Don't generate line&scope debug info for meta-instructions.

MachineInstructions that don't generate any code (such as
IMPLICIT_DEFs) should not generate any debug info either.

Fixes PR33107.

https://bugs.llvm.org/show_bug.cgi?id=33107

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

7 years ago[DAG] Rework store merge to loop on load candidates. NFCI.
Nirav Dave [Mon, 22 May 2017 15:33:47 +0000 (15:33 +0000)]
[DAG] Rework store merge to loop on load candidates. NFCI.

Continue to consider remaining candidate merges until all possible
merges have been considered.

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

7 years ago[X86] Remove target feature info from mul-i256.ll test. NFC.
Nirav Dave [Mon, 22 May 2017 15:04:08 +0000 (15:04 +0000)]
[X86] Remove target feature info from mul-i256.ll test. NFC.

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

7 years ago[AMDGPU] Fix incorrect register usage tracking in GCNUpwardTracker
Valery Pykhtin [Mon, 22 May 2017 13:09:40 +0000 (13:09 +0000)]
[AMDGPU] Fix incorrect register usage tracking in GCNUpwardTracker

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

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

7 years ago[mips] Support micromips attribute passed by front-end
Simon Atanasyan [Mon, 22 May 2017 12:47:41 +0000 (12:47 +0000)]
[mips] Support micromips attribute passed by front-end

This patch adds handling of the `micromips` and `nomicromips` attributes
passed by front-end. The patch depends on D33363.

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

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

7 years ago[LoopPredication] NFC. Add extra debug output in case we fail to parse the range...
Artur Pilipenko [Mon, 22 May 2017 12:06:57 +0000 (12:06 +0000)]
[LoopPredication] NFC. Add extra debug output in case we fail to parse the range check

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

7 years ago[LoopPredication] NFC. Move a nested struct declaration before the fields, clang...
Artur Pilipenko [Mon, 22 May 2017 12:01:32 +0000 (12:01 +0000)]
[LoopPredication] NFC. Move a nested struct declaration before the fields, clang-format a bit

This will simplify the diff for an upcoming review.

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

7 years agoRevert r303259 - [globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Mon, 22 May 2017 10:14:33 +0000 (10:14 +0000)]
Revert r303259 - [globalisel][tablegen] Import rules containing intrinsic_wo_chain.

It's causing some buildbots to timeout whenever tablegen needs re-compilation,
particularly those with -fsanitize=memory but not only them. A compile time
regression was expected since it triples the amount of SelectionDAG rules we
are able to import but it's currently too high.

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

7 years agoRe-apply r302416: [ARM] Clear the constant pool cache on explicit .ltorg directives
James Molloy [Mon, 22 May 2017 09:42:07 +0000 (09:42 +0000)]
Re-apply r302416: [ARM] Clear the constant pool cache on explicit .ltorg directives

Re-applying now that PR32825 which was raised on the commit this fixed up is now known to have also been fixed by this commit.

Original commit message:
    Multiple ldr pseudoinstructions with the same constant value will
    reuse the same constant pool entry. However, if the constant pool
    is explicitly flushed with a .ltorg directive, we should not try
    to reference constants in the previous pool any longer, since they
    may be out of range.

    This fixes assembling hand-written assembler source which repeatedly
    loads the same constant value, across a binary size larger than the
    pc-relative fixup range for ldr instructions (4096 bytes). Such
    assembler source already uses explicit .ltorg instructions to emit
    constant pools with regular intervals. However if we try to reuse
    constants emitted in earlier pools, they end up out of range.

    This makes the output of the testcase match what binutils gas does
    (prior to this patch, it would fail to assemble).

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

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

7 years agoRe-apply r286006: Fix 24560: assembler does not share constant pool for same constants
James Molloy [Mon, 22 May 2017 09:42:01 +0000 (09:42 +0000)]
Re-apply r286006: Fix 24560:  assembler does not share constant pool for same constants

Re-applying now that the open bug on this commit, PR32825, is known to be fixed.

Original commit message:
    Summary: This patch returns the same label if the CP entry with the same value has been created.

    Reviewers: eli.friedman, rengolin, jmolloy

    Subscribers: majnemer, jmolloy, llvm-commits

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

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

7 years ago[MIPS] Add support to match more patterns for DINS instruction
Strahinja Petrovic [Mon, 22 May 2017 09:06:44 +0000 (09:06 +0000)]
[MIPS] Add support to match more patterns for DINS instruction

This patch adds support for recognizing patterns to match
DINS instruction.

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

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

7 years agoRevert "[ARM] Clear the constant pool cache on explicit .ltorg directives"
James Molloy [Mon, 22 May 2017 08:49:28 +0000 (08:49 +0000)]
Revert "[ARM] Clear the constant pool cache on explicit .ltorg directives"

This reverts commit r302416. This was a fixup for r286006, which has now been reverted so this doesn't apply (either in concept or in code).

This commit itself has no problems, but the underlying issue it was fixing has now disappeared from the codebase.

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

7 years agoRevert "Fix 24560: assembler does not share constant pool for same constants"
James Molloy [Mon, 22 May 2017 08:42:47 +0000 (08:42 +0000)]
Revert "Fix 24560:  assembler does not share constant pool for same constants"

This reverts commit r286006. It caused PR32825 and wasn't fixed.

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

7 years agoRegenerate expected result for test constant-combines.ll . NFC
Amaury Sechet [Mon, 22 May 2017 07:49:16 +0000 (07:49 +0000)]
Regenerate expected result for test constant-combines.ll . NFC

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

7 years agolibDebugInfo/DWARF: Apply relocations for debug_addr addresses in object files
David Blaikie [Mon, 22 May 2017 07:02:47 +0000 (07:02 +0000)]
libDebugInfo/DWARF: Apply relocations for debug_addr addresses in object files

llvm-symbolizer would fail to symbolize addresses in unlinked object
files when handling .dwo file data because the addresses would not be
relocated in the same way as the ranges in the skeleton CU in the object
file.

Fix that so object files can be symbolized the same as executables.

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

7 years ago[SCEV] Clarify behavior around max backedge taken count
Sanjoy Das [Mon, 22 May 2017 06:46:04 +0000 (06:46 +0000)]
[SCEV] Clarify behavior around max backedge taken count

This is a re-application of a r303497 that was reverted in r303498.
I thought it had broken a bot when it had not (the breakage did not
go away with the revert).

This change makes the split between the "exact" backedge taken count
and the "maximum" backedge taken count a bit more obvious.  Both of
these are upper bounds on the number of times the loop header
executes (since SCEV does not account for most kinds of abnormal
control flow), but the latter is guaranteed to be a constant.

There were a few places where the max backedge taken count *was* a
non-constant; I've changed those to compute constants instead.

At this point, I'm not sure if the constant max backedge count can be
computed by calling `getUnsignedRange(Exact).getUnsignedMax()` without
losing precision.  If it can, we can simplify even further by making
`getMaxBackedgeTakenCount` a thin wrapper around
`getBackedgeTakenCount` and `getUnsignedRange`.

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

7 years ago[X86] Add (ix bitcast(vsetcc)) test cases with illegal types. NFC.
Zvi Rackover [Mon, 22 May 2017 06:39:12 +0000 (06:39 +0000)]
[X86] Add (ix bitcast(vsetcc)) test cases with illegal types. NFC.

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

7 years ago[InstCombine] Cleanup the interface for overflow checks
Craig Topper [Mon, 22 May 2017 06:25:31 +0000 (06:25 +0000)]
[InstCombine] Cleanup the interface for overflow checks

Summary:
Fix naming conventions and const correctness.
This completes the changes made in rL303029.

Patch by Yoav Ben-Shalom.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

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

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

7 years agoAdd a test case for large integer subtraction via subcarry. NFC
Amaury Sechet [Mon, 22 May 2017 06:06:45 +0000 (06:06 +0000)]
Add a test case for large integer subtraction via subcarry. NFC

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

7 years agoAdd test case for subcarry optimization.
Amaury Sechet [Mon, 22 May 2017 02:31:42 +0000 (02:31 +0000)]
Add test case for subcarry optimization.

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

7 years ago[SimplifyCFG] Prevent a few APInt copies on method calls that return const reference...
Craig Topper [Mon, 22 May 2017 00:49:35 +0000 (00:49 +0000)]
[SimplifyCFG] Prevent a few APInt copies on method calls that return const reference. NFCI

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

7 years ago[KnownBits] Use isNegative/isNonNegative to shorten some code. NFC
Craig Topper [Mon, 22 May 2017 00:49:33 +0000 (00:49 +0000)]
[KnownBits] Use isNegative/isNonNegative to shorten some code. NFC

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

7 years agoNewGVN: Fix PR 33116, the memoryphi version of bug 32838.
Daniel Berlin [Sun, 21 May 2017 23:41:58 +0000 (23:41 +0000)]
NewGVN: Fix PR 33116, the memoryphi version of bug 32838.

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

7 years agoNewGVN: Cleanup some repeated code using some templated helpers
Daniel Berlin [Sun, 21 May 2017 23:41:56 +0000 (23:41 +0000)]
NewGVN: Cleanup some repeated code using some templated helpers

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

7 years agoNewGVN: Fix printing of simplified expression
Daniel Berlin [Sun, 21 May 2017 23:41:53 +0000 (23:41 +0000)]
NewGVN: Fix printing of simplified expression

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

7 years agoSmallPtrSetImpl/SmallPtrSet: Add a public value_type and key_type
Daniel Berlin [Sun, 21 May 2017 23:41:51 +0000 (23:41 +0000)]
SmallPtrSetImpl/SmallPtrSet: Add a public value_type and key_type

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

7 years ago[NewGVN] Actually check the NewGVN output.
Davide Italiano [Sun, 21 May 2017 20:55:53 +0000 (20:55 +0000)]
[NewGVN] Actually check the NewGVN output.

Apparently I messed up squashing two consecutive commits.

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

7 years ago[NewGVN] Add a test for non most dominating leader.
Davide Italiano [Sun, 21 May 2017 20:50:16 +0000 (20:50 +0000)]
[NewGVN] Add a test for non most dominating leader.

Taken from PR32845. Dan removed the most dominating leader check
in r303443, but we check this test anyway to make sure things
don't regress.

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

7 years ago[InstCombine] Take in account the size in sext->lshr->trunc patterns.
Davide Italiano [Sun, 21 May 2017 20:30:27 +0000 (20:30 +0000)]
[InstCombine] Take in account the size in sext->lshr->trunc patterns.

Otherwise we end up miscompiling, transforming:

define i8 @tinky() {
  %sext = sext i1 1 to i16
  %hibit = lshr i16 %sext, 15
  %tr = trunc i16 %hibit to i8
  ret i8 %tr
}

into:

  %sext = sext i1 1 to i8
  ret i8 %sext

and the first get folded to ret i8 1, while the second gets folded
to ret i8 -1.

Eventually we should get rid of this transform entirely, but for now,
this at least fixes a know correctness bug.

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

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

7 years ago[InstCombine] add tests for potential (lshr(sext X), C) folds; NFC
Sanjay Patel [Sun, 21 May 2017 15:18:52 +0000 (15:18 +0000)]
[InstCombine] add tests for potential (lshr(sext X), C) folds; NFC

As discussed in:
https://reviews.llvm.org/D33338
...we may be able to remove a wider pattern match by doing these more
basic canonicalizations.

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

7 years ago[GlobalISel][X86] Fix G_TRUNC instruction selection.
Igor Breger [Sun, 21 May 2017 11:13:56 +0000 (11:13 +0000)]
[GlobalISel][X86] Fix G_TRUNC instruction selection.
Updated tests with -verify-machineinstrs flag.
It fixes 3 tests failed with machine verifier enabled and listed
in PR27481

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

7 years agoSummary
Hiroshi Inoue [Sun, 21 May 2017 06:00:05 +0000 (06:00 +0000)]
Summary

PPC backend eliminates compare instructions by using record-form instructions in PPCInstrInfo::optimizeCompareInstr, which is called from peephole optimization pass.
This patch improves this optimization to eliminate more compare instructions in two types of common case.

- comparison against a constant 1 or -1

The record-form instructions set CR bit based on signed comparison against 0. So, the current implementation does not exploit the record-form instruction for comparison against a non-zero constant.
This patch enables record-form optimization for constant of 1 or -1 if possible; it changes the condition "greater than -1" into "greater than or equal to 0" and "less than 1" into "less than or equal to 0".
With this patch, compare can be eliminated in the following code sequence, as an example.

uint64_t a, b;
if ((a | b) & 0x8000000000000000ull) { ... }
else { ... }

- andi for 32-bit comparison on PPC64

Since record-form instructions execute 64-bit signed comparison and so we have limitation in eliminating 32-bit comparison, i.e. with cmplwi, using the record-form. The original implementation already has such checks but andi. is not recognized as an instruction which executes implicit zero extension and hence safe to convert into record-form if used for equality check.

%1 = and i32 %a, 10
%2 = icmp ne i32 %1, 0
br i1 %2, label %foo, label %bar

In this simple example, LLVM generates andi. + cmplwi + beq on PPC64.
This patch make it possible to eliminate the cmplwi for this case.
I added andi. for optimization targets if it is safe to do so.

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

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

7 years ago[Docs] Fix LangRef links referred in GetElementPtr.rst
George Burgess IV [Sun, 21 May 2017 05:31:29 +0000 (05:31 +0000)]
[Docs] Fix LangRef links referred in GetElementPtr.rst

Patch by chenwj!

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

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

7 years agoRevert "[SCEV] Clarify behavior around max backedge taken count"
Sanjoy Das [Sun, 21 May 2017 05:02:12 +0000 (05:02 +0000)]
Revert "[SCEV] Clarify behavior around max backedge taken count"

This reverts commit r303497 since it breaks the msan bootstrap bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/1379/

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

7 years ago[SCEV] Clarify behavior around max backedge taken count
Sanjoy Das [Sun, 21 May 2017 01:47:50 +0000 (01:47 +0000)]
[SCEV] Clarify behavior around max backedge taken count

This change makes the split between the "exact" backedge taken count
and the "maximum" backedge taken count a bit more obvious.  Both of
these are upper bounds on the number of times the loop header
executes (since SCEV does not account for most kinds of abnormal
control flow), but the latter is guaranteed to be a constant.

There were a few places where the max backedge taken count *was* a
non-constant; I've changed those to compute constants instead.

At this point, I'm not sure if the constant max backedge count can be
computed by calling `getUnsignedRange(Exact).getUnsignedMax()` without
losing precision.  If it can, we can simplify even further by making
`getMaxBackedgeTakenCount` a thin wrapper around
`getBackedgeTakenCount` and `getUnsignedRange`.

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

7 years agoRevert "Add pthread_self function prototype and make it speculatable."
Xin Tong [Sun, 21 May 2017 00:37:55 +0000 (00:37 +0000)]
Revert "Add pthread_self function prototype and make it speculatable."

This reverts commit 143d7445b5dfa2f6d6c45bdbe0433d9fc531be21.

Build breaking

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

7 years agoAdd pthread_self function prototype and make it speculatable.
Xin Tong [Sat, 20 May 2017 22:40:25 +0000 (22:40 +0000)]
Add pthread_self function prototype and make it speculatable.

Summary: This allows pthread_self to be pulled out of a loop by LICM.

Reviewers: hfinkel, arsenm, davide

Reviewed By: davide

Subscribers: davide, wdng, llvm-commits

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

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

7 years agoCOFF: Fix another StringRef return error
Martell Malone [Sat, 20 May 2017 21:54:15 +0000 (21:54 +0000)]
COFF: Fix another StringRef return error

This should appease the lld build bot regression
Following up on rL303493

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

7 years agoCOFF: Fix single StringRef return error
Martell Malone [Sat, 20 May 2017 21:00:36 +0000 (21:00 +0000)]
COFF: Fix single StringRef return error

This should appease the lld build bot regression
Intrroduced by rL303490

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

7 years agoCOFF: migrate def parser from LLD to LLVM [1/2]
Martell Malone [Sat, 20 May 2017 19:56:29 +0000 (19:56 +0000)]
COFF: migrate def parser from LLD to LLVM [1/2]

This is split up into two commits.
The will create the DEF parser in LLVM.
Check the following commit to see the removal from LLD

Reviewers: ruiu

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

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

7 years agoFix test typo. NFC
Xin Tong [Sat, 20 May 2017 19:40:24 +0000 (19:40 +0000)]
Fix test typo. NFC

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

7 years agoDocs: Fix pluralization in CMake docs
Duncan P. N. Exon Smith [Sat, 20 May 2017 05:25:19 +0000 (05:25 +0000)]
Docs: Fix pluralization in CMake docs

Fixed "most platform" to read "most platforms", and changed "are not
using the same" to "use different" as a drive-by.

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

7 years ago[docs] Small style nits.
George Burgess IV [Sat, 20 May 2017 04:52:29 +0000 (04:52 +0000)]
[docs] Small style nits.

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

7 years agoFix -Wunneeded-internal-declaration by removing constant arrays only used in sizeof...
David Blaikie [Sat, 20 May 2017 03:32:51 +0000 (03:32 +0000)]
Fix -Wunneeded-internal-declaration by removing constant arrays only used in sizeof expressions, in favor of constants containing the size directly

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

7 years agollvm-symbolizer: Support multiple CUs in a single DWO file
David Blaikie [Sat, 20 May 2017 03:32:49 +0000 (03:32 +0000)]
llvm-symbolizer: Support multiple CUs in a single DWO file

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

7 years agoAdd functionality to cvtres to parse all entries in res file.
Eric Beckmann [Sat, 20 May 2017 01:49:19 +0000 (01:49 +0000)]
Add functionality to cvtres to parse all entries in res file.

Summary: Added the new modules in the Object/ folder.  Updated the
llvm-cvtres interface as well, and added additional tests.

Subscribers: llvm-commits, mgorny

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

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

7 years agoFix breakage after r303461
Matthias Braun [Sat, 20 May 2017 01:28:52 +0000 (01:28 +0000)]
Fix breakage after r303461

- Improve wchar_t size predicitions based on target triple.
- Be less strict in wchar_t size verifier.

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

7 years ago[NewGVN] Create a StoreExpression instead of a VariableExpression.
Davide Italiano [Sat, 20 May 2017 00:46:54 +0000 (00:46 +0000)]
[NewGVN] Create a StoreExpression instead of a VariableExpression.

In the case where we have an operand defined by a lod of the
same memory location. Historically this was a VariableExpression
because we wanted to make sure they ended up in the same class,
but if we create the right expression, they end up in the same
class anyway.

Fixes PR32897. Thanks to Dan for the detailed discussion and the
fix suggestion.

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

7 years ago[NewGVN] Get rid of an assertion.
Davide Italiano [Sat, 20 May 2017 00:24:04 +0000 (00:24 +0000)]
[NewGVN] Get rid of an assertion.

This was here because we don't want to switch leaders too much,
in order to avoid fixpoint(ing) issue, but it's not sure if it
matters in practice.

A first step towards fixing PR32897.

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

7 years agoCosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambig...
Galina Kistanova [Sat, 20 May 2017 00:02:08 +0000 (00:02 +0000)]
Cosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else].

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

7 years agoRevert "Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.""
Adrian Prantl [Sat, 20 May 2017 00:00:08 +0000 (00:00 +0000)]
Revert "Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.""

This reapplies commit r303438 modified to not verify cross-imported
bitcode in FunctionImporter.

rdar://problem/31233625

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

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

7 years agoRevert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."
Adrian Prantl [Fri, 19 May 2017 23:32:21 +0000 (23:32 +0000)]
Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."

This reverts commit r303438 while deliberating buildbot breakage.

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

7 years agoSimplifyLibCalls: Optimize wcslen
Matthias Braun [Fri, 19 May 2017 22:37:09 +0000 (22:37 +0000)]
SimplifyLibCalls: Optimize wcslen

Refactor the strlen optimization code to work for both strlen and wcslen.

This especially helps with programs in the wild where people pass
L"string"s to const std::wstring& function parameters and the wstring
constructor gets inlined.

This also fixes a lingerind API problem/bug in getConstantStringInfo()
where zeroinitializers would always give you an empty string (without a
length) back regardless of the actual length of the initializer which
did not work well in the TrimAtNul==false causing the PR mentioned
below.

Note that the fixed getConstantStringInfo() needed fixes to SelectionDAG
memcpy lowering and may lead to some cases for out-of-bounds
zeroinitializer accesses not getting optimized anymore. So some code
with UB may produce out of bound memory reads now instead of just
producing zeros.

The refactoring "accidentally" fixes http://llvm.org/PR32124

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

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

7 years agoVerifier: Check wchar_size module flag.
Matthias Braun [Fri, 19 May 2017 22:37:01 +0000 (22:37 +0000)]
Verifier: Check wchar_size module flag.

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

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

7 years agoFix off-by-one bug in AttributeList::addAttributes index handling
Reid Kleckner [Fri, 19 May 2017 22:23:47 +0000 (22:23 +0000)]
Fix off-by-one bug in AttributeList::addAttributes index handling

getParamAlignment expects an argument number, not an AttributeList
index.

Johan Englan, who works on LDC, found this bug and told me about it off
list.

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

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Fri, 19 May 2017 21:08:28 +0000 (21:08 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

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

7 years ago[safestack] Disable stack coloring by default.
Evgeniy Stepanov [Fri, 19 May 2017 20:58:48 +0000 (20:58 +0000)]
[safestack] Disable stack coloring by default.

Workaround for apparent miscompilation of PR32143.

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

7 years agoAdded missing break.
Galina Kistanova [Fri, 19 May 2017 20:31:51 +0000 (20:31 +0000)]
Added missing break.

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

7 years agoNewGVN: Fix PR32838.
Daniel Berlin [Fri, 19 May 2017 20:22:20 +0000 (20:22 +0000)]
NewGVN: Fix PR32838.
This is a complicated bug involving two issues:
1. What do we do with phi nodes when we prove all arguments are not
live?
2. When is it safe to use value leaders to determine if we can ignore
an argumnet?

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

7 years agoNewGVN: Print out the StoredValue of a StoreExpression
Daniel Berlin [Fri, 19 May 2017 20:22:14 +0000 (20:22 +0000)]
NewGVN: Print out the StoredValue of a StoreExpression

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

7 years agoFix line-endings.
Simon Pilgrim [Fri, 19 May 2017 19:47:29 +0000 (19:47 +0000)]
Fix line-endings.

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

7 years ago[InstCombine] *Actually* commit the test showing the miscompile.
Davide Italiano [Fri, 19 May 2017 19:41:11 +0000 (19:41 +0000)]
[InstCombine] *Actually* commit the test showing the miscompile.

Clarify a comment while I'm here.

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

7 years agoResubmit "[CodeView] Provide a common interface for type collections."
Zachary Turner [Fri, 19 May 2017 19:26:58 +0000 (19:26 +0000)]
Resubmit "[CodeView] Provide a common interface for type collections."

This was originally reverted because it was a breaking a bunch
of bots and the breakage was not surfacing on Windows.  After much
head-scratching this was ultimately traced back to a bug in the
lit test runner related to its pipe handling.  Now that the bug
in lit is fixed, Windows correctly reports these test failures,
and as such I have finally (hopefully) fixed all of them in this
patch.

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

7 years ago[InstCombine] Add tests to demonstrate the miscompile in PR33078.
Davide Italiano [Fri, 19 May 2017 19:23:24 +0000 (19:23 +0000)]
[InstCombine] Add tests to demonstrate the miscompile in PR33078.

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

7 years agoLast of the major pieces to NewGVN - yay!
Daniel Berlin [Fri, 19 May 2017 19:01:27 +0000 (19:01 +0000)]
Last of the major pieces to NewGVN - yay!

Summary:
NewGVN: Handle equivalence between phi of ops and op of phis.

This makes our GVN mostly-complete. It would be complete, modulo some
deliberate choices we make.  This means it detects roughly all herband
equivalences in polynomial time, including cases notoriously hard for
other GVN's to detect.  It also detects a very large swath of the
cases we currently rely on instcombine to detect that involve folding
upwards through phis.

Fixes PR 31125, 31463, PR 31868

Reviewers: davide

Subscribers: Prazek, llvm-commits

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

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

7 years agoNewGVN: Get rid of most dominating leader check
Daniel Berlin [Fri, 19 May 2017 19:01:24 +0000 (19:01 +0000)]
NewGVN: Get rid of most dominating leader check

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

7 years agoBasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly...
Daniel Berlin [Fri, 19 May 2017 19:01:21 +0000 (19:01 +0000)]
BasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly allows for this case, but getParent crashes when handed one.

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

7 years ago[DAGCombine] (addcarry 0, 0, X) -> (ext/trunc X)
Amaury Sechet [Fri, 19 May 2017 18:20:44 +0000 (18:20 +0000)]
[DAGCombine] (addcarry 0, 0, X) -> (ext/trunc X)

Summary:
While this makes some case better and some case worse - so it's unclear if it is a worthy combine just by itself - this is a useful canonicalisation.

As per discussion in D32756 .

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

7 years ago[lit] Take the last error when executing pipelines.
Zachary Turner [Fri, 19 May 2017 18:12:07 +0000 (18:12 +0000)]
[lit] Take the last error when executing pipelines.

This seems to have been present since the beginning of time,
which is quite surprising.  The symptom was this: Suppose you
have a test with a run line that looks like this:

  RUN: foo | FileCheck %s

foo prints some output and then due to a bug in the program it
asserts.  On Windows this results in the program returning a
negative exit code.  But if enough output had been printed
already by the tool so that the FileCheck match would succeed
then FileCheck would return 0, and because of bad logic in
lit this 0 return value would overwrite the failed return
value from previous items in the pipeline.  This only happened
with negative exit codes.

The most sensible behavior is to just take whatever the first
exit code is.  There is no logical ordering defined on exit
codes, so comparing with < and > does not make a lot of sense.
Instead, as soon as we find the first non-successful return
value, that should be the result of the entire expression.

This fixes the issue, as now tests which fail on non-Windows
platforms also fail for me on Windows as well.

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

7 years ago[NFC][loopIdiom] Clang format change rL303434
Anna Thomas [Fri, 19 May 2017 18:00:30 +0000 (18:00 +0000)]
[NFC][loopIdiom] Clang format change rL303434

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

7 years agoThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.
Adrian Prantl [Fri, 19 May 2017 17:55:02 +0000 (17:55 +0000)]
ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.

rdar://problem/31233625

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

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

7 years agoRewrite llvm-lto's codegen() using ThinCodeGenerator::run(). NFC-ish.
Adrian Prantl [Fri, 19 May 2017 17:54:58 +0000 (17:54 +0000)]
Rewrite llvm-lto's codegen() using ThinCodeGenerator::run(). NFC-ish.

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

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

7 years agoFix typo in test
Matthias Braun [Fri, 19 May 2017 17:25:20 +0000 (17:25 +0000)]
Fix typo in test

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

7 years ago[X86][FMA] Tests showing missed fmsubadd opportunities (PR30633)
Simon Pilgrim [Fri, 19 May 2017 17:19:26 +0000 (17:19 +0000)]
[X86][FMA] Tests showing missed fmsubadd opportunities (PR30633)

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

7 years ago[LoopIdiom] Refactor return value of isLegalStore [NFC]
Anna Thomas [Fri, 19 May 2017 17:05:36 +0000 (17:05 +0000)]
[LoopIdiom] Refactor return value of isLegalStore [NFC]

Summary:

This NFC simply refactors the return value of LoopIdiomRecognize::isLegalStore() from bool to an enumeration, and
removes the return-through-parameter mechanism that the function was using. This function is constructed such that it will
only ever recognize a single store idiom (memset, memset_pattern, or memcpy), and never a combination of these. As such it
makes much more sense for the return value to be the single idiom that the store matches, rather than
having a separate argument-return for each idiom -- it's cleaner, and makes it clearer that
only a single idiom can be matched.

Patch by Daniel Neilson!

Reviewers: anna, sanjoy, davide, haicheng

Reviewed By: anna, haicheng

Subscribers: haicheng, mzolotukhin, llvm-commits

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

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

7 years ago[InstSimplify] Fix 80 column violation. NFC
Craig Topper [Fri, 19 May 2017 16:56:53 +0000 (16:56 +0000)]
[InstSimplify] Fix 80 column violation. NFC

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