platform/upstream/llvm.git
7 years ago[libFuzzer] make sure the input data is not overwritten in the fuzz target (if it...
Kostya Serebryany [Tue, 9 May 2017 01:17:29 +0000 (01:17 +0000)]
[libFuzzer] make sure the input data is not overwritten in the fuzz target (if it is -- report an error)

llvm-svn: 302494

7 years agoRevert "Use the frame index side table for byval and inalloca arguments"
Reid Kleckner [Tue, 9 May 2017 01:14:39 +0000 (01:14 +0000)]
Revert "Use the frame index side table for byval and inalloca arguments"

This reverts r302483 and it's follow up fix.

llvm-svn: 302493

7 years ago[XRay] Add __xray_customeevent(...) as a clang-supported builtin
Dean Michael Berris [Tue, 9 May 2017 00:45:40 +0000 (00:45 +0000)]
[XRay] Add __xray_customeevent(...) as a clang-supported builtin

Summary:
We define the `__xray_customeevent` builtin that gets translated to
IR calls to the correct intrinsic. The default implementation of this is
a no-op function. The codegen side of this follows the following logic:

- When `-fxray-instrument` is not provided in the driver, we elide all
calls to `__xray_customevent`.
- When `-fxray-instrument` is enabled and a function is marked as "never
instrumented", we elide all calls to `__xray_customevent` in that
function; if either marked as "always instrumented" or subject to
threshold-based instrumentation, we emit a call to the
`llvm.xray.customevent` intrinsic from LLVM for each
`__xray_customevent` occurrence in the function.

This change depends on D27503 (to land in LLVM first).

Reviewers: echristo, rsmith

Subscribers: mehdi_amini, pelikan, lrl, cfe-commits

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

llvm-svn: 302492

7 years ago[Modules] Allow umbrella frameworks to define private submodules for subframeworks
Bruno Cardoso Lopes [Tue, 9 May 2017 00:41:38 +0000 (00:41 +0000)]
[Modules] Allow umbrella frameworks to define private submodules for subframeworks

In r298391 we fixed the umbrella framework model to work when submodules
named "Private" are used. This complements the work by allowing the
umbrella framework model to work in general.

rdar://problem/31790067

llvm-svn: 302491

7 years agoRename a method. NFC.
Vedant Kumar [Tue, 9 May 2017 00:12:33 +0000 (00:12 +0000)]
Rename a method. NFC.

llvm-svn: 302490

7 years agoXFAIL noexcept member function throw/catch test under GCC.
Eric Fiselier [Tue, 9 May 2017 00:11:02 +0000 (00:11 +0000)]
XFAIL noexcept member function throw/catch test under GCC.

I'm still not exactly sure why the test fails, but I suspect it's
a bug in GCC. More investigation needed.

llvm-svn: 302489

7 years agoFix GCC 7 test failures.
Eric Fiselier [Tue, 9 May 2017 00:00:00 +0000 (00:00 +0000)]
Fix GCC 7 test failures.

This patch fixes the test failures and unexpected passes that occur
when testing against GCC 7. Specifically:

* don't mark __gcd as always inline because it's a recursive function. GCC diagnoses this.
* don't XFAIL the aligned allocation tests. GCC 7 supports them but not the -faligned-allocation option.
* Work around gcc.gnu.org/PR78489 in variants constructors.

llvm-svn: 302488

7 years ago[APInt] Use default constructor instead of explicitly creating a 1-bit APInt in udiv...
Craig Topper [Mon, 8 May 2017 23:49:54 +0000 (23:49 +0000)]
[APInt] Use default constructor instead of explicitly creating a 1-bit APInt in udiv and urem. NFC

The default constructor does the same thing.

llvm-svn: 302487

7 years ago[APInt] Remove 'else' after 'return' in udiv and urem. NFC
Craig Topper [Mon, 8 May 2017 23:49:49 +0000 (23:49 +0000)]
[APInt] Remove 'else' after 'return' in udiv and urem. NFC

llvm-svn: 302486

7 years agoIgnore !associated metadata with null argument.
Evgeniy Stepanov [Mon, 8 May 2017 23:46:20 +0000 (23:46 +0000)]
Ignore !associated metadata with null argument.

Fixes PR32577 (comment 10).
Such metadata may legitimately appear in LTO.

llvm-svn: 302485

7 years agoRelax Dwarf filecheck test for 32-bit hosts
Reid Kleckner [Mon, 8 May 2017 23:27:52 +0000 (23:27 +0000)]
Relax Dwarf filecheck test for 32-bit hosts

llvm-svn: 302484

7 years agoUse the frame index side table for byval and inalloca arguments
Reid Kleckner [Mon, 8 May 2017 23:20:27 +0000 (23:20 +0000)]
Use the frame index side table for byval and inalloca arguments

Summary:
For inalloca functions, this is a very common code pattern:

  %argpack = type <{ i32, i32, i32 }>
  define void @f(%argpack* inalloca %args) {
  entry:
    %a = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 0
    %b = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 1
    %c = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 2
    tail call void @llvm.dbg.declare(metadata i32* %a, ... "a")
    tail call void @llvm.dbg.declare(metadata i32* %c, ... "b")
    tail call void @llvm.dbg.declare(metadata i32* %b, ... "c")

Even though these GEPs can be simplified to a constant offset from EBP
or RSP, we don't do that at -O0, and each GEP is computed into a
register. Registers used to compute argument addresses are typically
spilled and clobbered very quickly after the initial computation, so
live debug variable tracking loses information very quickly if we use
DBG_VALUE instructions.

This change moves processing of dbg.declare between argument lowering
and basic block isel, so that we can ask if an argument has a frame
index or not. If the argument lives in a register as is the case for
byval arguments on some targets, then we don't put it in the side table
and during ISel we emit DBG_VALUE instructions.

Reviewers: aprantl

Subscribers: llvm-commits

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

llvm-svn: 302483

7 years agoAdd basic test case for -instnamer
Sanjoy Das [Mon, 8 May 2017 23:18:46 +0000 (23:18 +0000)]
Add basic test case for -instnamer

llvm-svn: 302482

7 years ago[InstNamer] Use range-for
Sanjoy Das [Mon, 8 May 2017 23:18:43 +0000 (23:18 +0000)]
[InstNamer] Use range-for

llvm-svn: 302481

7 years ago[InstNamer] Don't check type of arguments (they're never void)
Sanjoy Das [Mon, 8 May 2017 23:18:39 +0000 (23:18 +0000)]
[InstNamer] Don't check type of arguments (they're never void)

llvm-svn: 302480

7 years agoDelete trailing whitespace
Sanjoy Das [Mon, 8 May 2017 23:18:36 +0000 (23:18 +0000)]
Delete trailing whitespace

llvm-svn: 302479

7 years agoUpdate testcase for upstream LLVM changes.
Adrian Prantl [Mon, 8 May 2017 22:44:00 +0000 (22:44 +0000)]
Update testcase for upstream LLVM changes.

llvm-svn: 302476

7 years ago[InstCombine] add tests from D32285 to show current problems; NFC
Sanjay Patel [Mon, 8 May 2017 22:33:20 +0000 (22:33 +0000)]
[InstCombine] add tests from D32285 to show current problems; NFC

llvm-svn: 302475

7 years agoRefactor <locale> RAII guards to aid upcoming Windows locale changes.
Eric Fiselier [Mon, 8 May 2017 22:02:43 +0000 (22:02 +0000)]
Refactor <locale> RAII guards to aid upcoming Windows locale changes.

Previously <locale> used std::unique_ptr<remove_ptr<locale_t>, locale-mgmt-function>
as a scope guard for (A) creating new locales, and (B) setting the thread specific locale
in RAII safe manner.

However using unique_ptr has some problems, first it requires that locale_t is a pointer
type, which may not be the case (Windows will need a non-pointer locale_t type that emulates _locale_t).

The second problem is that users of the guards had to supply the locale management function to the custom
deleter at every call site. However these locale management functions don't exist natively Windows, making
a good Windows implementation of locale more difficult.

This patch creates distinct and simply RAII guards that replace unique_ptr. These guards handle calling
the correct locale management function so that callers don't have too. This simplification will
aid in upcoming Windows fixes.

llvm-svn: 302474

7 years agoFix possible loss of data warnings on amd64
Billy Robert O'Neal III [Mon, 8 May 2017 21:54:53 +0000 (21:54 +0000)]
Fix possible loss of data warnings on amd64

In T_size_size.pass, there is an explicit template argument to std::min to ask
for unsigned, to avoid type deduction errors. However, C1XX' warnings still
hate this use, because a 64 bit value (a size_t) is being passed to a function
accepting an unsigned (a 32 bit value).

Instead, change the tests to pass around std::size_t instances, and explicitly
narrow when constructing the string type under test. This also allows
removal of explicit template arguments to std::min.

llvm-svn: 302473

7 years agoResolve integer overflow warnings in GCD and LCM tests
Billy Robert O'Neal III [Mon, 8 May 2017 21:52:05 +0000 (21:52 +0000)]
Resolve integer overflow warnings in GCD and LCM tests

lcm.pass.cpp:
19: Update headers to that actually used in the test.
41: test0 was triggering narrowing warnings for all callers, because the
inputs were always ints, but some of the explicit template arguments were
smaller than that. Instead, have this function accept ints and static_cast
explicitly to the types we want before calling std::lcm.
47: Replace unnecessary ternary.
55: Use foo_t instead of typename foo<>::type
111/116: intX_t were not std::qualified but only <cfoo> headers were included.
141: C1XX has a bug where it interprets 2147483648 as unsigned int. Then the
negation trips "negation of unsigned value, result still unsigned" warnings.
Perma-workaround this issue by saying INT_MIN, which better documents the
intended behavior and avoids triggering warnings on C1XX.

gcd.pass.cpp:
Same changes as lcm.pass.cpp but for GCD.

llvm-svn: 302472

7 years agoAdd const to "DWARFDie &Die" in a few functions as they can't change the DWARFDie.
Greg Clayton [Mon, 8 May 2017 21:29:17 +0000 (21:29 +0000)]
Add const to "DWARFDie &Die" in a few functions as they can't change the DWARFDie.

llvm-svn: 302471

7 years agoFix typo
Eugene Zemtsov [Mon, 8 May 2017 21:20:53 +0000 (21:20 +0000)]
Fix typo

llvm-svn: 302470

7 years agoMake it illegal for two Functions to point to the same DISubprogram
Adrian Prantl [Mon, 8 May 2017 21:17:08 +0000 (21:17 +0000)]
Make it illegal for two Functions to point to the same DISubprogram

As recently discussed on llvm-dev [1], this patch makes it illegal for
two Functions to point to the same DISubprogram and updates
FunctionCloner to also clone the debug info of a function to conform
to the new requirement. To simplify the implementation it also factors
out the creation of inlineAt locations from the Inliner into a
general-purpose utility in DILocation.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/112661.html
<rdar://problem/31926379>

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

llvm-svn: 302469

7 years ago[Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled
Vedant Kumar [Mon, 8 May 2017 21:11:55 +0000 (21:11 +0000)]
[Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled

When enabling any sanitizer, -fsanitize-use-after-scope is enabled by
default. This doesn't actually turn ASan on, because we've been getting
lucky and there are extra checks in BackendUtil that stop this from
happening.

However, this has been causing a behavior change: extra lifetime markers
are emitted in some cases where they aren't needed or expected.

llvm-svn: 302468

7 years agoSTLExtras: Fix enumerate() documentation
Matthias Braun [Mon, 8 May 2017 21:10:58 +0000 (21:10 +0000)]
STLExtras: Fix enumerate() documentation

llvm-svn: 302467

7 years agoFix typo "veify" to "verify".
Greg Clayton [Mon, 8 May 2017 20:53:00 +0000 (20:53 +0000)]
Fix typo "veify" to "verify".

llvm-svn: 302466

7 years ago[InstCombine] add folds for not-of-shift-right
Sanjay Patel [Mon, 8 May 2017 20:49:59 +0000 (20:49 +0000)]
[InstCombine] add folds for not-of-shift-right

This is another step towards getting rid of dyn_castNotVal,
so we can recommit:
https://reviews.llvm.org/rL300977

As the tests show, we were missing the lshr case for constants
and both ashr/lshr vector splat folds. The ashr case with constant
was being performed inefficiently in 2 steps. It's also possible
there was a latent bug in that case because we can't do that fold
if the constant is positive:
http://rise4fun.com/Alive/Bge

llvm-svn: 302465

7 years ago[PartialInlining] Capture by reference rather than by value.
Davide Italiano [Mon, 8 May 2017 20:44:01 +0000 (20:44 +0000)]
[PartialInlining] Capture by reference rather than by value.

llvm-svn: 302464

7 years agoIf we are building a module, and we read a second description of the same
Richard Smith [Mon, 8 May 2017 20:30:47 +0000 (20:30 +0000)]
If we are building a module, and we read a second description of the same
module from a different module map, ignore it.

This happens during builds of preprocessed modules (where it is harmless).

llvm-svn: 302463

7 years agoARM: use divmod libcalls on embedded MachO platforms too.
Tim Northover [Mon, 8 May 2017 20:00:14 +0000 (20:00 +0000)]
ARM: use divmod libcalls on embedded MachO platforms too.

The separated libcalls are implemented in terms of __divmodsi4 and __udivmodsi4
anyway, so we should always use them if possible.

llvm-svn: 302462

7 years agoDon't add DBG_VALUE instructions for static allocas in dbg.declare
Reid Kleckner [Mon, 8 May 2017 19:58:15 +0000 (19:58 +0000)]
Don't add DBG_VALUE instructions for static allocas in dbg.declare

Summary:
An llvm.dbg.declare of a static alloca is always added to the
MachineFunction dbg variable map, so these values are entirely
redundant. They survive all the way through codegen to be ignored by
DWARF emission.

Effectively revert r113967

Two bugpoint-reduced test cases from 2012 broke as a result of this
change. Despite my best efforts, I haven't been able to rewrite the test
case using dbg.value. I'm not too concerned about the lost coverage
because these were reduced from the test-suite, which we still run.

Reviewers: aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 302461

7 years agoAdd some useful helper methods / operators to TypeIndex.
Zachary Turner [Mon, 8 May 2017 19:46:37 +0000 (19:46 +0000)]
Add some useful helper methods / operators to TypeIndex.

llvm-svn: 302460

7 years agoUpdate instructions for using the experimental monorepo
Reid Kleckner [Mon, 8 May 2017 19:45:57 +0000 (19:45 +0000)]
Update instructions for using the experimental monorepo

llvm-svn: 302459

7 years ago[BitVector] Make find_prev member function const.
Zachary Turner [Mon, 8 May 2017 19:45:55 +0000 (19:45 +0000)]
[BitVector] Make find_prev member function const.

NFC.

llvm-svn: 302458

7 years agoAdd a blurb to the release notes about the WeakVH -> WeakTrackingVH transition
Sanjoy Das [Mon, 8 May 2017 19:15:06 +0000 (19:15 +0000)]
Add a blurb to the release notes about the WeakVH -> WeakTrackingVH transition

llvm-svn: 302456

7 years ago[CodeView] Add support for random access type visitors.
Zachary Turner [Mon, 8 May 2017 18:38:43 +0000 (18:38 +0000)]
[CodeView] Add support for random access type visitors.

Previously type visitation was done strictly sequentially, and
TypeIndexes were computed by incrementing the TypeIndex of the
last visited record.  This works fine for situations like dumping,
but not when you want to visit types in random order.  For example,
in a debug session someone might lookup a symbol by name, find that
it has TypeIndex 10,000 and then want to go straight to TypeIndex
10,000.

In order to make this work, the visitation framework needs a mode
where it can plumb TypeIndices through the callback pipeline.  This
patch adds such a mode.  In doing so, it is necessary to provide
an alternative implementation of TypeDatabase that supports random
access, so that is done as well.

Nothing actually uses these random access capabilities yet, but
this will be done in subsequent patches.

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

llvm-svn: 302454

7 years ago[AArch64][RegisterBankInfo] Change the default mapping of fp loads.
Quentin Colombet [Mon, 8 May 2017 18:16:31 +0000 (18:16 +0000)]
[AArch64][RegisterBankInfo] Change the default mapping of fp loads.

This fixes PR32550, in a way that does not imply running the greedy
mode at O0.

The fix consists in checking if a load is used by any floating point
instruction and if yes, we return a default mapping with FPR instead
of GPR.

llvm-svn: 302453

7 years ago[AArch64][RegisterBankInfo] Fix mapping cost for GPR.
Quentin Colombet [Mon, 8 May 2017 18:16:23 +0000 (18:16 +0000)]
[AArch64][RegisterBankInfo] Fix mapping cost for GPR.

In r292478, we changed the order of the enum that is referenced by
PMI_FirstXXX. This had the side effect of changing the cost of the
mapping of all the loads, instead of just the FPRs ones.

Reinstate the higher cost for all but GPR loads.
Note: This did not have any external visible effects:
- For Fast mode, the cost would have been higher, but we don't care
  because we don't try to use alternative mappings.
- For Greedy mode, the higher cost of the GPR loads, would have
  triggered the use of the supposedly alternative mapping, that
  would be in fact the same GPR mapping but with a lower cost.

llvm-svn: 302452

7 years ago[InstCombine] move/add tests for not(shr (not X), Y); NFC
Sanjay Patel [Mon, 8 May 2017 18:16:04 +0000 (18:16 +0000)]
[InstCombine] move/add tests for not(shr (not X), Y); NFC

llvm-svn: 302451

7 years ago[ARM] Use a Changed flag to avoid making a pass's return value dependent on a compare...
Craig Topper [Mon, 8 May 2017 18:02:51 +0000 (18:02 +0000)]
[ARM] Use a Changed flag to avoid making a pass's return value dependent on a compare with a Statistic object.

Statistic compile to always be 0 in release build so this compare would always return false. And in the debug builds Statistic are global variables and remember their values across pass runs. So this compare returns true anytime the pass runs after the first time it modifies something.

This was found after reviewing all usages of comparison operators on a Statistic object. We had some internal code that did a compare with a statistic that caused a mismatch in output between debug and release builds. So we did an audit out of paranoia.

llvm-svn: 302450

7 years ago[SCEV] Make setRange take ConstantRange by value instead of rvalue reference so we...
Craig Topper [Mon, 8 May 2017 17:39:08 +0000 (17:39 +0000)]
[SCEV] Make setRange take ConstantRange by value instead of rvalue reference so we don't force anything on the caller.

llvm-svn: 302449

7 years ago[SCEV] Don't use std::move on both inputs to APInt::operator+ or operator-. It might...
Craig Topper [Mon, 8 May 2017 17:39:01 +0000 (17:39 +0000)]
[SCEV] Don't use std::move on both inputs to APInt::operator+ or operator-. It might be confusing to the reader. NFC

llvm-svn: 302448

7 years agoConstantFold: Handle gep nonnull, undef as well
Daniel Berlin [Mon, 8 May 2017 17:37:33 +0000 (17:37 +0000)]
ConstantFold: Handle gep nonnull, undef as well

llvm-svn: 302447

7 years agoConstantFold: Fold getelementptr (i32, i32* null, i64 undef) to null.
Daniel Berlin [Mon, 8 May 2017 17:37:29 +0000 (17:37 +0000)]
ConstantFold: Fold  getelementptr (i32, i32* null, i64 undef) to null.
Transforms/IndVarSimplify/2011-10-27-lftrnull will fail if this regresses.
Transforms/GVN/PRE/2011-06-01-NonLocalMemdepMiscompile.ll has been changed to still test what it was
trying to test.

llvm-svn: 302446

7 years ago[X86][LWP] Add __LWP__ macro tests
Simon Pilgrim [Mon, 8 May 2017 17:25:48 +0000 (17:25 +0000)]
[X86][LWP] Add __LWP__ macro tests

Missed in rL302418

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

llvm-svn: 302445

7 years ago[ValueTracking] Use KnownOnes to provide a better bound on known zeros for ctlz/cttz...
Craig Topper [Mon, 8 May 2017 17:22:34 +0000 (17:22 +0000)]
[ValueTracking] Use KnownOnes to provide a better bound on known zeros for ctlz/cttz intrinics

This patch uses KnownOnes of the input of ctlz/cttz to bound the value that can be returned from these intrinsics. This makes these intrinsics more similar to the handling for ctpop which already uses known bits to produce a similar bound.

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

llvm-svn: 302444

7 years agoFix grammar in comment. NFC
Jonathan Roelofs [Mon, 8 May 2017 17:06:17 +0000 (17:06 +0000)]
Fix grammar in comment. NFC

llvm-svn: 302443

7 years ago[X86] Split test configurations. NFC.
Zvi Rackover [Mon, 8 May 2017 16:54:25 +0000 (16:54 +0000)]
[X86] Split test configurations. NFC.

Split test that includes reproducer for pr32967 to KNL and SKX.

llvm-svn: 302442

7 years agoSimplify orphan section positioning.
Rafael Espindola [Mon, 8 May 2017 16:49:20 +0000 (16:49 +0000)]
Simplify orphan section positioning.

The code following this one already considers every possible insertion
point for orphan sections, there is no point in sorting them before.

llvm-svn: 302441

7 years ago[AST] Fix copy&paste error in comment. NFC.
Malcolm Parsons [Mon, 8 May 2017 16:43:29 +0000 (16:43 +0000)]
[AST] Fix copy&paste error in comment. NFC.

llvm-svn: 302440

7 years ago[InstSimplify] fix typo; NFC
Sanjay Patel [Mon, 8 May 2017 16:35:02 +0000 (16:35 +0000)]
[InstSimplify] fix typo; NFC

llvm-svn: 302439

7 years ago[InstCombine] use local variable to reduce code duplication; NFCI
Sanjay Patel [Mon, 8 May 2017 16:33:42 +0000 (16:33 +0000)]
[InstCombine] use local variable to reduce code duplication; NFCI

llvm-svn: 302438

7 years ago[ValueTracking] Introduce a version of computeKnownBits that returns a KnownBits...
Craig Topper [Mon, 8 May 2017 16:22:48 +0000 (16:22 +0000)]
[ValueTracking] Introduce a version of computeKnownBits that returns a KnownBits struct. Begin using it to replace internal usages of ComputeSignBit

This introduces a new interface for computeKnownBits that returns the KnownBits object instead of requiring it to be pre-constructed and passed in by reference.

This is a much more convenient interface as it doesn't require the caller to figure out the BitWidth to pre-construct the object. It's so convenient that I believe we can use this interface to remove the special ComputeSignBit flavor of computeKnownBits.

As a step towards that idea, this patch replaces all of the internal usages of ComputeSignBit with this new interface. As you can see from the patch there were a couple places where we called ComputeSignBit which really called computeKnownBits, and then called computeKnownBits again directly. I've reduced those places to only making one call to computeKnownBits. I bet there are probably external users that do it too.

A future patch will update the external users and remove the ComputeSignBit interface. I'll also working on moving more locations to the KnownBits returning interface for computeKnownBits.

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

llvm-svn: 302437

7 years ago[InstCombine/InstSimplify] add comments about code duplication; NFC
Sanjay Patel [Mon, 8 May 2017 16:21:55 +0000 (16:21 +0000)]
[InstCombine/InstSimplify] add comments about code duplication; NFC

llvm-svn: 302436

7 years ago[Sema] Fix typos handling in an overloadable call.
Anastasia Stulova [Mon, 8 May 2017 16:05:54 +0000 (16:05 +0000)]
[Sema] Fix typos handling in an overloadable call.

In C typos in arguments in a call of an overloadable function lead
to a failure of construction of CallExpr and following recovery does
not handle created delayed typos. This causes an assertion fail in
Sema::~Sema since Sema::DelayedTypos remains not empty.

The patch fixes that behavior by handling a call with arguments
having dependant types in the way that C++ does.

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

Patch by Dmitry Borisenkov!

llvm-svn: 302435

7 years ago[InstCombine] add another test for PR32949; NFC
Sanjay Patel [Mon, 8 May 2017 15:58:57 +0000 (15:58 +0000)]
[InstCombine] add another test for PR32949; NFC

A patch for the InstSimplify variant of this bug is up for review here:
https://reviews.llvm.org/D32954

llvm-svn: 302434

7 years agoInstructionSimplify: Refactor foldIdentityShuffles. NFC.
Zvi Rackover [Mon, 8 May 2017 15:46:58 +0000 (15:46 +0000)]
InstructionSimplify: Refactor foldIdentityShuffles. NFC.

Summary:
Minor refactoring of foldIdentityShuffles() which allows the removal of a
ConstantDataVector::get() in SimplifyShuffleVectorInstruction.

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

Conflicts:
lib/Analysis/InstructionSimplify.cpp

llvm-svn: 302433

7 years agoFix comment typos.
Geoff Berry [Mon, 8 May 2017 15:33:08 +0000 (15:33 +0000)]
Fix comment typos.

llvm-svn: 302432

7 years ago[clang-tidy] Fix readability-implicit-bool-cast false positives
Alexander Kornienko [Mon, 8 May 2017 15:22:09 +0000 (15:22 +0000)]
[clang-tidy] Fix readability-implicit-bool-cast false positives

The patch makes the check treat binary conditional operator (`x ?: y`), `while`
and regular `for` loops as conditional statements for the purpose of
AllowConditional*Cast options.

llvm-svn: 302431

7 years ago[powerpc] Remove XFAIL for sanitizer_coverage_no_prune.cc on powerpc64
Bill Seurer [Mon, 8 May 2017 15:17:43 +0000 (15:17 +0000)]
[powerpc] Remove XFAIL for sanitizer_coverage_no_prune.cc on powerpc64

This test case works fine on powerpc64 (both BE and LE).

llvm-svn: 302430

7 years agoclang-tidy: add IgnoreMacros option to modernize-use-default-member-init
Miklos Vajna [Mon, 8 May 2017 15:13:31 +0000 (15:13 +0000)]
clang-tidy: add IgnoreMacros option to modernize-use-default-member-init

Summary:
And also enable it by default to be consistent with e.g.
modernize-use-using.

This helps e.g. when running this check on cppunit client code where the
macro is provided by the system, so there is no easy way to modify it.

Reviewers: alexfh, malcolm.parsons

Reviewed By: malcolm.parsons

Subscribers: cfe-commits

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

llvm-svn: 302429

7 years ago[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
Daniel Jasper [Mon, 8 May 2017 15:08:00 +0000 (15:08 +0000)]
[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, with options Left (prev.
true), Right (prev. false), and a new option DontAlign.

When set to DontAlign, the backslashes are placed just after the last token in each line:
  #define EXAMPLE \
    do { \
        int x = aaaaa; \
        int b; \
        int dddddddddd; \
    } while (0)

Patch by jtbandes. Thank you!

llvm-svn: 302428

7 years ago[clang-format] Don’t propagate AvoidBinPacking into argument
Daniel Jasper [Mon, 8 May 2017 15:07:52 +0000 (15:07 +0000)]
[clang-format] Don’t propagate AvoidBinPacking into argument
subexpressions

This is an attempt to fix the issue described in a recent email:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053632.html

Patch by jtbandes. Thank you!
Review: https://reviews.llvm.org/D32475

llvm-svn: 302427

7 years agoAdding reproducer for pr32967. NFC.
Zvi Rackover [Mon, 8 May 2017 14:47:32 +0000 (14:47 +0000)]
Adding reproducer for pr32967. NFC.

llvm-svn: 302426

7 years ago[clang-tidy] Ignore private =deleted methods in macros.
Alexander Kornienko [Mon, 8 May 2017 14:17:27 +0000 (14:17 +0000)]
[clang-tidy] Ignore private =deleted methods in macros.

modernize-use-equals-delete is extremely noisy in code using
DISALLOW_COPY_AND_ASSIGN-style macros and there's no easy way to automatically
fix the warning when macros are in play.

llvm-svn: 302425

7 years ago[X86][SSE] Improve combineLogicBlendIntoPBLENDV to use general masks.
Simon Pilgrim [Mon, 8 May 2017 14:16:39 +0000 (14:16 +0000)]
[X86][SSE] Improve combineLogicBlendIntoPBLENDV to use general masks.

Currently combineLogicBlendIntoPBLENDV can only match ASHR to detect sign splatting of a bit mask, this patch generalises this to use computeNumSignBits instead.

This is a first step in several things we can do to improve PBLENDV support:

 * Better matching of X86ISD::ANDNP patterns.
 * Handle floating point cases.
 * Better vector and bitcast support in computeNumSignBits.
 * Recognise that PBLENDV only uses the sign bit of the mask, we should be able strip away sign splats (ASHR, PCMPGT isNeg tests etc.).

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

llvm-svn: 302424

7 years ago[Polly][GPUJIT] Fixed OpenCL 2.0 min requirement for Error codes
Siddharth Bhat [Mon, 8 May 2017 14:10:37 +0000 (14:10 +0000)]
[Polly][GPUJIT] Fixed OpenCL 2.0 min requirement for Error codes

Summary: Removed OpenCL error code identifiers introduced in version 2.0.

Reviewers: grosser, bollu

Reviewed By: bollu

Subscribers: yaxunl, Anastasia, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 302423

7 years agoNormalize line endings. NFCI,
Simon Pilgrim [Mon, 8 May 2017 13:32:34 +0000 (13:32 +0000)]
Normalize line endings. NFCI,

llvm-svn: 302422

7 years agoFix Windows tests when __config_site is present.
Ben Craig [Mon, 8 May 2017 13:15:22 +0000 (13:15 +0000)]
Fix Windows tests when __config_site is present.
Previously, the force includes would complain about a missing _DEBUG symbol.
Now we dump macros before adding the force includes to the command line.

llvm-svn: 302421

7 years agoIR: Add a shufflevector mask commutation helper function. NFC.
Zvi Rackover [Mon, 8 May 2017 12:40:18 +0000 (12:40 +0000)]
IR: Add a shufflevector mask commutation helper function. NFC.

Summary:
Following up on Sanjay's suggetion in D32955, move this functionality
into ShuffleVectornstruction.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 302420

7 years agoCorrect the attribute spelling for guarded_var and pt_guarded_var.
Aaron Ballman [Mon, 8 May 2017 12:39:17 +0000 (12:39 +0000)]
Correct the attribute spelling for guarded_var and pt_guarded_var.

Patch by Roman Lebedev.

llvm-svn: 302419

7 years ago[X86][LWP] Add clang support for LWP instructions.
Simon Pilgrim [Mon, 8 May 2017 12:09:45 +0000 (12:09 +0000)]
[X86][LWP] Add clang support for LWP instructions.

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

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

llvm-svn: 302418

7 years ago[ARM][NEON] Add support for ISD::ABS lowering
Simon Pilgrim [Mon, 8 May 2017 10:37:34 +0000 (10:37 +0000)]
[ARM][NEON] Add support for ISD::ABS lowering

Update NEON int_arm_neon_vabs intrinsic to use the ISD::ABS opcode directly

Added constant folding tests.

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

llvm-svn: 302417

7 years ago[ARM] Clear the constant pool cache on explicit .ltorg directives
Martin Storsjo [Mon, 8 May 2017 10:26:24 +0000 (10:26 +0000)]
[ARM] Clear the constant pool cache on explicit .ltorg directives

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: 302416

7 years ago[AARCH64][NEON] Add support for ISD::ABS lowering
Simon Pilgrim [Mon, 8 May 2017 10:25:18 +0000 (10:25 +0000)]
[AARCH64][NEON] Add support for ISD::ABS lowering

Update int_aarch64_neon_abs intrinsic to use the ISD::ABS opcode directly

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

llvm-svn: 302415

7 years ago[ELF] - Set DF_STATIC_TLS flag for i386 target.
George Rimar [Mon, 8 May 2017 10:24:38 +0000 (10:24 +0000)]
[ELF] - Set DF_STATIC_TLS flag for i386 target.

This is PR32437.

DF_STATIC_TLS
If set in a shared object or executable, this flag instructs the
dynamic linker to reject attempts to load this file dynamically.
It indicates that the shared object or executable contains code
using a static thread-local storage scheme. Implementations need
not support any form of thread-local storage.

Patch checks if IE/LE relocations were used to check if code uses
static model. If so it sets the DF_STATIC_TLS flag.

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

llvm-svn: 302414

7 years ago[ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections.
George Rimar [Mon, 8 May 2017 10:18:12 +0000 (10:18 +0000)]
[ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections.

Previously it was impossible to use linkerscript with --compress-debug-sections
because of assert failture:
Assertion failed: isFinalized(), file C:\llvm\lib\MC\StringTableBuilder.cpp, line 64

Patch fixes the issue

llvm-svn: 302413

7 years ago[GlobalISel][X86] G_GEP selection support.
Igor Breger [Mon, 8 May 2017 09:40:43 +0000 (09:40 +0000)]
[GlobalISel][X86] G_GEP selection support.

Summary: [GlobalISel][X86] G_GEP selection support.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

llvm-svn: 302412

7 years ago[OpenCL] Check that global samplers are const
Sven van Haastregt [Mon, 8 May 2017 09:29:06 +0000 (09:29 +0000)]
[OpenCL] Check that global samplers are const

Patch by Simon Perretta.

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

llvm-svn: 302411

7 years ago[GlobalISel][X86] G_MUL legalizer/selector support.
Igor Breger [Mon, 8 May 2017 09:03:37 +0000 (09:03 +0000)]
[GlobalISel][X86] G_MUL legalizer/selector support.

Summary:
G_MUL legalizer/selector/regbank support.
Use only Tablegen-erated instruction selection.
This patch dealing with legal operations only.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: krytarowski, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 302410

7 years ago[Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows.
Andrew Ng [Mon, 8 May 2017 08:55:38 +0000 (08:55 +0000)]
[Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows.

This patch propogates the environment variable SYSTEMDRIVE on Windows when
running the unit tests. This prevents the creation of a directory named
"%SystemDrive%" when running the unit tests from FileSystemTest that use the
function llvm::sys::fs::remove_directories which in turn uses SHFileOperationW.
It is within SHFileOperationW that this environment variable may be used and if
undefined causes the creation of a "%SystemDrive%" directory in the current
directory.

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

llvm-svn: 302409

7 years ago[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the...
Craig Topper [Mon, 8 May 2017 06:34:41 +0000 (06:34 +0000)]
[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the earlier loop. NFC

The value of 'i' is always the smaller of DstParts and SrcParts so we can just use that fact to write all the code in terms of SrcParts and DstParts.

llvm-svn: 302408

7 years ago[APInt] Use std::min instead of writing the same thing with the ternary operator...
Craig Topper [Mon, 8 May 2017 06:34:39 +0000 (06:34 +0000)]
[APInt] Use std::min instead of writing the same thing with the ternary operator. NFC

llvm-svn: 302407

7 years ago[APInt] Remove 'else' after 'return' in tcMultiply methods. NFC
Craig Topper [Mon, 8 May 2017 06:34:36 +0000 (06:34 +0000)]
[APInt] Remove 'else' after 'return' in tcMultiply methods. NFC

llvm-svn: 302406

7 years ago[XRay] Custom event logging intrinsic
Dean Michael Berris [Mon, 8 May 2017 05:45:21 +0000 (05:45 +0000)]
[XRay] Custom event logging intrinsic

This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.

Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.

Reviewers: timshen, dberris

Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits

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

llvm-svn: 302405

7 years ago[SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a constant.
Craig Topper [Mon, 8 May 2017 04:55:13 +0000 (04:55 +0000)]
[SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a constant.

llvm-svn: 302404

7 years ago[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.
Craig Topper [Mon, 8 May 2017 04:55:12 +0000 (04:55 +0000)]
[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.

llvm-svn: 302403

7 years ago[APInt] Add support for multiplying by a uint64_t.
Craig Topper [Mon, 8 May 2017 04:55:09 +0000 (04:55 +0000)]
[APInt] Add support for multiplying by a uint64_t.

This makes multiply similar to add, sub, xor, and, and or.

llvm-svn: 302402

7 years agoHopefully one last commit to fix this patch, addresses string reference
Eric Beckmann [Mon, 8 May 2017 02:47:42 +0000 (02:47 +0000)]
Hopefully one last commit to fix this patch, addresses string reference
issues.

llvm-svn: 302401

7 years agoQuick fix to D32609, it seems .o files are not transferred in all cases.
Eric Beckmann [Mon, 8 May 2017 02:47:25 +0000 (02:47 +0000)]
Quick fix to D32609, it seems .o files are not transferred in all cases.

Therefore the .o file in question is renamed to .obj.coff.

llvm-svn: 302400

7 years agoUpdate llvm-readobj -coff-resources to display tree structure.
Eric Beckmann [Mon, 8 May 2017 02:47:07 +0000 (02:47 +0000)]
Update llvm-readobj -coff-resources to display tree structure.

Summary: Continue making updates to llvm-readobj to display resource sections.  This is necessary for testing the up and coming cvtres tool.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302399

7 years ago[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid...
Craig Topper [Mon, 8 May 2017 02:29:15 +0000 (02:29 +0000)]
[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid a copy in many of the cases.

llvm-svn: 302398

7 years agoRevert "Hopefully one last commit to fix this patch, addresses string reference"
Eric Beckmann [Mon, 8 May 2017 02:25:03 +0000 (02:25 +0000)]
Revert "Hopefully one last commit to fix this patch, addresses string reference"

Summary:
This reverts commit 56beec1b1cfc6d263e5eddb7efff06117c0724d2.

Revert "Quick fix to D32609, it seems .o files are not transferred in all cases."

This reverts commit 7652eecd29cfdeeab7f76f687586607a99ff4e36.

Revert "Update llvm-readobj -coff-resources to display tree structure."

This reverts commit 422b62c4d302cfc92401418c2acd165056081ed7.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302397

7 years agoFix Windows locale detection
Eric Fiselier [Mon, 8 May 2017 02:09:48 +0000 (02:09 +0000)]
Fix Windows locale detection

llvm-svn: 302396

7 years agoHopefully one last commit to fix this patch, addresses string reference
Eric Beckmann [Mon, 8 May 2017 01:48:55 +0000 (01:48 +0000)]
Hopefully one last commit to fix this patch, addresses string reference
issues.

llvm-svn: 302395

7 years agoFix shared_mutex dll import errors on Windows
Eric Fiselier [Mon, 8 May 2017 01:31:50 +0000 (01:31 +0000)]
Fix shared_mutex dll import errors on Windows

llvm-svn: 302394

7 years ago[libc++] Implement exception_ptr on Windows
Eric Fiselier [Mon, 8 May 2017 01:17:50 +0000 (01:17 +0000)]
[libc++] Implement exception_ptr on Windows

Summary:
This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC.

The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well.

Note there are still 2 outstanding exception_ptr/nested_exception test failures.

* `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time.
* `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion.

This patch also gets most of the `<future>` tests passing as well.

Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT

Subscribers: mgorny, cfe-commits

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

llvm-svn: 302393

7 years ago[XRay][compiler-rt] XFAIL on ppc
Dean Michael Berris [Mon, 8 May 2017 00:38:13 +0000 (00:38 +0000)]
[XRay][compiler-rt] XFAIL on ppc

Follow-up on D32846.

llvm-svn: 302392

7 years agoFix DLL import/export on Win32 locale helpers
Eric Fiselier [Mon, 8 May 2017 00:37:31 +0000 (00:37 +0000)]
Fix DLL import/export on Win32 locale helpers

llvm-svn: 302391