platform/upstream/llvm.git
7 years agoCreate an OutputSection for each non-empty OutputSectionCommand.
Rafael Espindola [Wed, 26 Apr 2017 22:30:15 +0000 (22:30 +0000)]
Create an OutputSection for each non-empty OutputSectionCommand.

We were already pretty close, the one exception was when a name was
reused in another SECTIONS directive:

SECTIONS {
  .text : { *(.text) }
  .data : { *(.data) }
}
SECTIONS {
  .data : { *(other) }
}

In this case we would create a single .data and magically output
"other" while looking at the first OutputSectionCommand.

We now create two .data sections. This matches what gold does. If we
really want to create a single one, we should change the parser so that
the above is parsed as if the user had written

SECTIONS {
  .text : { *(.text) }
  .data : { *(.data) *(other)}
}

That is, there should be only one OutputSectionCommand for .data and
it would have two InputSectionDescriptions.

By itself this patch makes the code a bit more complicated, but is an
important step in allowing assignAddresses to operate just on the
linker script.

llvm-svn: 301484

7 years agoUpdate lldb to match clang r301442.
Richard Smith [Wed, 26 Apr 2017 22:10:53 +0000 (22:10 +0000)]
Update lldb to match clang r301442.

This code really doesn't make any sense: there is only ever one InputKind here.
Plus, this is an incomplete and out-of-date copy-paste of some Clang code. This
really ought to be revisited, but this change should get the bots green again.

llvm-svn: 301483

7 years ago[ubsan] nullability-assign: Check assignments into C++ structs
Vedant Kumar [Wed, 26 Apr 2017 21:55:17 +0000 (21:55 +0000)]
[ubsan] nullability-assign: Check assignments into C++ structs

Fix the nullability-assign check so that it can handle assignments into
C++ structs. Previously, such assignments were not instrumented.

Testing: check-clang, check-ubsan, enabling the existing test in ObjC++
mode, and building some Apple frameworks with -fsanitize=nullability.

llvm-svn: 301482

7 years ago[unittests/DeLICM] Add test for Written vs Written.
Michael Kruse [Wed, 26 Apr 2017 21:52:55 +0000 (21:52 +0000)]
[unittests/DeLICM] Add test for Written vs Written.

The interpretation of multiple known ValInsts for the same element and
timepoint is that these are alterntivate names for the same values,
for instance a PHINode and the incoming value when knowning it was
the last executed block. That means that known values do not conflict
if there at least (but necessarily all) one common ValInst.

This prinviple also applies to Written values. Add a test for this
principle.

llvm-svn: 301481

7 years ago[unittests/DeLICM] Add test for Occipied vs Occupied.
Michael Kruse [Wed, 26 Apr 2017 21:52:51 +0000 (21:52 +0000)]
[unittests/DeLICM] Add test for Occipied vs Occupied.

The interpretation of multiple known ValInsts for the same element and
timepoint is that these are alterntivate names for the same values,
for instance a PHINode and the incoming value when knowning it was
the last executed block. That means that known values do not conflict
if there at least (but necessarily all) one common ValInst.

Add a case to test this principle.

llvm-svn: 301480

7 years agoMark two tests (dead-strip.c, initialization-bug.cc) as unsupported on iOS.
Kuba Mracek [Wed, 26 Apr 2017 21:34:18 +0000 (21:34 +0000)]
Mark two tests (dead-strip.c, initialization-bug.cc) as unsupported on iOS.

llvm-svn: 301478

7 years ago[LibCallsShrinkWrap] Remove an unnecessary class member variable.
Davide Italiano [Wed, 26 Apr 2017 21:28:40 +0000 (21:28 +0000)]
[LibCallsShrinkWrap] Remove an unnecessary class member variable.

llvm-svn: 301477

7 years agoDo flag compatibility check in checkOptions. NFC.
Rui Ueyama [Wed, 26 Apr 2017 21:27:33 +0000 (21:27 +0000)]
Do flag compatibility check in checkOptions. NFC.

llvm-svn: 301476

7 years agoFactor out code to parse -build-id. NFC.
Rui Ueyama [Wed, 26 Apr 2017 21:23:11 +0000 (21:23 +0000)]
Factor out code to parse -build-id. NFC.

llvm-svn: 301475

7 years ago[LibCallsShrinkWrap] More descriptive assertion messages.
Davide Italiano [Wed, 26 Apr 2017 21:21:02 +0000 (21:21 +0000)]
[LibCallsShrinkWrap] More descriptive assertion messages.

Fix a typo while I'm here.

llvm-svn: 301474

7 years ago[LibCallsShrinkWrap] Remove some temporary cl::opt(s).
Davide Italiano [Wed, 26 Apr 2017 21:19:05 +0000 (21:19 +0000)]
[LibCallsShrinkWrap] Remove some temporary cl::opt(s).

The pass has been on and working for a while.

llvm-svn: 301473

7 years agoRevert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""
Vedant Kumar [Wed, 26 Apr 2017 21:05:44 +0000 (21:05 +0000)]
Revert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""

This reverts commit r301469. It isn't needed with r301470, which fixes
the API break introduced in the original commit.

llvm-svn: 301472

7 years ago[LibCallsShrinkWrap] Teach the pass how to preserve the dominator.
Davide Italiano [Wed, 26 Apr 2017 21:05:40 +0000 (21:05 +0000)]
[LibCallsShrinkWrap] Teach the pass how to preserve the dominator.

llvm-svn: 301471

7 years agoFix API breaks
David Blaikie [Wed, 26 Apr 2017 20:58:21 +0000 (20:58 +0000)]
Fix API breaks

llvm-svn: 301470

7 years agoRevert "PPCallbacks::MacroUndefined, change signature and add test."
Vedant Kumar [Wed, 26 Apr 2017 20:58:19 +0000 (20:58 +0000)]
Revert "PPCallbacks::MacroUndefined, change signature and add test."

This reverts commit r301449. It breaks the build with:

  MacroPPCallbacks.h:114:50: error: non-virtual member function marked 'override' hides virtual member function

llvm-svn: 301469

7 years agoFix API breaks
David Blaikie [Wed, 26 Apr 2017 20:58:03 +0000 (20:58 +0000)]
Fix API breaks

llvm-svn: 301468

7 years agoKill the old Simplify* APIs, leave SimplifyInstruction for the moment
Daniel Berlin [Wed, 26 Apr 2017 20:56:17 +0000 (20:56 +0000)]
Kill the old Simplify* APIs, leave SimplifyInstruction for the moment

llvm-svn: 301467

7 years agoNewGVN: Use new SimplifyQuery based API
Daniel Berlin [Wed, 26 Apr 2017 20:56:14 +0000 (20:56 +0000)]
NewGVN: Use new SimplifyQuery based API

llvm-svn: 301466

7 years agoPHITransAddr: Use new SimplifyQuery based API.
Daniel Berlin [Wed, 26 Apr 2017 20:56:13 +0000 (20:56 +0000)]
PHITransAddr: Use new SimplifyQuery based API.

llvm-svn: 301465

7 years agoInstCombine: Use the new SimplifyQuery versions of Simplify*. Use AssumptionCache...
Daniel Berlin [Wed, 26 Apr 2017 20:56:07 +0000 (20:56 +0000)]
InstCombine: Use the new SimplifyQuery versions of Simplify*. Use AssumptionCache, DominatorTree, TargetLibraryInfo everywhere.

llvm-svn: 301464

7 years ago[asan] Allow propagating env variables when testing on iOS Simulator
Kuba Mracek [Wed, 26 Apr 2017 20:38:24 +0000 (20:38 +0000)]
[asan] Allow propagating env variables when testing on iOS Simulator

This patch adds "%env" as a way to express that the environment variable should be set on the target device/simulator. This fixes some test failures when testing on iOS/Simulator.

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

llvm-svn: 301462

7 years agoFixed a crash when dealing with an empty method name in the ObjC runtime.
Sean Callanan [Wed, 26 Apr 2017 20:36:47 +0000 (20:36 +0000)]
Fixed a crash when dealing with an empty method name in the ObjC runtime.
I've filed a bug covering better unit testing of our runtime metadata reader, which will allow this to be testable..

<rdar://problem/31793264>

llvm-svn: 301461

7 years ago[DeLICM] Use Known information when comparing Occupied and Written.
Michael Kruse [Wed, 26 Apr 2017 20:35:07 +0000 (20:35 +0000)]
[DeLICM] Use Known information when comparing Occupied and Written.

Do not conflict if a write writes the same value as already known.

This change only affects unit tests, but no functional changes are
expected on LLVM-IR, as no Known information is yet extracted and
consequently this functionality is only triggered through unit tests.

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

llvm-svn: 301460

7 years agoXFAIL the TSan XPC tests on iOS. XPC isn't available on iOS.
Kuba Mracek [Wed, 26 Apr 2017 20:29:30 +0000 (20:29 +0000)]
XFAIL the TSan XPC tests on iOS.  XPC isn't available on iOS.

llvm-svn: 301459

7 years agoFix the dump_registers.cc ASan testcase on iOS to allow both SIGSEGV and SIGBUS.
Kuba Mracek [Wed, 26 Apr 2017 20:27:06 +0000 (20:27 +0000)]
Fix the dump_registers.cc ASan testcase on iOS to allow both SIGSEGV and SIGBUS.

llvm-svn: 301458

7 years ago[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)
Sanjay Patel [Wed, 26 Apr 2017 20:26:46 +0000 (20:26 +0000)]
[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)

Besides better codegen, the motivation is to be able to canonicalize this pattern
in IR (currently we don't) knowing that the backend is prepared for that.

This may also allow removing code for special constant cases in
DAGCombiner::foldSelectOfConstants() that was added in D30180.

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

llvm-svn: 301457

7 years agoMark the asan-sigbus.cpp ASan testcase as unsupported on iOS. We don't handle propaga...
Kuba Mracek [Wed, 26 Apr 2017 20:23:23 +0000 (20:23 +0000)]
Mark the asan-sigbus.cpp ASan testcase as unsupported on iOS. We don't handle propagating crashes from/to iOS well.

llvm-svn: 301456

7 years agoAdd a missing "%run" expansion to fread_fwrite.cc test case to support testing on...
Kuba Mracek [Wed, 26 Apr 2017 20:20:35 +0000 (20:20 +0000)]
Add a missing "%run" expansion to fread_fwrite.cc test case to support testing on iOS simulator.

llvm-svn: 301455

7 years agoFix comments again.
Rui Ueyama [Wed, 26 Apr 2017 20:20:05 +0000 (20:20 +0000)]
Fix comments again.

I thought I fixed the page size, but there were still errors.
This patch also contains fixes for grammatical errors.
Thanks pcc for proofreading!

llvm-svn: 301454

7 years ago[Modules] Fix a crash-on-invalid with overloaded functions
Bruno Cardoso Lopes [Wed, 26 Apr 2017 20:13:45 +0000 (20:13 +0000)]
[Modules] Fix a crash-on-invalid with overloaded functions

Do not add an overload if the function doesn't have a prototype; this
can happen if, for instance, a misplaced/malformed call site is
considered like a declaration for recovery purposes.

rdar://problem/31306325

llvm-svn: 301453

7 years agoFix the typo in strtok.c testcase: There was a missing space in %run expansion.
Kuba Mracek [Wed, 26 Apr 2017 20:02:14 +0000 (20:02 +0000)]
Fix the typo in strtok.c testcase: There was a missing space in %run expansion.

llvm-svn: 301451

7 years agoFix comment.
Rui Ueyama [Wed, 26 Apr 2017 19:50:49 +0000 (19:50 +0000)]
Fix comment.

llvm-svn: 301450

7 years agoPPCallbacks::MacroUndefined, change signature and add test.
Frederich Munch [Wed, 26 Apr 2017 19:47:31 +0000 (19:47 +0000)]
PPCallbacks::MacroUndefined, change signature and add test.

Summary:
The PPCallbacks::MacroUndefined callback is currently insufficient for clients that need to track the MacroDirectives.
This patch adds an additional argument to PPCallbacks::MacroUndefined that is the undef MacroDirective.

Reviewers: bruno, manmanren

Reviewed By: bruno

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 301449

7 years agoFollow-up for r301443: The python scrips need to be executable.
Kuba Mracek [Wed, 26 Apr 2017 19:43:56 +0000 (19:43 +0000)]
Follow-up for r301443: The python scrips need to be executable.

llvm-svn: 301448

7 years ago[asan] Add support for running lit tests in the iOS Simulator
Kuba Mracek [Wed, 26 Apr 2017 18:59:22 +0000 (18:59 +0000)]
[asan] Add support for running lit tests in the iOS Simulator

This patch adds a basic support for running the ASan lit test suite against an iOS Simulator. This is done by generating more lit.site.cfg configurations into subdirectories such as IOSSimI386Config and IOSSimX86_64Config. These test suites are not added into "check-all" or into "check-asan", they have to be run manually.

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

llvm-svn: 301443

7 years agoRefactor frontend InputKind to prepare for treating module maps as a distinct kind...
Richard Smith [Wed, 26 Apr 2017 18:57:40 +0000 (18:57 +0000)]
Refactor frontend InputKind to prepare for treating module maps as a distinct kind of input.

No functionality change intended.

llvm-svn: 301442

7 years agoUse llvm::ArrayRef rather than std::vector/std::initializer lists for some
Lang Hames [Wed, 26 Apr 2017 18:15:40 +0000 (18:15 +0000)]
Use llvm::ArrayRef rather than std::vector/std::initializer lists for some
ValueObject methods.

Using ArrayRef allows us to remove some overloads, work with more array-like
types, and avoid some std::vector temporaries.

https://reviews.llvm.org/D32518

llvm-svn: 301441

7 years ago[clang-tidy] Support detecting for-range loop in inefficient-vector-operation check.
Haojian Wu [Wed, 26 Apr 2017 18:13:05 +0000 (18:13 +0000)]
[clang-tidy] Support detecting for-range loop in inefficient-vector-operation check.

Summary:
Also add an option "VectorLikeClasses" allowing user specify customized
vectors.

Reviewers: alexfh, aaron.ballman

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 301440

7 years ago[AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers
Dmitry Preobrazhensky [Wed, 26 Apr 2017 17:55:50 +0000 (17:55 +0000)]
[AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers

Summary of changes:
- corrected vmcnt, expcnt, lgkmcnt helpers to checks their argument for truncation;
- added saturated versions of these helpers.

See bug 32711 for details: https://bugs.llvm.org//show_bug.cgi?id=32711

Reviewers: artem.tamazov, vpykhtin

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

llvm-svn: 301439

7 years agoLTO: Mark undefined module asm symbols as used.
Peter Collingbourne [Wed, 26 Apr 2017 17:53:39 +0000 (17:53 +0000)]
LTO: Mark undefined module asm symbols as used.

Marking them as used causes them to be considered visible outside of LTO. This
prevents the symbols from being internalized or discarded, either by GlobalDCE
or by summary-based dead stripping in ThinLTO.

This change makes it unnecessary to add these symbols to llvm.compiler.used
in the backend, as the symbols are kept alive by virtue of being external,
so remove the backend code that handles that.

Fixes PR32798.

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

llvm-svn: 301438

7 years agoCorrelatedValuePropagation: Rename a variable for consistency
Daniel Berlin [Wed, 26 Apr 2017 17:41:46 +0000 (17:41 +0000)]
CorrelatedValuePropagation: Rename a variable for consistency

llvm-svn: 301435

7 years ago[lsan] When necessary, define LSan suppression for tls_get_addr.
Alex Shlyapnikov [Wed, 26 Apr 2017 17:13:31 +0000 (17:13 +0000)]
[lsan] When necessary, define LSan suppression for tls_get_addr.

Summary:
Generalize already defined LSan suppression for the leak on
tls_get_addr, some envs do not have the entire call stack symbolized,
so we have to be less specific.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 301434

7 years agoUpdate to isl-0.18-423-g30331fe
Tobias Grosser [Wed, 26 Apr 2017 17:08:02 +0000 (17:08 +0000)]
Update to isl-0.18-423-g30331fe

This is just a general maintenance update.

llvm-svn: 301433

7 years ago[ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits
Craig Topper [Wed, 26 Apr 2017 16:39:58 +0000 (16:39 +0000)]
[ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits

This patch introduces a new KnownBits struct that wraps the two APInt used by computeKnownBits. This allows us to treat them as more of a unit.

Initially I've just altered the signatures of computeKnownBits and InstCombine's simplifyDemandedBits to pass a KnownBits reference instead of two separate APInt references. I'll do similar to the SelectionDAG version of computeKnownBits/simplifyDemandedBits as a separate patch.

I've added a constructor that allows initializing both APInts to the same bit width with a starting value of 0. This reduces the repeated pattern of initializing both APInts. Once place default constructed the APInts so I added a default constructor for those cases.

Going forward I would like to add more methods that will work on the pairs. For example trunc, zext, and sext occur on both APInts together in several places. We should probably add a clear method that can be used to clear both pieces. Maybe a method to check for conflicting information. A method to return (Zero|One) so we don't write it out everywhere. Maybe a method for (Zero|One).isAllOnesValue() to determine if all bits are known. I'm sure there are many other methods we can come up with.

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

llvm-svn: 301432

7 years ago[clang-tidy] Update IdentifierNamingCheck to remove extra leading/trailing underscores
Alexander Kornienko [Wed, 26 Apr 2017 16:39:11 +0000 (16:39 +0000)]
[clang-tidy] Update IdentifierNamingCheck to remove extra leading/trailing underscores

Summary:
The goal of this change is to fix the following suboptimal replacements currently suggested by clang-tidy:
```
// with MemberPrefix == "_"
int __foo;  // accepted without complaint
```
```
// with MemberPrefix == "m_"
int _foo;
    ^~~~~~
    m__foo
```

I fixed this by
- updating `matchesStyle()` to reject names which have a leading underscore after a prefix has already been stripped, or a trailing underscore if a suffix has already been stripped;
- updating `fixupWithStyle()` to strip leading & trailing underscores before adding the user-defined prefix and suffix.

The replacements are now:
```
// MemberPrefix == "_"
int __foo;
    ^~~~~~
    _foo
```
```
// MemberPrefix == "m_"
int _foo;
    ^~~~~
    m_foo
```

Future improvements might elect to add .clang-tidy flags to improve what is being stripped. For instance, stripping `m_` could allow `m_foo` to be automatically replaced with `_foo`.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Jacob Bandes-Storch!

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

llvm-svn: 301431

7 years agoRevert "Update to LLVM's use of WeakTrackingVH; NFC"
Sanjoy Das [Wed, 26 Apr 2017 16:37:51 +0000 (16:37 +0000)]
Revert "Update to LLVM's use of WeakTrackingVH; NFC"

This reverts commit r301427.

llvm-svn: 301430

7 years agoReverts commit r301424, r301425 and r301426
Sanjoy Das [Wed, 26 Apr 2017 16:37:05 +0000 (16:37 +0000)]
Reverts commit r301424, r301425 and r301426

Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

llvm-svn: 301429

7 years ago[LV] Handle external uses of floating-point induction variables
Matthew Simpson [Wed, 26 Apr 2017 16:23:02 +0000 (16:23 +0000)]
[LV] Handle external uses of floating-point induction variables

Reference: https://bugs.llvm.org/show_bug.cgi?id=32758
Differential Revision: https://reviews.llvm.org/D32445

llvm-svn: 301428

7 years agoUpdate to LLVM's use of WeakTrackingVH; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:22:36 +0000 (16:22 +0000)]
Update to LLVM's use of WeakTrackingVH; NFC

Summary: Depends on D32266

Reviewers: davide, dblaikie

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301427

7 years agoUse WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts
Sanjoy Das [Wed, 26 Apr 2017 16:21:02 +0000 (16:21 +0000)]
Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts

Summary:
In cases where an instruction (a call site, say) is RAUW'ed with some
other value (this is possible via the `returned` attribute, amongst
other things), we want the slot in UnknownInsts to point to the
original Instruction we wanted to track, not the value it got replaced
by.

Fixes PR32587.

Reviewers: davide

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301426

7 years agoAdd a new WeakVH value handle; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:20:59 +0000 (16:20 +0000)]
Add a new WeakVH value handle; NFC

Summary:
WeakVH nulls itself out if the value it was tracking gets deleted, but
it does not track RAUW.

Reviewers: dblaikie, davide

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301425

7 years agoRename WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:20:52 +0000 (16:20 +0000)]
Rename WeakVH to WeakTrackingVH; NFC

Summary:
I plan to use WeakVH to mean "nulls itself out on deletion, but does
not track RAUW" in a subsequent commit.

Reviewers: dblaikie, davide

Reviewed By: davide

Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle

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

llvm-svn: 301424

7 years agoMake LLD work even if the current directory is not writable.
Rui Ueyama [Wed, 26 Apr 2017 16:15:07 +0000 (16:15 +0000)]
Make LLD work even if the current directory is not writable.

llvm-svn: 301423

7 years agoMove code to emit error messages from Filesystem.cpp to Driver.cpp.
Rui Ueyama [Wed, 26 Apr 2017 16:14:46 +0000 (16:14 +0000)]
Move code to emit error messages from Filesystem.cpp to Driver.cpp.

isFileWritable() checked if a file is writable and then emitted
an error message if it is not writable. So it did more than the
name says. This patch moves error() calls to Driver.

llvm-svn: 301422

7 years ago[globalisel][tablegen] Fix vector element size
Igor Breger [Wed, 26 Apr 2017 15:59:05 +0000 (15:59 +0000)]
[globalisel][tablegen] Fix vector element size

Summary: Fix vector element size.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 301421

7 years ago[Sema] Avoid using a null type pointer (fixes PR32750)
Vedant Kumar [Wed, 26 Apr 2017 15:40:21 +0000 (15:40 +0000)]
[Sema] Avoid using a null type pointer (fixes PR32750)

isMicrosoftMissingTypename() uses a Type pointer without first checking
that it's non-null. PR32750 reports a case where the pointer is in fact
null. This patch adds in a defensive check and a regression test.

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

llvm-svn: 301420

7 years ago[sampleprof] Drop test dependency on the string hash func (NFC)
Vedant Kumar [Wed, 26 Apr 2017 15:39:53 +0000 (15:39 +0000)]
[sampleprof] Drop test dependency on the string hash func (NFC)

The SampleProfWriter emits function information in an order determined
by the string hash function. The situation is a bit brittle, because
changing the hash function can break the tests.

Instead of sorting the function samples to get a relaible ordering (that
might be too expensive), make the tests not depend on a particular
ordering of function samples.

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

llvm-svn: 301419

7 years ago[AMDGPU][MC] Added check for truncation of SOPK imm operand
Dmitry Preobrazhensky [Wed, 26 Apr 2017 15:34:19 +0000 (15:34 +0000)]
[AMDGPU][MC] Added check for truncation of SOPK imm operand

See bug 30827: https://bugs.llvm.org//show_bug.cgi?id=30827

Reviewers: artem.tamazov, vpykhtin

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

llvm-svn: 301418

7 years ago[OPENMP] Fix failing test.
Alexey Bataev [Wed, 26 Apr 2017 15:30:36 +0000 (15:30 +0000)]
[OPENMP] Fix failing test.

llvm-svn: 301417

7 years ago[OPENMP] Fix handling of OpenMP code during template instantiation.
Alexey Bataev [Wed, 26 Apr 2017 15:06:24 +0000 (15:06 +0000)]
[OPENMP] Fix handling of OpenMP code during template instantiation.

If some function template is instantiated during handling of OpenMP
code, currently it may cause crash of compiler because of trying of
capturing variables in non-capturing function scopes. Patch fixes this
bug.

llvm-svn: 301416

7 years agoUse CHECK-NEXT in a test.
Rafael Espindola [Wed, 26 Apr 2017 15:05:10 +0000 (15:05 +0000)]
Use CHECK-NEXT in a test.

This will simplify a future patch.

llvm-svn: 301415

7 years ago[ELF] - Remove dead TLS relocations relative code for MIPS and ARM
George Rimar [Wed, 26 Apr 2017 14:48:36 +0000 (14:48 +0000)]
[ELF] - Remove dead TLS relocations relative code for MIPS and ARM

This code was not used because of
handleARMTlsRelocation and handleMipsTlsRelocation methods that are called
for these platforms instead of regular TLS code.

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

llvm-svn: 301414

7 years ago[AVR] Remove an unused local variable
Dylan McKay [Wed, 26 Apr 2017 14:47:27 +0000 (14:47 +0000)]
[AVR] Remove an unused local variable

llvm-svn: 301413

7 years ago[x86] change tests to use sext, not zext; NFC
Sanjay Patel [Wed, 26 Apr 2017 14:35:54 +0000 (14:35 +0000)]
[x86] change tests to use sext, not zext; NFC

These are intended to exercise D31944, so we need sexts.

llvm-svn: 301412

7 years agoFix unused-variable warning caused by r301407.
Haojian Wu [Wed, 26 Apr 2017 14:31:05 +0000 (14:31 +0000)]
Fix unused-variable warning caused by r301407.

llvm-svn: 301411

7 years ago[OPENMP] Move handling of threadprivate vars from the stack, NFC.
Alexey Bataev [Wed, 26 Apr 2017 14:24:21 +0000 (14:24 +0000)]
[OPENMP] Move handling of threadprivate vars from the stack, NFC.

Threadprivate variables do no need to be handled in the Stack of all
directives, moving it out for better performance and memory.

llvm-svn: 301410

7 years ago-Wunguarded-availability should support if (@available) checks in top-level
Alex Lorenz [Wed, 26 Apr 2017 14:20:02 +0000 (14:20 +0000)]
-Wunguarded-availability should support if (@available) checks in top-level
blocks and lambdas

Prior to this commit Clang emitted the old "partial availability" warning for
expressions that referred to declarations that were not yet introduced in
blocks and lambdas that were not in a function/method. This commit ensures that
top-level blocks and lambdas use the new unguarded availability checks.

rdar://31835952

llvm-svn: 301409

7 years ago[TargetLowering] fix isConstTrueVal to account for build vector truncation
Sanjay Patel [Wed, 26 Apr 2017 14:05:42 +0000 (14:05 +0000)]
[TargetLowering] fix isConstTrueVal to account for build vector truncation

Build vectors have magical truncation powers, so we have things like this:

v4i1 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>
v4i16 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>

If we don't truncate the splat node returned by getConstantSplatNode(), then we won't find
truth when ZeroOrNegativeOneBooleanContent is the rule.

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

llvm-svn: 301408

7 years agoConvert LoopRotation to use SimplifyQuery version of SimplifyInstruction. Add Assumpt...
Daniel Berlin [Wed, 26 Apr 2017 13:52:18 +0000 (13:52 +0000)]
Convert LoopRotation to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache, DominatorTree, TLI if available.

llvm-svn: 301407

7 years agoConvert SimplifyInstructions to use the SimplifyQuery version of SimplifyInstruction
Daniel Berlin [Wed, 26 Apr 2017 13:52:16 +0000 (13:52 +0000)]
Convert SimplifyInstructions to use the SimplifyQuery version of SimplifyInstruction

llvm-svn: 301406

7 years agoConvert CVP to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache...
Daniel Berlin [Wed, 26 Apr 2017 13:52:13 +0000 (13:52 +0000)]
Convert CVP to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache, DominatorTree, TLI if available.

llvm-svn: 301405

7 years agoFix signed multiplication with overflow fallback.
Ranjeet Singh [Wed, 26 Apr 2017 13:41:43 +0000 (13:41 +0000)]
Fix signed multiplication with overflow fallback.

For targets that don't have ISD::MULHS or ISD::SMUL_LOHI for the type
and the double width type is illegal, then the two operands are
sign extended to twice their size then multiplied to check for overflow.
The extended upper halves were mismatched causing an incorrect result.
This fixes the mismatch.

A test was added for ARM V6-M where the bug was detected.

Patch by James Duley.

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

llvm-svn: 301404

7 years ago[DAG] add FIXME comments for splat detection; NFC
Sanjay Patel [Wed, 26 Apr 2017 13:27:57 +0000 (13:27 +0000)]
[DAG] add FIXME comments for splat detection; NFC

llvm-svn: 301403

7 years ago-Wdocumentation should not check the @returns command for Objective-C
Alex Lorenz [Wed, 26 Apr 2017 13:09:28 +0000 (13:09 +0000)]
-Wdocumentation should not check the @returns command for Objective-C
function/block pointer properties

The commit r300981 allowed @param/@return commands for function/block
pointer property declarations. This meant that -Wdocumentation started warning
about @return that was used to document properties whose function/block type
returned void. However, prior to that commit, we allowed @return for all
property declarations, because it can be used to document the value that's
returned by the property getter. This commit restores the previous behaviour:
now the @return command can be used to document all properties without warnings.

rdar://24978538

llvm-svn: 301402

7 years ago[X86] Added pointer math zext test case (PR22970)
Simon Pilgrim [Wed, 26 Apr 2017 13:03:00 +0000 (13:03 +0000)]
[X86] Added pointer math zext test case (PR22970)

llvm-svn: 301401

7 years ago[AST] Look through attribute type locs when searching for function type
Alex Lorenz [Wed, 26 Apr 2017 12:46:27 +0000 (12:46 +0000)]
[AST] Look through attribute type locs when searching for function type
loc

Prior to this commit -Wdocumentation crashed when checking the @returns command
for declarations whose function/block pointer type included an attribute like
_Nullable.

rdar://31818195

llvm-svn: 301400

7 years agoclang-format: [JS/Java] ignore Objective-C constructs in JS & Java.
Martin Probst [Wed, 26 Apr 2017 12:36:49 +0000 (12:36 +0000)]
clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.

Summary:
Java and JavaScript support annotations and decorators, respectively, that use a leading "@" token. clang-format currently detects this as an Objective-C construct and applies special formatting, for example no whitespace around "=" operators. This change disables the distinction for Java and JavaScript, which leads to normal formatting of single line annotated and initialized properties.

Before:
    class X {
      @foo() bar=false;
    }

After:
    class X {
      @foo() bar = false;
    }

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 301399

7 years agoformatting
Martin Probst [Wed, 26 Apr 2017 12:34:18 +0000 (12:34 +0000)]
formatting

llvm-svn: 301398

7 years agoclang-format: [JS] prevent wraps before class members.
Martin Probst [Wed, 26 Apr 2017 12:34:15 +0000 (12:34 +0000)]
clang-format: [JS] prevent wraps before class members.

Summary: In JavaScript/TypeScript, class member definitions that use modifiers can be subject to Automatic Semicolon Insertion (ASI). For example, "class X { get \n foo }" defines a property called "get" and a property called "foo", both with no type annotation. This change prevents wrapping after the modifier keywords (visibility modifiers, static, get and set) to prevent accidental ASI.

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 301397

7 years ago[X86][SSE] Add test case for repeated vector insertions of the same element (PR15298)
Simon Pilgrim [Wed, 26 Apr 2017 12:23:32 +0000 (12:23 +0000)]
[X86][SSE] Add test case for repeated vector insertions of the same element (PR15298)

llvm-svn: 301396

7 years agoSimplify the CFG after loop pass cleanup.
Filipe Cabecinhas [Wed, 26 Apr 2017 12:02:41 +0000 (12:02 +0000)]
Simplify the CFG after loop pass cleanup.

Summary:
Otherwise we might end up with some empty basic blocks or
single-entry-single-exit basic blocks.

This fixes PR32085

Reviewers: chandlerc, danielcdh

Subscribers: mehdi_amini, RKSimon, llvm-commits

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

llvm-svn: 301395

7 years ago[mips] Fix test mips64fpldst.ll with machine verifier enabled
Sagar Thakur [Wed, 26 Apr 2017 11:40:12 +0000 (11:40 +0000)]
[mips] Fix test mips64fpldst.ll with machine verifier enabled

Removed micro mips register classes for gp initialization because gp initialization uses pure mips64 instruction. Even when compiling for micro mips, gp initialization can be done with pure mips64 instructions.

Reviewed by Simon Dardis
Differential: D32286

llvm-svn: 301394

7 years ago[X86] Add missing mayLoad/mayStore attributes to some X86 instructions (Continue)
Ayman Musa [Wed, 26 Apr 2017 11:34:09 +0000 (11:34 +0000)]
[X86] Add missing mayLoad/mayStore attributes to some X86 instructions (Continue)

Complete the patch committed in rL300190.

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

llvm-svn: 301393

7 years ago[mips] Rework a portion of MipsCC interface. (NFC)
Simon Dardis [Wed, 26 Apr 2017 11:10:38 +0000 (11:10 +0000)]
[mips] Rework a portion of MipsCC interface. (NFC)

r299766 contained a "conditional move or jump depends on uninitialized value"
fault, identified by valgrind. This occurred as MipsFastISel::finishCall(..)
used CCState over MipsCCState. The latter is required for the TableGen'd calling
convention logic due to reliance on pre-analyzing type information to lower call
results/returns of vectors correctly.

This change modifies the MipsCC AnalyzeCallResult to be useful with both the
SelectionDAG and FastISel lowering logic.

Reviewers: slthakur

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

llvm-svn: 301392

7 years ago[ELF] - Implemented --defsym option.
George Rimar [Wed, 26 Apr 2017 10:40:02 +0000 (10:40 +0000)]
[ELF] - Implemented --defsym option.

gnu ld description of option is:

--defsym=symbol=expression
Create a global symbol in the output file, containing the absolute address given
by expression. You may use this option as many times as necessary to define multiple
symbols in the command line. A limited form of arithmetic is supported for the
expression in this context: you may give a hexadecimal constant or the name of an
existing symbol, or use "+" and "-" to add or subtract hexadecimal constants or
symbols. If you need more elaborate expressions, consider using the linker command
language from a script. Note: there should be no white space between symbol,
the equals sign ("="), and expression.

In compare with D32082, this patch does not support math expressions and absolute
symbols. It implemented via code similar to --wrap. That covers 1 of 3 possible
--defsym cases.

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

llvm-svn: 301391

7 years agoPR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is...
Andrew V. Tischenko [Wed, 26 Apr 2017 09:56:59 +0000 (09:56 +0000)]
PR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is now supported in MS asm.

llvm-svn: 301390

7 years agoInitial implementation of SB APIs for Tracing support.
Ravitheja Addepally [Wed, 26 Apr 2017 08:48:50 +0000 (08:48 +0000)]
Initial implementation of SB APIs for Tracing support.

Summary:
This patch introduces new SB APIs for tracing support
inside LLDB. The idea is to gather trace data from
LLDB and provide it through this APIs to external
tools integrating with LLDB. These tools will be
responsible for interpreting and presenting the
trace data to their users.

The patch implements the following new SB APIs ->
-> StartTrace - starts tracing with given parameters
-> StopTrace - stops tracing.
-> GetTraceData - read the trace data .
-> GetMetaData - read the meta data assosciated with the trace.
-> GetTraceConfig - read the trace configuration

Tracing is associated with a user_id that is returned
by the StartTrace API and this id needs to be used
for accessing the trace data and also Stopping
the trace. The user_id itself may map to tracing
the complete process or just an individual thread.
The APIs require an additional thread parameter
when the user of these APIs wishes to perform
thread specific manipulations on the tracing instances.
The patch also includes the corresponding
python wrappers for the C++ based APIs.

Reviewers: k8stone, lldb-commits, clayborg

Reviewed By: clayborg

Subscribers: jingham, mgorny

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

llvm-svn: 301389

7 years ago[test] Build sanitizer/xray tests only if COMPILER_RT_BUILD_* is on
Michal Gorny [Wed, 26 Apr 2017 07:35:36 +0000 (07:35 +0000)]
[test] Build sanitizer/xray tests only if COMPILER_RT_BUILD_* is on

Cover the sanitizer tests with COMPILER_RT_BUILD_SANITIZERS
conditional, and add COMPILER_RT_BUILD_XRAY conditional to the xray
tests. This makes it possible to do a pure-builtins build with tests
enabled.

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

llvm-svn: 301387

7 years ago[X86][SSE2] Fix asm string for movq (Move Quadword) instruction.
Ayman Musa [Wed, 26 Apr 2017 07:08:44 +0000 (07:08 +0000)]
[X86][SSE2] Fix asm string for movq (Move Quadword) instruction.

Replace "mov{d|q}" with "movq".

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

llvm-svn: 301386

7 years ago[InstCombine] Add test cases for opportunities to improve knownbits handling for...
Craig Topper [Wed, 26 Apr 2017 05:59:19 +0000 (05:59 +0000)]
[InstCombine] Add test cases for opportunities to improve knownbits handling for cttz and ctlz intrinsics.

llvm-svn: 301385

7 years ago[analyzer] Teach the MallocChecker about Glib API for two arguments
Leslie Zhai [Wed, 26 Apr 2017 05:33:14 +0000 (05:33 +0000)]
[analyzer] Teach the MallocChecker about Glib API for two arguments

Reviewers: zaks.anna, NoQ, danielmarjamaki

Reviewed By: zaks.anna, NoQ, danielmarjamaki

Subscribers: cfe-commits, kalev, pwithnall

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

llvm-svn: 301384

7 years agoRemove tailing whitespaces.
Michael Liao [Wed, 26 Apr 2017 05:27:20 +0000 (05:27 +0000)]
Remove tailing whitespaces.

llvm-svn: 301383

7 years ago[Modules][ObjC] Check definition from canonical decl on designated initializers
Bruno Cardoso Lopes [Wed, 26 Apr 2017 05:06:20 +0000 (05:06 +0000)]
[Modules][ObjC] Check definition from canonical decl on designated initializers

Use definition from canonical decl when checking for designated
initializers. This is necessary since deserialization of a interface
might reuse the definition from the canonical one (see r281119).

rdar://problem/29360655

llvm-svn: 301382

7 years agoInstructionSimplify: Use braced initializer list for SimplifyQuery creation
Daniel Berlin [Wed, 26 Apr 2017 04:10:02 +0000 (04:10 +0000)]
InstructionSimplify: Use braced initializer list for SimplifyQuery creation

llvm-svn: 301381

7 years agoInstructionSimplify: Have SimplifyFPBinOp pass FastMathFlags by value, like we do...
Daniel Berlin [Wed, 26 Apr 2017 04:10:00 +0000 (04:10 +0000)]
InstructionSimplify: Have SimplifyFPBinOp pass FastMathFlags by value, like we do everywhere else

llvm-svn: 301380

7 years agoInstructionSimplify: End our long national nightmare of ever-growing Simplify* arguments.
Daniel Berlin [Wed, 26 Apr 2017 04:09:56 +0000 (04:09 +0000)]
InstructionSimplify: End our long national nightmare of ever-growing Simplify* arguments.

Summary:
Expose the internal query structure, start using it.

Note: This is the most minimal change possible i could create.  I have
trivial followups, like fixing the one use of const FastMathFlags &,
the renaming of CtxI to be consistent, etc.

This should be NFC.

Reviewers: majnemer, davide

Subscribers: llvm-commits

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

llvm-svn: 301379

7 years ago[XRay][tools] Remove wayward semicolon (NFC)
Dean Michael Berris [Wed, 26 Apr 2017 03:49:49 +0000 (03:49 +0000)]
[XRay][tools] Remove wayward semicolon (NFC)

Follow-up to D29320.

llvm-svn: 301378

7 years ago[ubsan] Skip alignment checks on allocas with known alignment
Vedant Kumar [Wed, 26 Apr 2017 02:17:21 +0000 (02:17 +0000)]
[ubsan] Skip alignment checks on allocas with known alignment

It's possible to determine the alignment of an alloca at compile-time.
Use this information to skip emitting some runtime alignment checks.

Testing: check-clang, check-ubsan.

This significantly reduces the amount of alignment checks we emit when
compiling X86ISelLowering.cpp. Here are the numbers from patched/unpatched
clangs based on r301361.

  ------------------------------------------
  | Setup          | # of alignment checks |
  ------------------------------------------
  | unpatched, -O0 |                 47195 |
  | patched, -O0   |                 30876 | (-34.6%)
  ------------------------------------------

llvm-svn: 301377

7 years ago[XRay][tools] Fixup definition for stat division.
Dean Michael Berris [Wed, 26 Apr 2017 01:35:23 +0000 (01:35 +0000)]
[XRay][tools] Fixup definition for stat division.

Copy-pasta error.

Follow-up to D29320.

llvm-svn: 301376

7 years ago[AMDGPU] Garbage collect dead code. NFCI.
Davide Italiano [Wed, 26 Apr 2017 01:00:52 +0000 (01:00 +0000)]
[AMDGPU] Garbage collect dead code. NFCI.

llvm-svn: 301375