platform/upstream/llvm.git
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.

llvm-svn: 303558

7 years agoclang-format: [JS] avoid line breaks before unindented r_parens.
Martin Probst [Mon, 22 May 2017 14:58:26 +0000 (14:58 +0000)]
clang-format: [JS] avoid line breaks before unindented r_parens.

The change that enabled wrapping at the previous scope's indentation had
unintended side-effects in that clang-format would prefer to wrap
closing parentheses to the next line if it avoided a wrap on the next
line (assuming very narrow lines):

    fooObject
        .someCall(barbazbam)
        .then(bam);

Would get formatted as:

    fooObject.someCall(barbazbam
    ).then(bam);

Because the ')' is now indented at the parent level (fooObject).

Normally formatting a builder pattern style call sequence like that is
outlawed in clang-format anyway. However for JavaScript this is special
cased to support trailing .bind calls.

This change disallows this special case when following a closing ')' to
avoid the problem.

Included are some random comment fixes.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 303557

7 years agoclang-format: do not reflow bullet lists
Francois Ferrand [Mon, 22 May 2017 14:47:17 +0000 (14:47 +0000)]
clang-format: do not reflow bullet lists

Summary:
This patch prevents reflowing bullet lists in block comments.

It handles all lists supported by doxygen and markdown, e.g. bullet
lists starting with '-', '*', '+', as well as numbered lists starting
with -# or a number followed by a dot.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: djasper, klimek, cfe-commits

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

llvm-svn: 303556

7 years ago[index] 'using namespace' declarations in functions should record
Alex Lorenz [Mon, 22 May 2017 14:39:39 +0000 (14:39 +0000)]
[index] 'using namespace' declarations in functions should record
the reference to the namespace

rdar://32323190

llvm-svn: 303555

7 years ago[clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)
Alexander Kornienko [Mon, 22 May 2017 14:30:14 +0000 (14:30 +0000)]
[clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)

llvm-svn: 303554

7 years agoFix incorrect Status -> Error rename in IOHandler
Pavel Labath [Mon, 22 May 2017 14:13:38 +0000 (14:13 +0000)]
Fix incorrect Status -> Error rename in IOHandler

Change 302872 was a massive rename of the Error class to Status.

The change included an incorrect rename of the "Status" window
in the LLDB GUI from "Status to "Error". This patch undoes this incorrect
rename and restores the status window's correct name.

Differential Revision: https://reviews.llvm.org/D33241
Patch by Brian Gianforcaro.

llvm-svn: 303553

7 years ago[clang-tidy] readability-redundant-declaration false positive for defaulted function
Alexander Kornienko [Mon, 22 May 2017 13:58:57 +0000 (13:58 +0000)]
[clang-tidy] readability-redundant-declaration false positive for defaulted function

Summary:
```
template <class T>
struct C {
  C();
};

template <class T>
C<T>::C() = default;
```

Causes a readability-redundant-declaration diagnostic. This is caused by `isDefinition` not matching defaulted functions.

Reviewers: alexfh, danielmarjamaki

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Patch by Florian Gross!
Differential Revision: https://reviews.llvm.org/D33358

llvm-svn: 303552

7 years ago[clang-tidy] readability-braces-around-statements false positive with char literals
Alexander Kornienko [Mon, 22 May 2017 13:58:16 +0000 (13:58 +0000)]
[clang-tidy] readability-braces-around-statements false positive with char literals

Summary:
Single-line if statements cause a false positive when the last token in the conditional statement is a char constant:

```
if (condition)
  return 'a';
```

For some reason `findEndLocation` seems to skips too many (vertical) whitespaces in this case. The same problem already occured with string literals (https://reviews.llvm.org/D25558), and was fixed by adding a special check for this very case. I just extended the condition to also include char constants. No idea what really causes the issue though.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Patch by Florian Gross!
Differential Revision: https://reviews.llvm.org/D33354

llvm-svn: 303551

7 years ago[Docs] Use ReadTheDocs theme if available.
Siddharth Bhat [Mon, 22 May 2017 13:36:15 +0000 (13:36 +0000)]
[Docs] Use ReadTheDocs theme if available.

Use ReadTheDocs theme for Sphinx if available since it is well
maintained and used by readthedocs.org.

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

llvm-svn: 303550

7 years ago[Docs] Fix Sphinx documentation in CMake check.
Siddharth Bhat [Mon, 22 May 2017 13:16:02 +0000 (13:16 +0000)]
[Docs] Fix Sphinx documentation in CMake check.

Summary:
- `include(AddSphinxTarget)` needs to occur before checking `SPHINX_FOUND`.
- `docs-polly-html` and `docs-polly-man` are now usable again.
- Perhaps we should build docs in the CI as well?

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

llvm-svn: 303549

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

llvm-svn: 303548

7 years ago[clangd] Switch to incomplete translation units
Krasimir Georgiev [Mon, 22 May 2017 12:49:08 +0000 (12:49 +0000)]
[clangd] Switch to incomplete translation units

Summary: This speeds up code completion. All the cool kids (ycmd) are doing it.

Reviewers: bkramer, ilya-biryukov

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 303547

7 years ago[mips] Support `micromips` attribute
Simon Atanasyan [Mon, 22 May 2017 12:47:43 +0000 (12:47 +0000)]
[mips] Support `micromips` attribute

This patch adds support for the `micromips` and `nomicromips` attributes
for MIPS targets.

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

llvm-svn: 303546

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

llvm-svn: 303545

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

llvm-svn: 303544

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.

llvm-svn: 303543

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.

llvm-svn: 303542

7 years ago[clang-format] Keep trailing preprocessor line comments separate from the following...
Krasimir Georgiev [Mon, 22 May 2017 10:07:56 +0000 (10:07 +0000)]
[clang-format] Keep trailing preprocessor line comments separate from the following section comments

Summary:
r303415 changed the way a sequence of line comments following a preprocessor
macro is handled, which has the unfortunate effect of aligning a trailing
preprocessor line comment and following unrelated section comments, so:
```
#ifdef A // comment about A
// section comment
#endif
```
gets turned into:
```
#ifdef A // comment about A
         // section comment
#endif
```
This patch fixes this by additionally checking the original start columns of
the line comments.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 303541

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

llvm-svn: 303540

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

llvm-svn: 303539

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

llvm-svn: 303537

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.

llvm-svn: 303536

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.

llvm-svn: 303535

7 years agoclang-format: Allow customizing the penalty for breaking assignment
Francois Ferrand [Mon, 22 May 2017 08:28:17 +0000 (08:28 +0000)]
clang-format: Allow customizing the penalty for breaking assignment

Summary:
Add option to customize the penalty for breaking assignment

This allows increasing the priority of the assignment, to prefer spliting
an operation instead of splitting the assignment, e.g. :

  int a = bbbbbbbbbbbbbbbb +
          cccccccccccccccc;

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303534

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

llvm-svn: 303533

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.

llvm-svn: 303532

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`.

llvm-svn: 303531

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.

llvm-svn: 303530

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

llvm-svn: 303529

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

llvm-svn: 303528

7 years agoRevert r303304: Re-submit r303225: Garbage collect dllimported symbols.
Rui Ueyama [Mon, 22 May 2017 06:01:37 +0000 (06:01 +0000)]
Revert r303304: Re-submit r303225: Garbage collect dllimported symbols.

This reverts commit r303304 because it looks like the change
introduced a crash bug. At least after that change, LLD with thinlto
crashes when linking Chromium.

llvm-svn: 303527

7 years ago[XRay][compiler-rt] Add __xray_remove_customevent_handler(...)
Dean Michael Berris [Mon, 22 May 2017 03:23:54 +0000 (03:23 +0000)]
[XRay][compiler-rt] Add __xray_remove_customevent_handler(...)

This change adds __xray_remove_customevent_handler(...) to be consistent
with other APIs that add/remove handlers.

llvm-svn: 303526

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.

llvm-svn: 303525

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

llvm-svn: 303523

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

llvm-svn: 303522

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.

llvm-svn: 303521

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

llvm-svn: 303520

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

llvm-svn: 303519

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

llvm-svn: 303518

7 years ago[CodeGen] Support partial write accesses.
Michael Kruse [Sun, 21 May 2017 22:46:57 +0000 (22:46 +0000)]
[CodeGen] Support partial write accesses.

Allow the BlockGenerator to generate memory writes that are not defined
over the complete statement domain, but only over a subset of it. It
generates a condition that evaluates to 1 if executing the subdomain,
and only then execute the access.

Only write accesses are supported. Read accesses would require a PHINode
which has a value if the access is not executed.

Partial write makes DeLICM able to apply mappings that are not defined
over the entire domain (for instance, a branch that leaves a loop with
a PHINode in its header; a MemoryKind::PHI write when leaving is never
read by its PHI read).

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

llvm-svn: 303517

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.

llvm-svn: 303516

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.

llvm-svn: 303515

7 years ago[ScopInfo] Translate updateDimensionality to isl C++ [NFC]
Tobias Grosser [Sun, 21 May 2017 20:38:33 +0000 (20:38 +0000)]
[ScopInfo] Translate updateDimensionality to isl C++ [NFC]

llvm-svn: 303514

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

llvm-svn: 303513

7 years ago[isl++] add isl_constraint to C++ bindings [NFC]
Tobias Grosser [Sun, 21 May 2017 20:23:26 +0000 (20:23 +0000)]
[isl++] add isl_constraint to C++ bindings [NFC]

llvm-svn: 303512

7 years ago[ScopInfo] Translate wrapConstantDimensions to isl C++ [NFC]
Tobias Grosser [Sun, 21 May 2017 20:23:23 +0000 (20:23 +0000)]
[ScopInfo] Translate wrapConstantDimensions to isl C++ [NFC]

llvm-svn: 303511

7 years ago[ScopInfo] Translate addRangeBoundsToSet to isl C++ [NFC]
Tobias Grosser [Sun, 21 May 2017 20:23:20 +0000 (20:23 +0000)]
[ScopInfo] Translate addRangeBoundsToSet to isl C++ [NFC]

llvm-svn: 303510

7 years agoFix include order to stop clang-format complains
Tobias Grosser [Sun, 21 May 2017 16:34:09 +0000 (16:34 +0000)]
Fix include order to stop clang-format complains

llvm-svn: 303509

7 years ago[ScheduleOptimizer] Move schedule construction to isl C++ [NFC]
Tobias Grosser [Sun, 21 May 2017 16:21:33 +0000 (16:21 +0000)]
[ScheduleOptimizer] Move schedule construction to isl C++ [NFC]

llvm-svn: 303508

7 years ago[Simplify] Move to isl C++
Tobias Grosser [Sun, 21 May 2017 16:12:21 +0000 (16:12 +0000)]
[Simplify] Move to isl C++

llvm-svn: 303507

7 years ago[isl++] Export (almost) all functions from isl
Tobias Grosser [Sun, 21 May 2017 16:00:32 +0000 (16:00 +0000)]
[isl++] Export (almost) all functions from isl

This commit exports the majority of the isl functions to the isl C++ interface.

The official isl C++ bindings still require discussions to define the set of
functions that are officially supported. As a result, the officially exported
functionality will be rather limited until these discussions conclude and a
non-trivial set of isl functions is officially supported through the isl C++
bindings. Starting from this commit we ship with Polly an extended version of
the official isl C++ bindings to ensure sufficient functionality is available
such that LLVM developers can make efficient use of isl through C++. The
practical experience Polly gathers with its bindings will then be used to
gradually upstream patches to isl to extend the official bindings.

llvm-svn: 303506

7 years ago[isl++] Rebase isl C++ bindings on top of 29aee98ce
Tobias Grosser [Sun, 21 May 2017 15:59:15 +0000 (15:59 +0000)]
[isl++] Rebase isl C++ bindings on top of 29aee98ce

This reduces the diff to the official isl C++ bindings and solves a correctness
issue with isl::booleans, where isl_bool_error results were accidentally
converted to isl::boolean::true.

llvm-svn: 303505

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.

llvm-svn: 303504

7 years ago[isl++] Move isl raw_ostream printers into separate header
Tobias Grosser [Sun, 21 May 2017 13:16:05 +0000 (13:16 +0000)]
[isl++] Move isl raw_ostream printers into separate header

Instead of relying on these functions to be part of the isl C++ bindings, we
just define this functionality independently. This allows us to use isl C++
bindings that do not contain LLVM specific functionality.

llvm-svn: 303503

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

llvm-svn: 303502

7 years ago[Format] Add curly braces to suppress a -Wmisleading-indentation warning from gcc.
Craig Topper [Sun, 21 May 2017 07:29:07 +0000 (07:29 +0000)]
[Format] Add curly braces to suppress a -Wmisleading-indentation warning from gcc.

llvm-svn: 303501

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

llvm-svn: 303500

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

llvm-svn: 303499

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/

llvm-svn: 303498

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`.

llvm-svn: 303497

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

llvm-svn: 303496

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

llvm-svn: 303495

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

llvm-svn: 303494

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

llvm-svn: 303493

7 years agoFix PR25627: constant expressions being odr-used in template arguments.
Faisal Vali [Sat, 20 May 2017 19:58:04 +0000 (19:58 +0000)]
Fix PR25627: constant expressions being odr-used in template arguments.

This patch ensures that clang processes the expression-nodes that are generated when disambiguating between types and expressions within template arguments as constant-expressions by installing the ConstantEvaluated ExpressionEvaluationContext just before attempting the disambiguation - and then making sure that Context carries through into ParseConstantExpression (by refactoring it out into a function that does not create its own EvaluationContext: ParseConstantExpressionInExprEvalContext)

Note, prior to this patch, trunk would correctly disambiguate and identify the expression as an expression - and while it would annotate the token with the expression - it would fail to complete the odr-use processing (specifically, failing to trigger Sema::UpdateMarkingForLValueToRValue as is done for all Constant Expressions, which would remove it from being considered odr-used).  By installing the ConstantExpression Evaluation Context prior to disambiguation, and making sure it carries though, we ensure correct processing of the expression-node.

For e.g:
  template<int> struct X { };
  void f() {
    const int N = 10;
    X<N> x; // should be OK.
    [] { return X<N>{}; }; // Should be OK - no capture - but clang errors!
  }

See a related bug: https://bugs.llvm.org//show_bug.cgi?id=25627

In summary (and reiteration), the fix is as follows:

    - Remove the EnteredConstantEvaluatedContext action from ParseTemplateArgumentList (relying on ParseTemplateArgument getting it right)
    - Add the EnteredConstantEvaluatedContext action just prior to undergoing the disambiguating parse, and if the parse succeeds for an expression, carry the context though into a refactored version of ParseConstantExpression that does not create its own ExpressionEvaluationContext.

See https://reviews.llvm.org/D31588 for additional context regarding some of the more fragile and complicated approaches attempted, and Richard's feedback that eventually shaped the simpler and more robust rendition that is being committed.

Thanks Richard!

llvm-svn: 303492

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

This is split up into two commits.
This commit removes the DEF parser from LLD
See the previous commit for the creation in LLVM.

Reviewers: ruiu

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

llvm-svn: 303491

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

llvm-svn: 303490

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

llvm-svn: 303489

7 years ago[Devirtualization] insert placement new barrier with -O0
Piotr Padlewski [Sat, 20 May 2017 08:56:18 +0000 (08:56 +0000)]
[Devirtualization] insert placement new barrier with -O0

Summary:
To not break LTO with different optimizations levels, we should insert
the barrier regardles of optimization level.

Reviewers: rjmccall, rsmith, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 303488

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.

llvm-svn: 303487

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.

llvm-svn: 303486

7 years agoFix buildbots after r303429
Tobias Grosser [Sat, 20 May 2017 04:22:26 +0000 (04:22 +0000)]
Fix buildbots after r303429

A test case with a GPU runline was added without setting 'REQUIRES=pollyacc'. We
drop the GPU run line, as the basic functionality can already be tested with
the normal code generation.

llvm-svn: 303485

7 years ago[index] Fix forward declarations interfering with USR generation of external source...
Argyrios Kyrtzidis [Sat, 20 May 2017 04:11:33 +0000 (04:11 +0000)]
[index] Fix forward declarations interfering with USR generation of external source symbols

Patch by Nathan Hawes.
https://reviews.llvm.org/D33346

llvm-svn: 303484

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

llvm-svn: 303483

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

llvm-svn: 303482

7 years agoRevert "[compiler-rt] Change default of allow_user_segv_handler to true"
Vitaly Buka [Sat, 20 May 2017 02:09:25 +0000 (02:09 +0000)]
Revert "[compiler-rt] Change default of allow_user_segv_handler to true"

Failed libFuzzer tests on Windows.

This reverts commit r303476.

llvm-svn: 303481

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

llvm-svn: 303480

7 years agoRename RAII objects for performing eager instantiation to have names that
Richard Smith [Sat, 20 May 2017 01:36:41 +0000 (01:36 +0000)]
Rename RAII objects for performing eager instantiation to have names that
describe what they're for, not how they do it, and factor out a bit more
common code into them.

llvm-svn: 303479

7 years agoCodeGenModule: Always output wchar_size, check LLVM assumptions.
Matthias Braun [Sat, 20 May 2017 01:29:55 +0000 (01:29 +0000)]
CodeGenModule: Always output wchar_size, check LLVM assumptions.

Re-commit r303463 now that LLVM is fixed and adjust some lit tests.

llvm::TargetLibraryInfo needs to know the size of wchar_t to work on
functions like `wcslen`. This patch changes clang to always emit the
wchar_size module flag (it would only do so for ARM previously).
This also adds an `assert()` to ensure the LLVM defaults based on the
target triple are in sync with clang.

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

llvm-svn: 303478

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.

llvm-svn: 303477

7 years ago[compiler-rt] Change default of allow_user_segv_handler to true
Vitaly Buka [Sat, 20 May 2017 01:04:59 +0000 (01:04 +0000)]
[compiler-rt] Change default of allow_user_segv_handler to true

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 303476

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.

llvm-svn: 303475

7 years agoRevert "CodeGenModule: Always output wchar_size, check LLVM assumptions."
Matthias Braun [Sat, 20 May 2017 00:38:27 +0000 (00:38 +0000)]
Revert "CodeGenModule: Always output wchar_size, check LLVM assumptions."

Let's revert this for now (and with it the assert()) to get the bots
back to green until I have LLVM synced up properly.

This reverts commit r303463.

llvm-svn: 303474

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.

llvm-svn: 303473

7 years agoFix valid-for-expr ellipses eaten as invalid decl
Hubert Tong [Sat, 20 May 2017 00:21:55 +0000 (00:21 +0000)]
Fix valid-for-expr ellipses eaten as invalid decl

Summary:
The trial parse for declarative syntax accepts an invalid pack
declaration syntax, which is ambiguous with valid pack expansions of
expressions. This commit removes the invalid pack declaration syntax to
avoid mistaking valid pack expansions as invalid declarator components.

Additionally, the trial parse of a //template-argument-list// then needs
to handle the optional ellipsis that is part of that grammar, as opposed
to relying on the trial parse for declarators accepting stray ellipses.

Reviewers: rsmith, rcraik, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 303472

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].

llvm-svn: 303471

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

llvm-svn: 303470

7 years agoRemove last (unnecessary) use of mapping from SourceLocation to Module and
Richard Smith [Fri, 19 May 2017 23:49:00 +0000 (23:49 +0000)]
Remove last (unnecessary) use of mapping from SourceLocation to Module and
remove the mechanism for doing so.

This mechanism was incorrect in the presence of preprocessed modules (and
#pragma clang module begin/end).

llvm-svn: 303469

7 years ago[modules] Simplify module macro handling in non-local-submodule-visibility mode.
Richard Smith [Fri, 19 May 2017 23:32:38 +0000 (23:32 +0000)]
[modules] Simplify module macro handling in non-local-submodule-visibility mode.

When reaching the end of a module, we used to convert its macros to
ModuleMacros but also leave them in the MacroDirective chain for the
identifier. This meant that every lookup of such a macro would find two
(identical) definitions. It also made it difficult to determine the correct
owner for a macro when reaching the end of a module: the most recent
MacroDirective in the chain could be from an #included submodule rather than
the current module.

Simplify this: whenever we convert a MacroDirective to a ModuleMacro when
leaving a module, clear out the MacroDirective chain for that identifier, and
just rely on the ModuleMacro to provide the macro definition information.

(We don't want to do this for local submodule visibility mode, because in that
mode we maintain a distinct MacroDirective chain for each submodule, and we
need to keep around the prior MacroDirective in case we re-enter the submodule
-- for instance, if its header is #included more than once in a module build,
we need the include guard directive to stick around. But the problem doesn't
arise in this case for the same reason: each submodule has its own
MacroDirective chain, so the macros don't leak out of submodules in the first
place.)

This reinstates r302932, reverted in r302947, with a fix for a bug that
resulted in us sometimes losing macro definitions due to failing to clear out
the overridden module macro list when promoting a directive to a module macro.

llvm-svn: 303468

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.

llvm-svn: 303467

7 years ago[test] Add support for Objective-C++ tests
Erik Pilkington [Fri, 19 May 2017 23:02:49 +0000 (23:02 +0000)]
[test] Add support for Objective-C++ tests

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

llvm-svn: 303466

7 years agoDon't override the SDKs and force the use of /System/Library/Frameworks to
Jason Molenda [Fri, 19 May 2017 23:00:42 +0000 (23:00 +0000)]
Don't override the SDKs and force the use of /System/Library/Frameworks to
find the python headers when buiding crashinfo.c
<rdar://problem/32288076>

llvm-svn: 303465

7 years ago[compiler-rt] Switch handle_<signal> flags from bool to enum.
Vitaly Buka [Fri, 19 May 2017 22:37:16 +0000 (22:37 +0000)]
[compiler-rt] Switch handle_<signal> flags from bool to enum.

Summary: We are going to make it tri-state and remove allow_user_segv_handler.

Reviewers: eugenis, alekseys, kcc

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 303464

7 years agoCodeGenModule: Always output wchar_size, check LLVM assumptions.
Matthias Braun [Fri, 19 May 2017 22:37:15 +0000 (22:37 +0000)]
CodeGenModule: Always output wchar_size, check LLVM assumptions.

llvm::TargetLibraryInfo needs to know the size of wchar_t to work on
functions like `wcslen`. This patch changes clang to always emit the
wchar_size module flag (it would only do so for ARM previously).
This also adds an `assert()` to ensure the LLVM defaults based on the
target triple are in sync with clang.

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

llvm-svn: 303463

7 years ago[compiler-rt] Add negative test for boolean flags.
Vitaly Buka [Fri, 19 May 2017 22:37:13 +0000 (22:37 +0000)]
[compiler-rt] Add negative test for boolean flags.

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 303462

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

llvm-svn: 303461

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

llvm-svn: 303460

7 years ago[ODRHash] Revert r303450 to fix buildbot
Richard Trieu [Fri, 19 May 2017 22:35:41 +0000 (22:35 +0000)]
[ODRHash] Revert r303450 to fix buildbot

r303450
[ODRHash] Support TemplateName and TemplateArgument

llvm-svn: 303459

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.

llvm-svn: 303458

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.

llvm-svn: 303457