platform/upstream/llvm.git
6 years ago[ARM] Add 'fillValidCPUArchList' to ARM targets
Erich Keane [Thu, 8 Feb 2018 16:48:54 +0000 (16:48 +0000)]
[ARM] Add 'fillValidCPUArchList' to ARM targets

This is a support change for a CFE change (https://reviews.llvm.org/D42978)
that allows march and -target-cpu to list the valid targets in a note. The changes
are limited to the ARM/AArch64, since this is the only target that gets the CPU
list from LLVM.

llvm-svn: 324623

6 years ago[dsymutil] Use llvm::sys::path to join bundle path.
Jonas Devlieghere [Thu, 8 Feb 2018 16:31:42 +0000 (16:31 +0000)]
[dsymutil] Use llvm::sys::path to join bundle path.

When processing a dSYM bundle, use llvm::sys::path to join the different
path components instead of using a string with hard coded forward
slashes as separators.

llvm-svn: 324622

6 years ago[dwarfdump] Normalize input path.
Jonas Devlieghere [Thu, 8 Feb 2018 16:31:01 +0000 (16:31 +0000)]
[dwarfdump] Normalize input path.

Before this patch, llvm-dwarfdump would reject `bundel.dSYM/` as input,
while `bundel.dSYM` was accepted. The reason is that `path::extension()`
returns an empty string for the former, leading to the argument not
being recognized as a dSYM bundle.

llvm-svn: 324621

6 years ago[scudo] Allow options to be defined at compile time
Kostya Kortchinsky [Thu, 8 Feb 2018 16:29:48 +0000 (16:29 +0000)]
[scudo] Allow options to be defined at compile time

Summary:
Allow for options to be defined at compile time, like is already the case for
other sanitizers, via `SCUDO_DEFAULT_OPTIONS`.

Reviewers: alekseyshl, dberris

Reviewed By: alekseyshl, dberris

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 324620

6 years agoClean up string's deduction guides tests. Mark old versions of clang as unsupported...
Marshall Clow [Thu, 8 Feb 2018 16:25:57 +0000 (16:25 +0000)]
Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode

llvm-svn: 324619

6 years ago[clang-format] Do not break Objective-C string literals inside array literals
Ben Hamilton [Thu, 8 Feb 2018 16:07:25 +0000 (16:07 +0000)]
[clang-format] Do not break Objective-C string literals inside array literals

Summary:
Concatenating Objective-C string literals inside an array literal
raises the warning -Wobjc-string-concatenation (which is enabled by default).

clang-format currently splits and concatenates string literals like
the following:

  NSArray *myArray = @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ];

into:

  NSArray *myArray =
        @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
           @"aaaaaaaaa" ];

which raises the warning. This is https://bugs.llvm.org/show_bug.cgi?id=36153 .

The options I can think of to fix this are:

1) Have clang-format disable Wobjc-string-concatenation by emitting
pragmas around the formatted code
2) Have clang-format wrap the string literals in a macro (which
disables the warning)
3) Disable string splitting for Objective-C string literals inside
array literals

I think 1) has no precedent, and I couldn't find a good
identity() macro for 2). So, this diff implements 3).

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, stephanemoore, djasper

Reviewed By: jolesiak

Subscribers: klimek, cfe-commits

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

llvm-svn: 324618

6 years ago[AMDGPU] Updae documentation about address space
Yaxun Liu [Thu, 8 Feb 2018 15:41:19 +0000 (15:41 +0000)]
[AMDGPU] Updae documentation about address space

llvm-svn: 324617

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:32:28 +0000 (15:32 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324616

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:30:39 +0000 (15:30 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324615

6 years ago[SLPVectorizer] move RUN line to top-of-file; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:28:49 +0000 (15:28 +0000)]
[SLPVectorizer] move RUN line to top-of-file; NFC

I was confused what we were checking because the RUN line was
in the middle of the file.

llvm-svn: 324614

6 years ago[InstCombine] Fix issue with X udiv (POW2_C1 << N) for non-splat constant vectors
Simon Pilgrim [Thu, 8 Feb 2018 15:19:38 +0000 (15:19 +0000)]
[InstCombine] Fix issue with X udiv (POW2_C1 << N) for non-splat constant vectors

foldUDivShl was assuming that the input was a scalar or a splat constant

llvm-svn: 324613

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:16:26 +0000 (15:16 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324612

6 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:13:47 +0000 (15:13 +0000)]
[LoopVectorize] auto-generate complete checks; NFC

llvm-svn: 324611

6 years ago[ValueTracking] don't crash when assumptions conflict (PR36270)
Sanjay Patel [Thu, 8 Feb 2018 14:52:40 +0000 (14:52 +0000)]
[ValueTracking] don't crash when assumptions conflict (PR36270)

The last assume in the test says that %B12 is 0.
The first assume says that %and1 is less than %B12.
Therefore, %and1 is unsigned less than 0...does not compute.

That means this line:
Known.Zero.setHighBits(RHSKnown.countMinLeadingZeros() + 1);
...tries to set more bits than exist.

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

llvm-svn: 324610

6 years agoUpdate the status of removed components
Marshall Clow [Thu, 8 Feb 2018 14:51:22 +0000 (14:51 +0000)]
Update the status of removed components

llvm-svn: 324609

6 years ago[InstCombine] Fix issue with X udiv 2^C -> X >> C for non-splat constant vectors
Simon Pilgrim [Thu, 8 Feb 2018 14:46:10 +0000 (14:46 +0000)]
[InstCombine] Fix issue with X udiv 2^C -> X >> C for non-splat constant vectors

foldUDivPow2Cst was assuming that the input was a scalar or a splat constant

llvm-svn: 324608

6 years ago[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo
Jan Korous [Thu, 8 Feb 2018 14:37:58 +0000 (14:37 +0000)]
[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo

rdar://problem/10214588

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

llvm-svn: 324607

6 years ago[ARM] Re-commit r324600 with fixed LLVMBuild.txt
Oliver Stannard [Thu, 8 Feb 2018 14:31:22 +0000 (14:31 +0000)]
[ARM] Re-commit r324600 with fixed LLVMBuild.txt

ARMDisassembler now depends on the banked register tables in ARMUtils, so the
LLVMBuild.txt needed updating to reflect this.

Original commit mesage:

[ARM] Fix disassembly of invalid banked register moves

When disassembling banked register move instructions, we don't have an
assembly syntax for the unallocated register numbers, so we have to
return Fail rather than SoftFail. Previously we were returning SoftFail,
then crashing in the InstPrinter as we have no way to represent these
encodings in an assembly string.

This also switches the decoder to use the table-generated list of banked
registers, removing the duplicated list of encodings.

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

llvm-svn: 324606

6 years agoFix unused variable warning.
Simon Pilgrim [Thu, 8 Feb 2018 14:24:26 +0000 (14:24 +0000)]
Fix unused variable warning.

llvm-svn: 324605

6 years agoRevert r324600 as it breaks a buildbot
Oliver Stannard [Thu, 8 Feb 2018 14:21:28 +0000 (14:21 +0000)]
Revert r324600 as it breaks a buildbot

The broken bot (clang-ppc64le-linux-multistage) is doign a shared-object build,
so I guess using lookupBankedRegByEncoding in the disassembler is a layering
violation?

llvm-svn: 324604

6 years ago[InstCombine] Improve mul(x, pow2) -> shl combine for vector constants
Simon Pilgrim [Thu, 8 Feb 2018 14:10:01 +0000 (14:10 +0000)]
[InstCombine] Improve mul(x, pow2) -> shl combine for vector constants

Refactor getLogBase2Vector into getLogBase2 to accept all scalars/vectors. Generalize from ConstantDataVector to support all constant vectors.

llvm-svn: 324603

6 years ago[x86] Add test/CodeGen/X86/vmaskmov-offset.ll. NFC.
Alexander Ivchenko [Thu, 8 Feb 2018 13:16:42 +0000 (13:16 +0000)]
[x86] Add test/CodeGen/X86/vmaskmov-offset.ll. NFC.

Needed for checking current code generation.

llvm-svn: 324601

6 years ago[ARM] Fix disassembly of invalid banked register moves
Oliver Stannard [Thu, 8 Feb 2018 13:06:08 +0000 (13:06 +0000)]
[ARM] Fix disassembly of invalid banked register moves

When disassembling banked register move instructions, we don't have an
assembly syntax for the unallocated register numbers, so we have to
return Fail rather than SoftFail. Previously we were returning SoftFail,
then crashing in the InstPrinter as we have no way to represent these
encodings in an assembly string.

This also switches the decoder to use the table-generated list of banked
registers, removing the duplicated list of encodings.

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

llvm-svn: 324600

6 years ago[clangd] Update include guard in Annotations.h. NFC
Ilya Biryukov [Thu, 8 Feb 2018 12:46:34 +0000 (12:46 +0000)]
[clangd] Update include guard in Annotations.h. NFC

llvm-svn: 324599

6 years ago[test][dsymutil] Fix tests for Windows bots.
Jonas Devlieghere [Thu, 8 Feb 2018 11:58:16 +0000 (11:58 +0000)]
[test][dsymutil] Fix tests for Windows bots.

The UNSUPPORTED directive was not honored by the bot, presumably because
of the FIXME above it. This moves the comment down and removes the
remaining update check from basic-linking-x86.test.

This should un-break: llvm-clang-x86_64-expensive-checks-win/builds/7798/

llvm-svn: 324598

6 years agoAdd missed PostDominatorTree analysis dependency to GVN hoist pass.
Alexander Ivchenko [Thu, 8 Feb 2018 11:45:36 +0000 (11:45 +0000)]
Add missed PostDominatorTree analysis dependency to GVN hoist pass.

Summary:
GVN hoist pass is using PostDominatorTree analysis, therefore the analysis
should be listed in the pass initialization as a dependency.

Reviewed By: sebpop

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

Author: ashlykov <arkady.shlykov@intel.com>
llvm-svn: 324597

6 years ago[libcxx] Avoid spurious construction of valarray elements
Mikhail Maltsev [Thu, 8 Feb 2018 11:33:48 +0000 (11:33 +0000)]
[libcxx] Avoid spurious construction of valarray elements

Summary:
Currently libc++ implements some operations on valarray by using the
resize method. This method has a parameter with a default value.
Because of this, valarray may spuriously construct and destruct
objects of valarray's element type.

This patch fixes this issue and adds corresponding test cases.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: rogfer01, cfe-commits

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

llvm-svn: 324596

6 years ago[X86][MC]: Adding test coverage of MC encoding for several small extensions.<NFC>
Gadi Haber [Thu, 8 Feb 2018 11:16:02 +0000 (11:16 +0000)]
[X86][MC]: Adding test coverage of MC encoding for several small extensions.<NFC>

NFC.
 Adding MC regressions tests to cover several small x86 extensions as follows:
 CLWB, CLZERO, F16C, INVPCID, PKU, POPCNT, RTM, SGX, SHA, SVM, VMFUNC, VTX

This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952

Reviewers: RKSimon, craig.topper, zvi, AndreiGrischenko
Differential Revision: https://reviews.llvm.org/D41388

Change-Id: I254508cd17faca00b780be0fc2abf6c71b61faab
llvm-svn: 324595

6 years agoFix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.
Alexander Ivchenko [Thu, 8 Feb 2018 11:15:21 +0000 (11:15 +0000)]
Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.

Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.

Reviewed By: rnk (Reid Kleckner)

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

Author: belickim <mateusz.belicki@intel.com>
llvm-svn: 324594

6 years ago[builtins] Workaround for infinite recursion in c?zdi2
Jonas Devlieghere [Thu, 8 Feb 2018 11:14:11 +0000 (11:14 +0000)]
[builtins] Workaround for infinite recursion in c?zdi2

gcc resolves `__builtin_c?z` to `__c?zdi2` which leads to infinite
recursion. This problem has been observed for sparc64, mips64 and riscv.
Presumably this happens whenever an arch without dedicated bit counting
instructions is targeted. This patch provides a workaround.

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

llvm-svn: 324593

6 years agoRe-land [dsymutil] Upstream update feature
Jonas Devlieghere [Thu, 8 Feb 2018 10:48:54 +0000 (10:48 +0000)]
Re-land [dsymutil] Upstream update feature

This commit attempts to re-land the r324480 which was reverted in
r324493 because it broke the Windows bots. For now I disabled the two
update tests on Windows until I'm able to debug this.

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

llvm-svn: 324592

6 years ago[clang-format] Do not break before long string literals in protos
Krasimir Georgiev [Thu, 8 Feb 2018 10:47:12 +0000 (10:47 +0000)]
[clang-format] Do not break before long string literals in protos

Summary:
This patch is a follow-up to r323319 (which disables string literal breaking for
text protos) and it disables breaking before long string literals.

For example this:
```
keyyyyy: "long string literal"
```
used to get broken into:
```
keyyyyy:
    "long string literal"
```

While at it, I also enabled it for LK_Proto and fixed a bug in the mustBreak code.

Reviewers: djasper, sammccall

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 324591

6 years agoRewrite the flaky test_restart_bug test in a more deterministic way
Pavel Labath [Thu, 8 Feb 2018 10:37:23 +0000 (10:37 +0000)]
Rewrite the flaky test_restart_bug test in a more deterministic way

Summary:
The test was trying to reproduce a bug in handling of two concurrent
events, which was impossible to do reliably in a black-box style test.
In practice, this meant the test was only ever failing on remote
targets, as these were slow enough to trigger this.

Fortunately, we now have the ability to mock the server side of the
connection, which means we can simulate the failure deterministically,
so I rewrite the test to use the new gdb-client framework.

I've needed to add a couple of new packets to the mock server to be able
to do this. Instead of trying to guess how a "typical" gdb-client test
will want to handle this, I throw an exception in the implementation to
force the user to override them (the packets are only sent if the test
explicitly performs some action which will trigger them, so a basic test
which e.g. does not need the "continue" functionality will not need to
implement them).

Reviewers: owenpshaw

Subscribers: srhines, lldb-commits

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

llvm-svn: 324590

6 years ago[Loop Predication] Teach LP about reverse loops with uge and sge latch conditions
Serguei Katkov [Thu, 8 Feb 2018 10:34:08 +0000 (10:34 +0000)]
[Loop Predication] Teach LP about reverse loops with uge and sge latch conditions

Add support of uge and sge latch condition to Loop Prediction for
reverse loops.

Reviewers: apilipenko, mkazantsev, sanjoy, anna
Reviewed By: anna
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42837

llvm-svn: 324589

6 years ago[OMPT] Add tool_available_search testcase
Joachim Protze [Thu, 8 Feb 2018 10:04:33 +0000 (10:04 +0000)]
[OMPT] Add tool_available_search testcase

Tests the search for tools as defined in the spec. The OMP_TOOL_LIBRARIES
environment variable contains paths to the following files(in that order)

-to a nonexisting file
-to a shared library that does not have a ompt_start_tool function
-to a shared library that has an ompt_start_tool implementation returning NULL
-to a shared library that has an ompt_start_tool implementation returning a
    pointer to a valid instance of ompt_start_tool_result_t

The expected result is that the last tool gets active and can print in the
thread-begin callback.

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

llvm-svn: 324588

6 years ago[OMPT] Add tool_not_available testcase
Joachim Protze [Thu, 8 Feb 2018 10:04:28 +0000 (10:04 +0000)]
[OMPT] Add tool_not_available testcase

Add a testcase that checks wheter the runtime can handle an ompt_start_tool
method that returns NULL indicating that no tool shall be loaded.

All tool_available testcases need a separate folder to avoid file conflicts for
the generated tools.

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

llvm-svn: 324587

6 years ago[X86] Fix compilation of r324580.
Clement Courbet [Thu, 8 Feb 2018 09:41:50 +0000 (09:41 +0000)]
[X86] Fix compilation of r324580.

@ctopper Can you check that the fix is correct ?

llvm-svn: 324586

6 years agoRevert accidental changes that snuck in r324584
Stefan Maksimovic [Thu, 8 Feb 2018 09:31:48 +0000 (09:31 +0000)]
Revert accidental changes that snuck in r324584

llvm-svn: 324585

6 years ago[mips] Define certain instructions in microMIPS32r3
Stefan Maksimovic [Thu, 8 Feb 2018 09:25:17 +0000 (09:25 +0000)]
[mips] Define certain instructions in microMIPS32r3

Instructions affected:
mthc1, mfhc1, add.d, sub.d, mul.d, div.d,
mov.d, neg.d, cvt.w.d, cvt.d.s, cvt.d.w, cvt.s.d

These instructions are now defined for
microMIPS32r3 + microMIPS32r6 in MicroMipsInstrFPU.td
since they shared their encoding with those already defined
in microMIPS32r6InstrInfo.td and have been therefore
removed from the latter file.

Some instructions present in MicroMipsInstrFPU.td which
did not have both AFGR64 and FGR64 variants defined have
been altered to do so.

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

llvm-svn: 324584

6 years ago[AVR] Fix the testsuite after '%' changed to '$' in MIR
Dylan McKay [Thu, 8 Feb 2018 09:17:11 +0000 (09:17 +0000)]
[AVR] Fix the testsuite after '%' changed to '$' in MIR

llvm-svn: 324583

6 years ago[TargetSchedule] Expose sub-units of a ProcResGroup in MCProcResourceDesc.
Clement Courbet [Thu, 8 Feb 2018 08:46:48 +0000 (08:46 +0000)]
[TargetSchedule] Expose sub-units of a ProcResGroup in MCProcResourceDesc.

Summary:
Right now using a ProcResource automatically counts as usage of all
super ProcResGroups. All this is done during codegen, so there is no
way for schedulers to get this information at runtime.

This adds the information of which individual ProcRes units are
contained in a ProcResGroup in MCProcResourceDesc.

Reviewers: gchatelet

Subscribers: llvm-commits

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

llvm-svn: 324582

6 years ago[AArch64] Don't materialize 0 with "fmov h0, .." when FullFP16 is not supported
Sjoerd Meijer [Thu, 8 Feb 2018 08:39:05 +0000 (08:39 +0000)]
[AArch64] Don't materialize 0 with "fmov h0, .." when FullFP16 is not supported

We were generating "fmov h0, wzr" instructions when FullFP16 is not enabled.
I've not added any tests, because the problem was visible in:
test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll,
which I had to change: I don't think Cyclone has FullFP16 enabled
by default, so it shouldn't be using this v8.2a instruction.

I've also removed these rdar tags, please shout if there are any objections.

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

llvm-svn: 324581

6 years ago[X86] Support folding in a k-register OR when creating KORTEST from scalar compare...
Craig Topper [Thu, 8 Feb 2018 08:29:43 +0000 (08:29 +0000)]
[X86] Support folding in a k-register OR when creating KORTEST from scalar compare of a bitcast from vXi1.

This should allow us to remove the kortest intrinsic from IR and use compare+bitcast+or in IR instead.

llvm-svn: 324580

6 years ago[X86] Allow KORTEST instruction to be used for testing if a mask is all ones
Craig Topper [Thu, 8 Feb 2018 07:54:16 +0000 (07:54 +0000)]
[X86] Allow KORTEST instruction to be used for testing if a mask is all ones

The KTEST instruction sets the C flag if the result of anding both operands together is all 1s. We can use this to lower (icmp eq/ne (bitcast (vXi1 X), -1)

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

llvm-svn: 324577

6 years ago[X86] Don't emit KTEST instructions unless only the Z flag is being used
Craig Topper [Thu, 8 Feb 2018 07:45:55 +0000 (07:45 +0000)]
[X86] Don't emit KTEST instructions unless only the Z flag is being used

Summary:
KTEST has weird flag behavior. The Z flag is set for all bits in the AND of the k-registers being 0, and the C flag is set for all bits being 1. All other flags are cleared.

We currently emit this instruction in EmitTEST and don't check the condition code. This can lead to strange things like using the S flag after a KTEST for a signed compare.

The domain reassignment pass can also transform TEST instructions into KTEST and is not protected against the flag usage either. For now I've disabled this part of the domain reassignment pass. I tried to comment out the checks in the mir test so that we could recover them later, but I couldn't figure out how to get that to work.

This patch moves the KTEST handling into LowerSETCC and now creates a ktest+x86setcc. I've chosen this approach because I'd like to add support for the C flag for all ones in a followup patch. To do that requires that I can rewrite the condition code going in the x86setcc to be different than the original SETCC condition code.

This fixes PR36182. I'll file a PR to fix domain reassignment once this goes in. Should this be merged to 6.0?

Reviewers: spatel, guyblank, RKSimon, zvi

Reviewed By: guyblank

Subscribers: llvm-commits

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

llvm-svn: 324576

6 years agoResubmit "[clangd] The new threading implementation"
Ilya Biryukov [Thu, 8 Feb 2018 07:37:35 +0000 (07:37 +0000)]
Resubmit "[clangd] The new threading implementation"

Initially submitted as r324356 and reverted in r324386.

This change additionally contains a fix to crashes of the buildbots.
The source of the crash was undefined behaviour caused by
std::future<> whose std::promise<> was destroyed without calling
set_value().

llvm-svn: 324575

6 years agoRecommit r324455 "[ThinLTO] - Simplify code in ThinLTOBitcodeWriter."
George Rimar [Thu, 8 Feb 2018 07:23:24 +0000 (07:23 +0000)]
Recommit r324455 "[ThinLTO] - Simplify code in ThinLTOBitcodeWriter."

With fix: reimplemented.

Original commit message:
Recently introduced convertToDeclaration is very similar
to code used in filterModule function.
Patch reuses it to reduce duplication.

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

llvm-svn: 324574

6 years agoTemporarily comment out deduction guide tests while I figure out what to do with...
Marshall Clow [Thu, 8 Feb 2018 07:20:45 +0000 (07:20 +0000)]
Temporarily comment out deduction guide tests while I figure out what to do with old bots

llvm-svn: 324573

6 years ago[SimplifyCFG] Re-apply Relax restriction for folding unconditional branches
Serguei Katkov [Thu, 8 Feb 2018 07:16:29 +0000 (07:16 +0000)]
[SimplifyCFG] Re-apply Relax restriction for folding unconditional branches

The commit rL308422 introduces a restriction for folding unconditional
branches. Specifically if empty block with unconditional branch leads to
header of the loop then elimination of this basic block is prohibited.
However it seems this condition is redundantly strict.
If elimination of this basic block does not introduce more back edges
then we can eliminate this block.

The patch implements this relax of restriction.

The test profile/Linux/counter_promo_nest.c in compiler-rt project
is updated to meet this change.

Reviewers: efriedma, mcrosier, pacxx, hsung, davidxl
Reviewed By: pacxx
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42691

llvm-svn: 324572

6 years agoUpdate test counter_promo_nest.c to meet llvm change
Serguei Katkov [Thu, 8 Feb 2018 07:15:49 +0000 (07:15 +0000)]
Update test counter_promo_nest.c to meet llvm change

The test expects to see the pattern "load add store" twice
in a row.

However the test contains actually several instances of this pattern.
Currently the first pattern appears in the output twice.

But after LLVM change https://reviews.llvm.org/D42691 some addtional
modification is done and one of another pattern has been hoisted in
function entry block.

As a result we have another order of meeting this pattern.
The test is updated to meet this change.

llvm-svn: 324571

6 years agoCMAKE: apply -O3 for mingw clang
Martell Malone [Thu, 8 Feb 2018 07:13:17 +0000 (07:13 +0000)]
CMAKE: apply -O3 for mingw clang

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

llvm-svn: 324570

6 years agoImplement deduction guide for basic_string as described in P0433
Marshall Clow [Thu, 8 Feb 2018 06:34:03 +0000 (06:34 +0000)]
Implement deduction guide for basic_string as described in P0433

llvm-svn: 324569

6 years ago[DAGCombiner] Fix a couple mistakes from r324311 by really passing the original load...
Craig Topper [Thu, 8 Feb 2018 06:27:18 +0000 (06:27 +0000)]
[DAGCombiner] Fix a couple mistakes from r324311 by really passing the original load to ExtendSetCCUses.

We're passing the binary op that uses the load instead of the load.

Noticed by inspection. Not sure how to test this because this just prevents the introduction of an extend that will later be truncated and will probably be combined out.

llvm-svn: 324568

6 years ago[DAGCombiner] Don't create truncate nodes in (aext (zextload x)) -> (zextload x)...
Craig Topper [Thu, 8 Feb 2018 06:04:18 +0000 (06:04 +0000)]
[DAGCombiner] Don't create truncate nodes in (aext (zextload x)) -> (zextload x) and similar folds. NFCI

The truncate is being used to replace other users of of the load, but we checked that the load only has one use so there are no other uses to replace.

llvm-svn: 324567

6 years agoImprove a test. NFC
Marshall Clow [Thu, 8 Feb 2018 05:47:40 +0000 (05:47 +0000)]
Improve a test. NFC

llvm-svn: 324566

6 years agoARM: Remove dead code. NFCI.
Peter Collingbourne [Thu, 8 Feb 2018 05:28:39 +0000 (05:28 +0000)]
ARM: Remove dead code. NFCI.

llvm-svn: 324565

6 years ago[docs] Update docs for cmake options LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER
Aaron Smith [Thu, 8 Feb 2018 05:11:17 +0000 (05:11 +0000)]
[docs] Update docs for cmake options LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER

Summary:
LLDB_TEST_COMPILER is not a valid option for CMake for LLDB. There are instead two properties LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. Update the documents accordingly to reflect the correct information.

Reviewers: zturner, lldb-commits

Subscribers: llvm-commits

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

llvm-svn: 324564

6 years ago[CodeGen] Print MachineBasicBlock labels using MIR syntax in -debug output
Francis Visoiu Mistrih [Thu, 8 Feb 2018 05:02:00 +0000 (05:02 +0000)]
[CodeGen] Print MachineBasicBlock labels using MIR syntax in -debug output

Instead of:

%bb.1: derived from LLVM BB %for.body

print:

bb.1.for.body:

Also use MIR syntax for MBB attributes like "align", "landing-pad", etc.

llvm-svn: 324563

6 years ago[DAGCombiner] Avoid creating truncate nodes in (zext (and (load)))->(and (zextload...
Craig Topper [Thu, 8 Feb 2018 04:38:04 +0000 (04:38 +0000)]
[DAGCombiner] Avoid creating truncate nodes in (zext (and (load)))->(and (zextload)) fold until we know for sure we're going to need it. NFCI

The truncate is only needed if the load has additional users. It used to get passed to extendSetCCUses so was created early, but that's no longer the case.

llvm-svn: 324562

6 years ago[DAGCombiner] Rename variable to be slightly better. NFC
Craig Topper [Thu, 8 Feb 2018 04:38:02 +0000 (04:38 +0000)]
[DAGCombiner] Rename variable to be slightly better. NFC

We were calling a load LN0 but it came from N0.getOperand(0) so its really more like LN00 if we follow the name used in other places.

llvm-svn: 324561

6 years agobpf: Improve expanding logic in LowerSELECT_CC
Yonghong Song [Thu, 8 Feb 2018 04:37:49 +0000 (04:37 +0000)]
bpf: Improve expanding logic in LowerSELECT_CC

LowerSELECT_CC is not generating optimal Select_Ri pattern at the moment. It
is not guaranteed to place ConstantNode at RHS which would miss matching
Select_Ri.

A new testcase added into the existing select_ri.ll, also there is an
existing case in cmp.ll which would be improved to use Select_Ri after this
patch, it is adjusted accordingly.

Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
llvm-svn: 324560

6 years agoSymbols defined in linker scripts should not have dso_local flag set in LTO resolutions.
Dmitry Mikulin [Thu, 8 Feb 2018 04:25:52 +0000 (04:25 +0000)]
Symbols defined in linker scripts should not have dso_local flag set in LTO resolutions.

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

llvm-svn: 324559

6 years agoDeactivate TestTargetSymbolsBuildidCase if host is windows
Eugene Zemtsov [Thu, 8 Feb 2018 03:05:47 +0000 (03:05 +0000)]
Deactivate TestTargetSymbolsBuildidCase if host is windows

Makefile has unix magic and thus not working on windows.

llvm-svn: 324558

6 years agogold-plugin: Do not set codegen opt level based on LTO opt level.
Peter Collingbourne [Thu, 8 Feb 2018 02:41:22 +0000 (02:41 +0000)]
gold-plugin: Do not set codegen opt level based on LTO opt level.

The LTO opt level should not affect the codegen opt level, and indeed
it does not affect it in lld. Ideally the codegen opt level should
be controlled by an IR-level attribute based on the compile-time opt
level, but that hasn't been implemented yet.

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

llvm-svn: 324557

6 years agoAdd space inside the regular expression.
Rafael Espindola [Thu, 8 Feb 2018 02:29:56 +0000 (02:29 +0000)]
Add space inside the regular expression.

This should now pass on both ppc and x86. Sorry about the noise.

llvm-svn: 324556

6 years agoAdd CMAKE_CFG_INTDIR as part of the include path for the default test compiler.
Aaron Smith [Thu, 8 Feb 2018 02:13:48 +0000 (02:13 +0000)]
Add CMAKE_CFG_INTDIR as part of the include path for the default test compiler.

Summary:
This is a small change towards running the LLDB unit tests on Windows (still WIP).

Builds that use make do not point to specific configurations. However, builds with multiple configurations such as Visual Studio on Windows need the configuration (release/debug/etc) as part of the path so the binaries produced by clang are placed in the correct directory for the configuration.

Reviewers: zturner, lldb-commits, labath

Reviewed By: labath

Subscribers: labath, mgorny, hintonda, llvm-commits

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

llvm-svn: 324555

6 years agoAMDGPU: Fix incorrect reordering when inline asm defines LDS address
Matt Arsenault [Thu, 8 Feb 2018 01:56:14 +0000 (01:56 +0000)]
AMDGPU: Fix incorrect reordering when inline asm defines LDS address

Defs of operands outside of the instruction's explicit defs need
to be checked.

llvm-svn: 324554

6 years ago[clang-format] Set ObjCBinPackProtocolList to Never for google style
Ben Hamilton [Thu, 8 Feb 2018 01:49:10 +0000 (01:49 +0000)]
[clang-format] Set ObjCBinPackProtocolList to Never for google style

Summary:
This is split off from D42650, and sets ObjCBinPackProtocolList
to Never for the google style.

Depends On D42650

Test Plan: New tests added. make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, jolesiak, stephanemoore

Reviewed By: krasimir, jolesiak, stephanemoore

Subscribers: klimek, cfe-commits, hokein, Wizard

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

llvm-svn: 324553

6 years agoAdd a testcase for PR36268.
Rafael Espindola [Thu, 8 Feb 2018 01:17:26 +0000 (01:17 +0000)]
Add a testcase for PR36268.

llvm-svn: 324552

6 years agoFix PR36268.
Rafael Espindola [Thu, 8 Feb 2018 01:16:05 +0000 (01:16 +0000)]
Fix PR36268.

The issue is that clang was first creating a extern_weak hidden GV and
then changing the linkage to external.

Once we know it is not extern_weak we know it must be dso_local.

This patch refactors the code that sets the implicit dso_local to a
helper private function that is used every time we change the linkage
or visibility.

I will commit a patch to clang in a minute.

llvm-svn: 324551

6 years agoAMDGPU: Don't crash when trying to fold implicit operands
Matt Arsenault [Thu, 8 Feb 2018 01:12:46 +0000 (01:12 +0000)]
AMDGPU: Don't crash when trying to fold implicit operands

llvm-svn: 324550

6 years ago[NVPTX] When dying due to a bad address space value, print out the value.
Justin Lebar [Thu, 8 Feb 2018 00:50:04 +0000 (00:50 +0000)]
[NVPTX] When dying due to a bad address space value, print out the value.

llvm-svn: 324549

6 years agoRemove extra space.
Rafael Espindola [Thu, 8 Feb 2018 00:39:19 +0000 (00:39 +0000)]
Remove extra space.

Should fix the ppc bots.

llvm-svn: 324548

6 years ago[AMDGPU] Fixed wait count reuse
Stanislav Mekhanoshin [Thu, 8 Feb 2018 00:18:35 +0000 (00:18 +0000)]
[AMDGPU] Fixed wait count reuse

The code reusing existing wait counts is incorrect since it keeps
adding new operands to an old instruction instead of replacing
the immediate. It was also effectively switched off by the condition
that wait count is not an AMDGPU::S_WAITCNT.

Also switched to BuildMI instead of creating instructions directly.

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

llvm-svn: 324547

6 years ago[x86] Fix nasty bug in the x86 backend that is essentially impossible to
Chandler Carruth [Wed, 7 Feb 2018 23:59:14 +0000 (23:59 +0000)]
[x86] Fix nasty bug in the x86 backend that is essentially impossible to
hit from IR but creates a minefield for MI passes.

The x86 backend has fairly powerful logic to try and fold loads that
feed register operands to instructions into a memory operand on the
instruction. This is almost always a good thing, but there are specific
relocated loads that are only allowed to appear in specific
instructions. Notably, R_X86_64_GOTTPOFF is only allowed in `movq` and
`addq`. This patch blocks folding of memory operands using this
relocation unless the target is in fact `addq`.

The particular relocation indicates why we simply don't hit this under
normal circumstances. This relocation is only used for TLS, and it gets
used in very specific ways in conjunction with %fs-relative addressing.
The result is that loads using this relocation are essentially never
eligible for folding into an instruction's memory operands. Unless, of
course, you have an MI pass that inserts usage of such a load. I have
exactly such an MI pass and was greeted by truly mysterious miscompiles
where the linker replaced my instruction with a completely garbage byte
sequence. Go team.

This is the only such relocation I'm aware of in x86, but there may be
others that need to be similarly restricted.

Fixes PR36165.

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

llvm-svn: 324546

6 years agoFix size and alignment of array<T, 0>.
Eric Fiselier [Wed, 7 Feb 2018 23:50:25 +0000 (23:50 +0000)]
Fix size and alignment of array<T, 0>.

An array T[1] isn't necessarily the same say when it's
a member of a struct. This patch addresses that problem and corrects
the tests to deal with it.

llvm-svn: 324545

6 years agoVerify profile data confirms large loop trip counts.
Mircea Trofin [Wed, 7 Feb 2018 23:29:52 +0000 (23:29 +0000)]
Verify profile data confirms large loop trip counts.

Summary:
Loops with inequality comparers, such as:

   // unsigned bound
   for (unsigned i = 1; i < bound; ++i) {...}

have getSmallConstantMaxTripCount report a large maximum static
trip count - in this case, 0xffff fffe. However, profiling info
may show that the trip count is much smaller, and thus
counter-recommend vectorization.

This change:
- flips loop-vectorize-with-block-frequency on by default.
- validates profiled loop frequency data supports vectorization,
  when static info appears to not counter-recommend it. Absence
  of profile data means we rely on static data, just as we've
  done so far.

Reviewers: twoh, mkuper, davidxl, tejohnson, Ayal

Reviewed By: davidxl

Subscribers: bkramer, llvm-commits

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

llvm-svn: 324543

6 years agoFix compilation in C++17 mode.
Richard Smith [Wed, 7 Feb 2018 23:23:23 +0000 (23:23 +0000)]
Fix compilation in C++17 mode.

C++17 removes `std::unexpected_handler`, but libc++abi needs it to define
`__cxa_exception`. When building against libc++, this is easily rectified by
telling libc++ we're building the library. We already do this in the other
places where we need these symbols.

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

llvm-svn: 324542

6 years agoUpdate for llvm change.
Rafael Espindola [Wed, 7 Feb 2018 23:13:57 +0000 (23:13 +0000)]
Update for llvm change.

llvm-svn: 324541

6 years ago[NFCi] Replace a couple of usages of const StringRef& with StringRef
Erich Keane [Wed, 7 Feb 2018 23:04:38 +0000 (23:04 +0000)]
[NFCi] Replace a couple of usages of const StringRef& with StringRef

No sense passing these by reference when a copy is about as free, and
saves on potential indirection later.

llvm-svn: 324540

6 years agoDon't try to use copy relocations with tls variables.
Rafael Espindola [Wed, 7 Feb 2018 23:04:06 +0000 (23:04 +0000)]
Don't try to use copy relocations with tls variables.

Should fix the lldb bot.

llvm-svn: 324539

6 years ago[X86] Prune some unreachable 'return SDValue()' paths from LowerSIGN_EXTEND/LowerZERO...
Craig Topper [Wed, 7 Feb 2018 22:45:38 +0000 (22:45 +0000)]
[X86] Prune some unreachable 'return SDValue()' paths from LowerSIGN_EXTEND/LowerZERO_EXTEND/LowerANY_EXTEND.

We were doing a lot of whitelisting of what we handle in these routines, but setOperationAction constrains what we can get here. So just add some asserts and prune the unreachable paths.

llvm-svn: 324538

6 years agoPR36055: fix computation of *-dependence in nested initializer lists.
Richard Smith [Wed, 7 Feb 2018 22:25:16 +0000 (22:25 +0000)]
PR36055: fix computation of *-dependence in nested initializer lists.

When we synthesize an implicit inner initializer list when analyzing an outer
initializer list, we add it to the outer list immediately, and then fill in the
inner list. This gives the outer list no chance to update its *-dependence bits
with those of the completed inner list. To fix this, re-add the inner list to
the outer list once it's completed.

Note that we do not recompute the *-dependence bits from scratch when we
complete an outer list; this would give the wrong result for the case where a
designated initializer overwrites a dependent initializer with a non-dependent
one. The resulting list in that case should still be dependent, even though all
traces of the dependence were removed from the semantic form.

llvm-svn: 324537

6 years ago[X86] Remove dead code from EmitTest that looked for an i1 type which should have...
Craig Topper [Wed, 7 Feb 2018 22:19:26 +0000 (22:19 +0000)]
[X86] Remove dead code from EmitTest that looked for an i1 type which should have already been type legalized away. NFC

llvm-svn: 324536

6 years agoRecommit r324107 again.
Rafael Espindola [Wed, 7 Feb 2018 22:15:33 +0000 (22:15 +0000)]
Recommit r324107 again.

The difference from the previous try is that we no longer directly
access function declarations from position independent executables. It
should work, but currently doesn't with some linkers.

It now includes a fix to not mark available_externally definitions as
dso_local.

Original message:

Start setting dso_local in clang.

This starts adding dso_local to clang.

The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go
away. My objective for now is to move enough of it to clang to remove
the need for the TargetMachine one to handle PIE copy relocations and
-fno-plt. With that it should then be easy to implement a
-fno-copy-reloc in clang.

This patch just adds the cases where we assume a symbol to be local
based on the file being compiled for an executable or a shared
library.

llvm-svn: 324535

6 years agoStop using __strtonum_fallback on Android.
Dan Albert [Wed, 7 Feb 2018 21:58:48 +0000 (21:58 +0000)]
Stop using __strtonum_fallback on Android.

Fallback implementations are now provided by bionic when necessary,
which these may conflict with.

llvm-svn: 324534

6 years ago[X86] When doing callee save/restore for k-registers make sure we don't use KMOVQ...
Craig Topper [Wed, 7 Feb 2018 21:41:50 +0000 (21:41 +0000)]
[X86] When doing callee save/restore for k-registers make sure we don't use KMOVQ on non-BWI targets

If we are saving/restoring k-registers, the default behavior of getMinimalRegisterClass will find the VK64 class with a spill size of 64 bits. This will cause the KMOVQ opcode to be used for save/restore. If we don't have have BWI instructions we need to constrain the class returned to give us VK16 with a 16-bit spill size. We can do this by passing the either v16i1 or v64i1 into getMinimalRegisterClass.

Also add asserts to make sure BWI is enabled anytime we use KMOVD/KMOVQ. These are what caught this bug.

Fixes PR36256

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

llvm-svn: 324533

6 years agoFix PR#31454 - 'basic_string<T>::push_back() crashes if sizeof(T)>sizeof(long long...
Marshall Clow [Wed, 7 Feb 2018 21:30:17 +0000 (21:30 +0000)]
Fix PR#31454 - 'basic_string<T>::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. This may be an ABI change (change the size of) strings of very large 'characters', but since they never worked, I'm not too concerned.

llvm-svn: 324531

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Wed, 7 Feb 2018 21:29:30 +0000 (21:29 +0000)]
[X86] Auto-generate complete checks. NFC

llvm-svn: 324530

6 years agoFix -verify static assert messages for older Clang versions
Eric Fiselier [Wed, 7 Feb 2018 21:25:25 +0000 (21:25 +0000)]
Fix -verify static assert messages for older Clang versions

llvm-svn: 324529

6 years agoDocument --build-id=fast in ld.lld.1
Ed Maste [Wed, 7 Feb 2018 21:22:20 +0000 (21:22 +0000)]
Document --build-id=fast in ld.lld.1

Initial ld.lld.1 man page commit in r324512 crossed paths with r324502
which added --build-id=fast, allowing --build-id to be documented as a
synonym for --build-id=fast. Catch up with that change in the man page.

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

llvm-svn: 324528

6 years ago[clang-import-test] Run clang-format, NFC
Vedant Kumar [Wed, 7 Feb 2018 21:17:22 +0000 (21:17 +0000)]
[clang-import-test] Run clang-format, NFC

I ran across clang-import-test while looking into testing for lldb.
There shouldn't be any harm in running clang-format over it.

llvm-svn: 324527

6 years ago[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default construc...
Eric Fiselier [Wed, 7 Feb 2018 21:06:13 +0000 (21:06 +0000)]
[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.

Summary:
This patch fixes llvm.org/PR35491 and LWG2157  (https://cplusplus.github.io/LWG/issue2157)

The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: lichray, cfe-commits

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

llvm-svn: 324526

6 years ago[PR36008] Avoid -Wsign-compare warning for enum constants in
Alex Lorenz [Wed, 7 Feb 2018 20:45:39 +0000 (20:45 +0000)]
[PR36008] Avoid -Wsign-compare warning for enum constants in
typeof expressions

This commit looks through typeof type at the original expression when diagnosing
-Wsign-compare to avoid an unfriendly diagnostic.

rdar://36588828

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

llvm-svn: 324514

6 years agoAdd ld.lld.1 man page, describing lld's ELF linker
Ed Maste [Wed, 7 Feb 2018 20:38:18 +0000 (20:38 +0000)]
Add ld.lld.1 man page, describing lld's ELF linker

One of the FreeBSD requirements for enabling lld as the system linker is
that it has a man page. Other FreeBSD developers and I created one using
lld's --help output as a starting point.  This is an expanded and
improved version of that.

This man page would benefit from additional content, but it provides
basic user-facing coverage of lld's options and serves as a good
starting point.

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

llvm-svn: 324512

6 years agoRevert "[DebugInfo] Improvements to representation of enumeration types (PR36168)"
Momchil Velikov [Wed, 7 Feb 2018 20:28:47 +0000 (20:28 +0000)]
Revert "[DebugInfo] Improvements to representation of enumeration types (PR36168)"

Revert commit r324489, it broke LLDB tests.

llvm-svn: 324511

6 years ago[SLP] Add a tests for PR36280, NFC.
Alexey Bataev [Wed, 7 Feb 2018 20:11:37 +0000 (20:11 +0000)]
[SLP] Add a tests for PR36280, NFC.

llvm-svn: 324510

6 years agoRemove an errant ^S
Jim Ingham [Wed, 7 Feb 2018 20:09:13 +0000 (20:09 +0000)]
Remove an errant ^S

(still can't get over those Emacs habits...)

llvm-svn: 324509

6 years agoRevert [DebugInfo] Improvements to representation of enumeration types (PR36168)"
Momchil Velikov [Wed, 7 Feb 2018 19:57:04 +0000 (19:57 +0000)]
Revert [DebugInfo] Improvements to representation of enumeration types (PR36168)"

Revert due to breaking buildbots (LLDB tests)

llvm-svn: 324508

6 years ago[analyzer] [NFC] Factor out generating path diagnostics for a statement into a function
George Karpenkov [Wed, 7 Feb 2018 19:56:52 +0000 (19:56 +0000)]
[analyzer] [NFC] Factor out generating path diagnostics for a statement into a function

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

llvm-svn: 324507