platform/upstream/llvm.git
6 years ago[X86] Remove more dead code left over from the handling of i8/i16 UMUL_LOHI/SMUL_LOHI...
Craig Topper [Wed, 4 Apr 2018 07:00:16 +0000 (07:00 +0000)]
[X86] Remove more dead code left over from the handling of i8/i16 UMUL_LOHI/SMUL_LOHI that is no longer needed. NFC

llvm-svn: 329152

6 years agoFix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.
Eric Fiselier [Wed, 4 Apr 2018 06:31:21 +0000 (06:31 +0000)]
Fix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.

Previously UnaryTransformType nodes were comparing the same node
for structural equivalence. This was due to a typo where T1 was
on both sides of the comparison. This patch corrects that typo.

Unfortunately I couldn't find a way to test this change. It seems
that currently UnaryTransform nodes are never actually checked
for equivalence, only their canonical types are.

None the less, this correction seemed appropriate.

llvm-svn: 329151

6 years ago[SCEV] Prove implications for SCEVUnknown Phis
Max Kazantsev [Wed, 4 Apr 2018 05:46:47 +0000 (05:46 +0000)]
[SCEV] Prove implications for SCEVUnknown Phis

This patch teaches SCEV how to prove implications for SCEVUnknown nodes that are Phis.
If we need to prove `Pred` for `LHS, RHS`, and `LHS` is a Phi with possible incoming values
`L1, L2, ..., LN`, then if we prove `Pred` for `(L1, RHS), (L2, RHS), ..., (LN, RHS)` then we can also
prove it for `(LHS, RHS)`. If both `LHS` and `RHS` are Phis from the same block, it is sufficient
to prove the predicate for values that come from the same predecessor block.

The typical case that it handles is that we sometimes need to prove that `Phi(Len, Len - 1) >= 0`
given that `Len > 0`. The new logic was added to `isImpliedViaOperations` and only uses it and
non-recursive reasoning to prove the facts we need, so it should not hurt compile time a lot.

Differential Revision: https://reviews.llvm.org/D44001
Reviewed By: anna

llvm-svn: 329150

6 years agoFix undefined macro issue in locale tests; Try 2
Eric Fiselier [Wed, 4 Apr 2018 04:48:26 +0000 (04:48 +0000)]
Fix undefined macro issue in locale tests; Try 2

llvm-svn: 329149

6 years agoFix undefined macro issue in locale tests
Eric Fiselier [Wed, 4 Apr 2018 04:39:38 +0000 (04:39 +0000)]
Fix undefined macro issue in locale tests

llvm-svn: 329148

6 years ago[X86] Remove dead code for handling i8/i16 UMUL_LOHI/SMUL_LOHI from X86ISelDAGToDAG...
Craig Topper [Wed, 4 Apr 2018 04:38:55 +0000 (04:38 +0000)]
[X86] Remove dead code for handling i8/i16 UMUL_LOHI/SMUL_LOHI from X86ISelDAGToDAG.cpp. NFC

These are promoted to i16/i32 multiplies by a DAG combine.

llvm-svn: 329147

6 years ago[X86] Remove some code that was only needed when i1 was a legal type. NFC
Craig Topper [Wed, 4 Apr 2018 04:38:54 +0000 (04:38 +0000)]
[X86] Remove some code that was only needed when i1 was a legal type. NFC

llvm-svn: 329146

6 years agoUpdate Clang version on Appveyor bots
Eric Fiselier [Wed, 4 Apr 2018 04:33:09 +0000 (04:33 +0000)]
Update Clang version on Appveyor bots

llvm-svn: 329145

6 years agoTouch up tests for new <version> header; fix module.modulemap.
Eric Fiselier [Wed, 4 Apr 2018 04:21:54 +0000 (04:21 +0000)]
Touch up tests for new <version> header; fix module.modulemap.

This patch does some housekeeping for the new <version> header.
It adds it to the module.modulemap, and the double_include.sh.cpp test.

Additionally it corrects the // UNSUPPORTED options for the libc++
specific test. The header needs to compile under C++03 to support
modules, and it should compile under all available compilers.

llvm-svn: 329144

6 years agoFix locale test data for GLIBC 2.27 and newer.
Eric Fiselier [Wed, 4 Apr 2018 04:00:14 +0000 (04:00 +0000)]
Fix locale test data for GLIBC 2.27 and newer.

GLIBC 2.27 changed the locale data for fr_FR and ru_RU. In particular
they change the decimal and thousands separators used. This patch
makes the locale tests tolerate the updated locales.

llvm-svn: 329143

6 years ago[SimplifyCFG] Teach merge conditional stores to handle cases where the PostBB has...
Craig Topper [Wed, 4 Apr 2018 03:47:17 +0000 (03:47 +0000)]
[SimplifyCFG] Teach merge conditional stores to handle cases where the PostBB has more than 2 predecessors by inserting a new block for the store.

Summary:
Currently merge conditional stores can't handle cases where PostBB (the block we need to move the store to) has more than 2 predecessors.

This patch removes that restriction by creating a new block with only the 2 predecessors we care about and an unconditional branch to the original block. This provides a place to put the store.

Reviewers: efriedma, jmolloy, ABataev

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 329142

6 years agoSplit test/Driver/darwin-sdkroot.c into two tests
Alex Lorenz [Wed, 4 Apr 2018 02:11:20 +0000 (02:11 +0000)]
Split test/Driver/darwin-sdkroot.c into two tests

The test additions in r329110 are Darwin-specific, as they rely
on a code path that is reachabled when driver is invoked without
-target. Instead of making the old test checks Darwin-specific too,
let's simply split it into two files to ensure that the old
checks are still platform-agnostic. Thanks Chandler for
suggesting this!

llvm-svn: 329141

6 years agoFix bad #include path in r329139
Vlad Tsyrklevich [Wed, 4 Apr 2018 01:34:42 +0000 (01:34 +0000)]
Fix bad #include path in r329139

llvm-svn: 329140

6 years agoAdd the ShadowCallStack pass
Vlad Tsyrklevich [Wed, 4 Apr 2018 01:21:16 +0000 (01:21 +0000)]
Add the ShadowCallStack pass

Summary:
The ShadowCallStack pass instruments functions marked with the
shadowcallstack attribute. The instrumented prolog saves the return
address to [gs:offset] where offset is stored and updated in [gs:0].
The instrumented epilog loads/updates the return address from [gs:0]
and checks that it matches the return address on the stack before
returning.

Reviewers: pcc, vitalybuka

Reviewed By: pcc

Subscribers: cryptoad, eugenis, craig.topper, mgorny, llvm-commits, kcc

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

llvm-svn: 329139

6 years agoMinor no-op cmake file style fix.
Nico Weber [Wed, 4 Apr 2018 00:50:22 +0000 (00:50 +0000)]
Minor no-op cmake file style fix.

llvm-svn: 329137

6 years agoReapply r329133 with fix.
Lang Hames [Wed, 4 Apr 2018 00:34:54 +0000 (00:34 +0000)]
Reapply r329133 with fix.

llvm-svn: 329136

6 years agoRevert r329133 "[RuntimeDyld][AArch64] Add some error pluming / generation..."
Lang Hames [Wed, 4 Apr 2018 00:12:12 +0000 (00:12 +0000)]
Revert r329133 "[RuntimeDyld][AArch64] Add some error pluming / generation..."

This broke a number of buildbots. Looking in to it now...

llvm-svn: 329135

6 years ago[MachineOutliner] Test for X86FI->getUsesRedZone() as well as Attribute::NoRedZone
Jessica Paquette [Tue, 3 Apr 2018 23:32:41 +0000 (23:32 +0000)]
[MachineOutliner] Test for X86FI->getUsesRedZone() as well as Attribute::NoRedZone

This commit is similar to r329120, but uses the existing getUsesRedZone() function
in X86MachineFunctionInfo. This teaches the outliner to look at whether or not a
function *truly* uses a redzone instead of just the noredzone attribute on a
function.

Thus, after this commit, it's possible to outline from x86 without using
-mno-red-zone and still get outlining results.

This also adds a new test for the new redzone behaviour.

llvm-svn: 329134

6 years ago[RuntimeDyld][AArch64] Add some error pluming / generation to catch unhandled
Lang Hames [Tue, 3 Apr 2018 23:19:20 +0000 (23:19 +0000)]
[RuntimeDyld][AArch64] Add some error pluming / generation to catch unhandled
relocation types on AArch64.

llvm-svn: 329133

6 years agoFix manifestinput-error.test on Windows 10.
Rui Ueyama [Tue, 3 Apr 2018 23:12:28 +0000 (23:12 +0000)]
Fix manifestinput-error.test on Windows 10.

Patch by Alexandre Ganea.

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

llvm-svn: 329132

6 years ago[AMDGPU] performMinMaxCombine should not optimize patterns of vectors to min3/max3.
Farhana Aleen [Tue, 3 Apr 2018 23:00:30 +0000 (23:00 +0000)]
[AMDGPU] performMinMaxCombine should not optimize patterns of vectors to min3/max3.

Summary: There are no packed instructions for min3 or max3. So, performMinMaxCombine should not optimize vectors of f16 to min3/max3.

Author: FarhanaAleen

Reviewed By: arsenm

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 329131

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Tue, 3 Apr 2018 22:57:17 +0000 (22:57 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix typo and simplify matching expression.

llvm-svn: 329130

6 years ago[Hexagon] peel loops with runtime small trip counts
Ikhlas Ajbar [Tue, 3 Apr 2018 22:55:09 +0000 (22:55 +0000)]
[Hexagon] peel loops with runtime small trip counts

Move the check canPeel() to Hexagon Target before setting PeelCount.

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

llvm-svn: 329129

6 years ago[ObjC] Use the name specified by objc_runtime_name instead of the class
Akira Hatanaka [Tue, 3 Apr 2018 22:50:16 +0000 (22:50 +0000)]
[ObjC] Use the name specified by objc_runtime_name instead of the class
identifier.

This patch fixes a few places in CGObjCMac.cpp where the class
identifier was used instead of the name specified by objc_runtime_name.

rdar://problem/37910822

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

llvm-svn: 329128

6 years ago[CUDA] Check initializers of instantiated template variables.
Artem Belevich [Tue, 3 Apr 2018 22:41:06 +0000 (22:41 +0000)]
[CUDA] Check initializers of instantiated template variables.

We were already performing checks on non-template variables,
but the checks on templated ones were missing.

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

llvm-svn: 329127

6 years agoReturn early. NFC.
Rui Ueyama [Tue, 3 Apr 2018 22:39:12 +0000 (22:39 +0000)]
Return early. NFC.

llvm-svn: 329126

6 years agoMerge two `if`s and add a few blank lines. NFC.
Rui Ueyama [Tue, 3 Apr 2018 22:39:04 +0000 (22:39 +0000)]
Merge two `if`s and add a few blank lines. NFC.

llvm-svn: 329125

6 years agoInline a small test file.
Rui Ueyama [Tue, 3 Apr 2018 22:38:56 +0000 (22:38 +0000)]
Inline a small test file.

llvm-svn: 329124

6 years ago'cat' command for internal shell - Support Python 3
Reid Kleckner [Tue, 3 Apr 2018 22:38:25 +0000 (22:38 +0000)]
'cat' command for internal shell - Support Python 3

LLVM Bug Id : 36449

Revision 328563 caused tests to fail under python 3.

This patch modified cat.py file to support both python 2 and 3.
This patch also fixes CRLF issues on Windows.

Patch by Chamal de Silva

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

llvm-svn: 329123

6 years agoAdd the -fsanitize=shadow-call-stack flag
Vlad Tsyrklevich [Tue, 3 Apr 2018 22:33:53 +0000 (22:33 +0000)]
Add the -fsanitize=shadow-call-stack flag

Summary:
Add support for the -fsanitize=shadow-call-stack flag which causes clang
to add ShadowCallStack attribute to functions compiled with that flag
enabled.

Reviewers: pcc, kcc

Reviewed By: pcc, kcc

Subscribers: cryptoad, cfe-commits, kcc

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

llvm-svn: 329122

6 years ago[InstCombine] allow more fmul folds with 'reassoc'
Sanjay Patel [Tue, 3 Apr 2018 22:19:19 +0000 (22:19 +0000)]
[InstCombine] allow more fmul folds with 'reassoc'

The tests marked with 'FIXME' require loosening the check
in SimplifyAssociativeOrCommutative() to optimize completely;
that's still checking isFast() in Instruction::isAssociative().

llvm-svn: 329121

6 years ago[MachineOutliner] Keep track of fns that use a redzone in AArch64FunctionInfo
Jessica Paquette [Tue, 3 Apr 2018 21:56:10 +0000 (21:56 +0000)]
[MachineOutliner] Keep track of fns that use a redzone in AArch64FunctionInfo

This patch adds a hasRedZone() function to AArch64MachineFunctionInfo. It
returns true if the function is known to use a redzone, false if it is known
to not use a redzone, and no value otherwise.

This removes the requirement to pass -mno-red-zone when outlining for AArch64.

https://reviews.llvm.org/D45189

llvm-svn: 329120

6 years agoRevert "MSG"
Farhana Aleen [Tue, 3 Apr 2018 21:51:45 +0000 (21:51 +0000)]
Revert "MSG"

This reverts commit 9a0ce889d1c39c74d69ecad5ce9c875155ae55de.

This was committed by mistake.

llvm-svn: 329119

6 years agoFix bad copy-and-paste in r329108
Vlad Tsyrklevich [Tue, 3 Apr 2018 21:40:27 +0000 (21:40 +0000)]
Fix bad copy-and-paste in r329108

llvm-svn: 329118

6 years agoInline initOffsetMap.
Rafael Espindola [Tue, 3 Apr 2018 21:38:18 +0000 (21:38 +0000)]
Inline initOffsetMap.

In the lld perf builder r328686 had a negative impact in
stalled-cycles-frontend. Somehow that stat is not showing on my
machine, but the attached patch shows an improvement on cache-misses,
which is probably a reasonable proxy.

My working theory is that given a large input the pieces vector is out
of cache by the time initOffsetMap runs.

Both finalizeContents implementation have a convenient location for
initializing the OffsetMap, so this seems the best solution.

llvm-svn: 329117

6 years ago[MachineOutliner][NFC] Make outlined functions have internal linkage
Jessica Paquette [Tue, 3 Apr 2018 21:36:00 +0000 (21:36 +0000)]
[MachineOutliner][NFC] Make outlined functions have internal linkage

The linkage type on outlined functions was private before. This meant that if
you set a breakpoint in an outlined function, the debugger wouldn't be able to
give a sane name to the outlined function.

This commit changes the linkage type to internal and updates any tests that
relied on the prefixes on the names of outlined functions.

llvm-svn: 329116

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Tue, 3 Apr 2018 21:31:50 +0000 (21:31 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 329115

6 years agoMSG
Farhana Aleen [Tue, 3 Apr 2018 21:20:39 +0000 (21:20 +0000)]
MSG

llvm-svn: 329114

6 years agoAdd REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c
Alex Lorenz [Tue, 3 Apr 2018 21:10:26 +0000 (21:10 +0000)]
Add REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c

The test from r329110 is for Darwin only

llvm-svn: 329113

6 years ago[coroutines] Respect alloca alignment requirements when building coroutine frame
Gor Nishanov [Tue, 3 Apr 2018 20:54:20 +0000 (20:54 +0000)]
[coroutines] Respect alloca alignment requirements when building coroutine frame

Summary:
If an alloca need to be stored in the coroutine frame and it has an alignment specified and the alignment does not match the natural alignment of the alloca type. Insert appropriate padding into the coroutine frame to make sure that it gets requested alignment.

For example for a packet type (which natural alignment is 1), but alloca alignment is 8, we may need to insert a padding field with required number of bytes to make sure it is properly aligned.

```
%PackedStruct = type <{ i64 }>
...
  %data = alloca %PackedStruct, align 8
```

If the previous field in the coroutine frame had alignment 2, we would have [6 x i8] inserted before %PackedStruct in the coroutine frame:

```
%f.Frame = type { ..., i16, [6 x i8], %PackedStruct }
```

Reviewers: rnk, lewissbaker, modocache

Reviewed By: modocache

Subscribers: EricWF, llvm-commits

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

llvm-svn: 329112

6 years ago[LoopInterchange] Add remark for calls preventing interchanging.
Florian Hahn [Tue, 3 Apr 2018 20:54:04 +0000 (20:54 +0000)]
[LoopInterchange] Add remark for calls preventing interchanging.

It also updates test/Transforms/LoopInterchange/call-instructions.ll
to use accesses where we can prove dependence after D35430.

Reviewers: sebpop, karthikthecool, blitz.opensource

Reviewed By: sebpop

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

llvm-svn: 329111

6 years ago[driver][darwin] Do not infer -simulator environment for non-simulator SDKs
Alex Lorenz [Tue, 3 Apr 2018 20:50:05 +0000 (20:50 +0000)]
[driver][darwin] Do not infer -simulator environment for non-simulator SDKs

rdar://36369832

llvm-svn: 329110

6 years agoAdd the ShadowCallStack attribute
Vlad Tsyrklevich [Tue, 3 Apr 2018 20:10:40 +0000 (20:10 +0000)]
Add the ShadowCallStack attribute

Summary:
Introduce the ShadowCallStack function attribute. It's added to
functions compiled with -fsanitize=shadow-call-stack in order to mark
functions to be instrumented by a ShadowCallStack pass to be submitted
in a separate change.

Reviewers: pcc, kcc, kubamracek

Reviewed By: pcc, kcc

Subscribers: cryptoad, mehdi_amini, javed.absar, llvm-commits, kcc

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

llvm-svn: 329108

6 years agoInstead of using std::copy, clear the vector first and add new elements. NFC.
Rui Ueyama [Tue, 3 Apr 2018 20:08:45 +0000 (20:08 +0000)]
Instead of using std::copy, clear the vector first and add new elements. NFC.

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

llvm-svn: 329107

6 years agoELF: Use a vector of pairs to sort sections ordered using --symbol-ordering-file.
Peter Collingbourne [Tue, 3 Apr 2018 19:45:10 +0000 (19:45 +0000)]
ELF: Use a vector of pairs to sort sections ordered using --symbol-ordering-file.

This improved performance by 0.5-1% linking Chromium for Android.

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

llvm-svn: 329106

6 years ago[DebugInfoPDB] Add methods used to read function flags
Aaron Smith [Tue, 3 Apr 2018 19:43:40 +0000 (19:43 +0000)]
[DebugInfoPDB] Add methods used to read function flags

The specific function flags are listed in CodeView::FunctionOption.

llvm-svn: 329105

6 years ago[DebugInfoPDB] Add a few missing definitions to PDBTypes.h
Aaron Smith [Tue, 3 Apr 2018 19:41:27 +0000 (19:41 +0000)]
[DebugInfoPDB] Add a few missing definitions to PDBTypes.h

The missing definitions are from cvconst.h shipped with DIA SDK.

Correct the url to MSDN for MemoryTypeEnum and set the underlying
type of PDB_StackFrameType and PDB_MemoryType to uint16_t.

llvm-svn: 329104

6 years agoFix buildbots.
Rui Ueyama [Tue, 3 Apr 2018 18:59:31 +0000 (18:59 +0000)]
Fix buildbots.

r329092 broke buildbots.

llvm-svn: 329103

6 years ago[analyzer] Fix diagnostics in callees of interesting callees.
Artem Dergachev [Tue, 3 Apr 2018 18:52:30 +0000 (18:52 +0000)]
[analyzer] Fix diagnostics in callees of interesting callees.

removeUnneededCalls() is responsible for removing path diagnostic pieces within
functions that don't contain "interesting" events. It makes bug reports
much tidier.

When a stack frame is known to be interesting, the function doesn't descend
into it to prune anything within it, even other callees that are totally boring.

Fix the function to prune boring callees in interesting stack frames.

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

llvm-svn: 329102

6 years agoAdd a test for an issue fixed in r329092.
Rafael Espindola [Tue, 3 Apr 2018 18:35:46 +0000 (18:35 +0000)]
Add a test for an issue fixed in r329092.

We were setting IsUsedInRegularObj in lazy symbols only used from IR.

llvm-svn: 329101

6 years ago[x86] add tests for convert-FP-to-integer with constants; NFC
Sanjay Patel [Tue, 3 Apr 2018 18:34:56 +0000 (18:34 +0000)]
[x86] add tests for convert-FP-to-integer with constants; NFC

We don't constant fold any of these, but we could...but if we
do, we must produce the right answer.

Unlike the IR fptosi instruction or its DAG node counterpart
ISD::FP_TO_SINT, these are not undef for an out-of-range input.

llvm-svn: 329100

6 years agoRevert "Set calling convention for CUDA kernel"
Artem Belevich [Tue, 3 Apr 2018 18:29:31 +0000 (18:29 +0000)]
Revert "Set calling convention for CUDA kernel"

This reverts r328795 which introduced an issue with referencing __global__
function templates. More details in the original review D44747.

llvm-svn: 329099

6 years agoUse Clang when referring to the project and clang when referring to the binary.
Richard Smith [Tue, 3 Apr 2018 18:28:13 +0000 (18:28 +0000)]
Use Clang when referring to the project and clang when referring to the binary.

llvm-svn: 329098

6 years agoRestrict a test using named file descriptors to using the system shell
David Blaikie [Tue, 3 Apr 2018 18:22:14 +0000 (18:22 +0000)]
Restrict a test using named file descriptors to using the system shell

llvm-svn: 329097

6 years agoDisable a test using environment variables that requires a real shell
David Blaikie [Tue, 3 Apr 2018 18:19:52 +0000 (18:19 +0000)]
Disable a test using environment variables that requires a real shell

llvm-svn: 329096

6 years ago[CodeGen]Add NoVRegs property on PostRASink and ShrinkWrap
Jun Bum Lim [Tue, 3 Apr 2018 18:17:34 +0000 (18:17 +0000)]
[CodeGen]Add NoVRegs property on PostRASink and ShrinkWrap

Summary:
This change declare that PostRAMachineSinking and ShrinkWrap require NoVRegs
property, so now the MachineFunctionPass can enforce this check.
These passes are disabled in NVPTX & WebAssembly.

Reviewers: dschuff, jlebar, tra, jgravelle-google, MatzeB, sebpop, thegameg, mcrosier

Reviewed By: dschuff, thegameg

Subscribers: jholewinski, jfb, sbc100, aheejin, sunfish, llvm-commits

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

llvm-svn: 329095

6 years ago[sanitizer] Remove empty Symbolizer PrepareForSandboxing
Kostya Kortchinsky [Tue, 3 Apr 2018 18:07:22 +0000 (18:07 +0000)]
[sanitizer] Remove empty Symbolizer PrepareForSandboxing

Summary:
`Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently
has been for a while (D10213). Remove it, and shuffle things around so that the
platform specific code is now in `PlatformPrepareForSandboxing`.

This allows to have one less symbolizer dependency in a common file, which
helps for the upcoming split.

Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not
be used anywhere.

Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr

Reviewed By: alekseyshl

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

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

llvm-svn: 329094

6 years ago[dsymutil] Apply recursion workaround for threading
Jonas Devlieghere [Tue, 3 Apr 2018 18:01:18 +0000 (18:01 +0000)]
[dsymutil] Apply recursion workaround for threading

The DwarfLinker can have some very deep recursion that can max out the
(significantly smaller) stack when using threads. We don't want this
limitation when we only have a single thread. We already have this
workaround for the architecture-related threading. This patch applies
the same workaround to the parallel analysis and cloning.

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

llvm-svn: 329093

6 years agoMake fetchIfLazy only fetch an object file. NFC.
Rui Ueyama [Tue, 3 Apr 2018 18:01:18 +0000 (18:01 +0000)]
Make fetchIfLazy only fetch an object file. NFC.

Previously, fetchIfLazy did more than the name says. Now, setting
to UsedInRegularObj is moved to another function.

llvm-svn: 329092

6 years ago[SLP] Fixed formatting, NFC.
Alexey Bataev [Tue, 3 Apr 2018 17:48:14 +0000 (17:48 +0000)]
[SLP] Fixed formatting, NFC.

llvm-svn: 329091

6 years ago[clangd] synthesize fix message when the diagnostic doesn't provide one.
Sam McCall [Tue, 3 Apr 2018 17:35:57 +0000 (17:35 +0000)]
[clangd] synthesize fix message when the diagnostic doesn't provide one.

Summary:
Currently if a fix is attached directly to a diagnostic, we repeat the
diagnostic message as the fix message. From eyeballing the top diagnostics,
it seems describing the textual replacement would be much clearer.

e.g.
error: use of undeclared identifier 'goo'; did you mean 'foo'?
action before: use of undeclared identifier 'goo'; did you mean 'foo'?
action after: change 'goo' to 'foo'

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329090

6 years ago[DEBUGINFO] Add option that allows to disable emission of flags in .loc directives.
Alexey Bataev [Tue, 3 Apr 2018 17:28:55 +0000 (17:28 +0000)]
[DEBUGINFO] Add option that allows to disable emission of flags in .loc directives.

Summary:
Some targets do not support extended format of .loc directive and
support only simple format: .loc <FileID> <Line> <Column>. Patch adds
MCAsmInfo flag and option that allows emit .loc directive without
additional flags.

Reviewers: echristo

Subscribers: llvm-commits

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

llvm-svn: 329089

6 years ago[lld] fix data race in ELF/ICF.cpp
Bob Haarman [Tue, 3 Apr 2018 17:27:39 +0000 (17:27 +0000)]
[lld] fix data race in ELF/ICF.cpp

Summary:
r328610 fixed a data race in the COFF linker. This change makes a
similar fix to the ELF linker.

Reviewers: ruiu, pcc, rnk

Reviewed By: ruiu

Subscribers: emaste, llvm-commits, arichardson

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

llvm-svn: 329088

6 years ago[InstCombine] Fold compare of int constant against a splatted vector of ints
Daniel Neilson [Tue, 3 Apr 2018 17:26:20 +0000 (17:26 +0000)]
[InstCombine] Fold compare of int constant against a splatted vector of ints

Summary:
Folding patterns like:
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %ext = extractelement <4 x i8> %insvec, i32 0
  %cond = icmp eq i32 %ext, 0

Combined with existing rules, this allows us to fold patterns like:
  %insvec = insertelement <4 x i8> undef, i8 %val, i32 0
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %cond = icmp eq i8 %val, 0

When we construct a splat vector via a shuffle, and bitcast the vector into an integer type for comparison against an integer constant. Then we can simplify the the comparison to compare the splatted value against the integer constant.

Reviewers: spatel, anna, mkazantsev

Reviewed By: spatel

Subscribers: efriedma, rengolin, llvm-commits

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

llvm-svn: 329087

6 years ago[ELF] - Eliminate Lazy class.
George Rimar [Tue, 3 Apr 2018 17:16:52 +0000 (17:16 +0000)]
[ELF] - Eliminate Lazy class.

Patch removes Lazy class which
is just an excessive layer.

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

llvm-svn: 329086

6 years ago[SLP] Fix PR36481: vectorize reassociated instructions.
Alexey Bataev [Tue, 3 Apr 2018 17:14:47 +0000 (17:14 +0000)]
[SLP] Fix PR36481: vectorize reassociated instructions.

Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Patch does not support reordering of the repeated instruction, this must
be handled in the separate patch.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

llvm-svn: 329085

6 years agoRemove a stale comment cut and pasted from another file.
Eric Christopher [Tue, 3 Apr 2018 17:07:05 +0000 (17:07 +0000)]
Remove a stale comment cut and pasted from another file.

llvm-svn: 329084

6 years ago[llvm-mca] Move the logic that prints register file statistics to its own view. NFCI
Andrea Di Biagio [Tue, 3 Apr 2018 16:46:23 +0000 (16:46 +0000)]
[llvm-mca] Move the logic that prints register file statistics to its own view. NFCI

Before this patch, the "BackendStatistics" view was responsible for printing the
register file usage (as well as many other statistics).

Now users can enable register file usage statistics using the command line flag
`-register-file-stats`. By default, the tool doesn't print register file
statistics.

llvm-svn: 329083

6 years agoRecommit "[SLP] Fix issues with debug output in the SLP vectorizer."
Alexey Bataev [Tue, 3 Apr 2018 16:40:33 +0000 (16:40 +0000)]
Recommit "[SLP] Fix issues with debug output in the SLP vectorizer."

The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
errs() rather than dbgs().

llvm-svn: 329082

6 years ago[LoopInterchange] Update tests so DA can handle access after D35430.
Florian Hahn [Tue, 3 Apr 2018 16:37:58 +0000 (16:37 +0000)]
[LoopInterchange] Update tests so DA can handle access after D35430.

I have taken the opportunity to simplify some tests slightly and move
parts around.

It also brings back a few IR checks for interchangable loops.

Reviewers: karthikthecool, sebpop, grosser

Reviewed By: sebpop

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

llvm-svn: 329081

6 years ago[SLP] Added tests for checks of reordering of the repeated instructions,
Alexey Bataev [Tue, 3 Apr 2018 16:31:26 +0000 (16:31 +0000)]
[SLP] Added tests for checks of reordering of the repeated instructions,
NFC.

llvm-svn: 329080

6 years ago[Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Krzysztof Parzyszek [Tue, 3 Apr 2018 16:06:36 +0000 (16:06 +0000)]
[Hexagon] Remove -mhvx-double and the corresponding subtarget feature

Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329079

6 years ago[Hexagon] Remove unneeded attributes from lit test
Krzysztof Parzyszek [Tue, 3 Apr 2018 16:05:20 +0000 (16:05 +0000)]
[Hexagon] Remove unneeded attributes from lit test

llvm-svn: 329078

6 years ago[Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Krzysztof Parzyszek [Tue, 3 Apr 2018 15:59:10 +0000 (15:59 +0000)]
[Hexagon] Remove -mhvx-double and the corresponding subtarget feature

Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329077

6 years agoAdding optional Name parameter to createVirtualRegister and createGenericVirtualRegister.
Puyan Lotfi [Tue, 3 Apr 2018 15:53:49 +0000 (15:53 +0000)]
Adding optional Name parameter to createVirtualRegister and createGenericVirtualRegister.

llvm-svn: 329076

6 years agoImplement P0754R2: The <version> header.
Marshall Clow [Tue, 3 Apr 2018 15:48:24 +0000 (15:48 +0000)]
Implement P0754R2: The <version> header.

llvm-svn: 329075

6 years ago[llvm-mca] Remove redundant include from BackendStatistics.h. NFC
Andrea Di Biagio [Tue, 3 Apr 2018 15:36:15 +0000 (15:36 +0000)]
[llvm-mca] Remove redundant include from BackendStatistics.h. NFC

Also use llvm::DenseMap for Histograms (instead of std::map).

llvm-svn: 329074

6 years ago[clang-tidy] Check for sizeof that call functions
Haojian Wu [Tue, 3 Apr 2018 15:10:24 +0000 (15:10 +0000)]
[clang-tidy] Check for sizeof that call functions

Summary:
A common mistake that I have found in our codebase is calling a function to get an integer or enum that represents the type such as:

```
int numBytes = numElements * sizeof(x.GetType());
```

So this extends the `sizeof` check to check for these cases. There is also a `WarnOnSizeOfCall` option so it can be disabled.

Patch by Paul Fultz II!

Reviewers: hokein, alexfh, aaron.ballman, ilya-biryukov

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, jkorous-apple, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 329073

6 years ago[OpenMP] enable bc file compilation using the latest clang
Guansong Zhang [Tue, 3 Apr 2018 15:01:34 +0000 (15:01 +0000)]
[OpenMP] enable bc file compilation using the latest clang

Summary: adding cuda-rdc flag to allow extern global data

Reviewers: grokos

Reviewed By: grokos

Subscribers: gregrodgers, mgorny, openmp-commits

Tags: #openmp

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

llvm-svn: 329072

6 years agoRevert "[SLP] Fix PR36481: vectorize reassociated instructions."
Benjamin Kramer [Tue, 3 Apr 2018 14:40:33 +0000 (14:40 +0000)]
Revert "[SLP] Fix PR36481: vectorize reassociated instructions."

This reverts commit r328980 and r329046. Makes the vectorizer crash.

llvm-svn: 329071

6 years ago[clang-format/ObjC] Do not detect "[]" as ObjC method expression
Ben Hamilton [Tue, 3 Apr 2018 14:07:11 +0000 (14:07 +0000)]
[clang-format/ObjC] Do not detect "[]" as ObjC method expression

Summary:
The following C++ code was being detected by
`guessLanguage()` as Objective-C:

  #define FOO(...) auto bar = [] __VA_ARGS__;

This was because `[] __VA_ARGS__` is not currently detected as a C++
lambda expression (it has no parens or braces), so
`TokenAnnotator::parseSquare()` incorrectly treats the opening square
as an ObjC method expression.

We have two options to fix this:

1. Parse `[] __VA_ARGS__` explicitly as a C++ lambda
2. Make it so `[]` is never parsed as an Objective-C method expression

This diff implements option 2, which causes the `[` to be parsed
as `TT_ArraySubscriptLSquare` instead of `TT_ObjCMethodExpr`.

Note that when I fixed this, it caused one change in formatting
behavior, where the following was implicitly relying on the `[`
being parsed as `TT_ObjCMethodExpr`:

  A<int * []> a;

becomes:

  A<int *[]> a;

with `Style.PointerAlignment = Middle`.

I don't really know what the desired format is for this syntax; the
test was added by Janusz Sobczak and integrated by @djasper in
https://github.com/llvm-mirror/clang/commit/b511fe9818829d7ece0cc0b2ce1fbe04a1f0739a
.

I went ahead and changed the test for now.

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

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

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits, djasper

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

llvm-svn: 329070

6 years ago[clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal
Ben Hamilton [Tue, 3 Apr 2018 14:07:09 +0000 (14:07 +0000)]
[clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal

Summary:
D44816 attempted to fix a few cases where `clang-format` incorrectly
inserted a space before the closing brace of an Objective-C dictionary
literal.

This revealed there were still a few cases where we inserted a space
after the opening brace of an Objective-C dictionary literal.

This fixes the formatting to be consistent and adds more tests.

Test Plan: New tests added. Confirmed tests failed before
  diff and passed after diff.
  Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, krasimir

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329069

6 years ago[MC] Fix -Wmissing-field-initializer warning after r329067.
Andrea Di Biagio [Tue, 3 Apr 2018 13:52:26 +0000 (13:52 +0000)]
[MC] Fix -Wmissing-field-initializer warning after r329067.

This should fix the problem reported by the lld buildbots:
 - Builder lld-x86_64-darwin13, Build #19782
 - Builder lld-perf-testsuite, Build #1419

llvm-svn: 329068

6 years ago[MC][Tablegen] Allow the definition of processor register files in the scheduling...
Andrea Di Biagio [Tue, 3 Apr 2018 13:36:24 +0000 (13:36 +0000)]
[MC][Tablegen] Allow the definition of processor register files in the scheduling model for llvm-mca

This patch allows the description of register files in processor scheduling
models. This addresses PR36662.

A new tablegen class named 'RegisterFile' has been added to TargetSchedule.td.
Targets can optionally describe register files for their processors using that
class. In particular, class RegisterFile allows to specify:
 - The total number of physical registers.
 - Which target registers are accessible through the register file.
 - The cost of allocating a register at register renaming stage.

Example (from this patch - see file X86/X86ScheduleBtVer2.td)

  def FpuPRF : RegisterFile<72, [VR64, VR128, VR256], [1, 1, 2]>

Here, FpuPRF describes a register file for MMX/XMM/YMM registers. On Jaguar
(btver2), a YMM register definition consumes 2 physical registers, while MMX/XMM
register definitions only cost 1 physical register.

The syntax allows to specify an empty set of register classes.  An empty set of
register classes means: this register file models all the registers specified by
the Target.  For each register class, users can specify an optional register
cost. By default, register costs default to 1.  A value of 0 for the number of
physical registers means: "this register file has an unbounded number of
physical registers".

This patch is structured in two parts.

* Part 1 - MC/Tablegen *

A first part adds the tablegen definition of RegisterFile, and teaches the
SubtargetEmitter how to emit information related to register files.

Information about register files is accessible through an instance of
MCExtraProcessorInfo.
The idea behind this design is to logically partition the processor description
which is only used by external tools (like llvm-mca) from the processor
information used by the llvm machine schedulers.
I think that this design would make easier for targets to get rid of the extra
processor information if they don't want it.

* Part 2 - llvm-mca related *

The second part of this patch is related to changes to llvm-mca.

The main differences are:
 1) class RegisterFile now needs to take into account the "cost of a register"
when allocating physical registers at register renaming stage.
 2) Point 1. triggered a minor refactoring which lef to the removal of the
"maximum 32 register files" restriction.
 3) The BackendStatistics view has been updated so that we can print out extra
details related to each register file implemented by the processor.

The effect of point 3. is also visible in tests register-files-[1..5].s.

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

llvm-svn: 329067

6 years ago[LangRef] fix description and examples of fptrunc
Sanjay Patel [Tue, 3 Apr 2018 13:05:20 +0000 (13:05 +0000)]
[LangRef] fix description and examples of fptrunc

As noted in PR36966:
https://bugs.llvm.org/show_bug.cgi?id=36966

The old description doesn't match what we do in code,
so this just fixes the documentation to avoid confusion.

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

llvm-svn: 329065

6 years ago[PowerPC] reorder entries in P9InstrResources.td in alphabetical order; NFC
Hiroshi Inoue [Tue, 3 Apr 2018 12:49:42 +0000 (12:49 +0000)]
[PowerPC] reorder entries in P9InstrResources.td in alphabetical order; NFC

Reorder entries added in my previous commit (rL328969) to keep alphabetical order.

llvm-svn: 329064

6 years ago[ELF] - Check that output sections fit in address space.
George Rimar [Tue, 3 Apr 2018 12:39:28 +0000 (12:39 +0000)]
[ELF] - Check that output sections fit in address space.

Added checks to test that we do not produce
output where VA of sections overruns the address
space available.

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

llvm-svn: 329063

6 years ago[ELF] - Fix the comment. NFC.
George Rimar [Tue, 3 Apr 2018 12:28:53 +0000 (12:28 +0000)]
[ELF] - Fix the comment. NFC.

llvm-svn: 329062

6 years ago[ELF] - Relax checks for R_386_8/R_386_16 relocations.
George Rimar [Tue, 3 Apr 2018 12:19:04 +0000 (12:19 +0000)]
[ELF] - Relax checks for R_386_8/R_386_16 relocations.

This fixes PR36927.

The issue is next. Imagine we have -Ttext 0x7c and code below.

.code16
.global _start
_start:
movb $_start+0x83,%ah

So we have R_386_8 relocation and _start at 0x7C.
Addend is 0x83 == 131. We will sign extend it to 0xffffffffffffff83.

Now, 0xffffffffffffff83 + 0x7c gives us 0xFFFFFFFFFFFFFFFF.
Techically 0x83 + 0x7c == 0xFF, we do not exceed 1 byte value, but
currently LLD errors out, because we use checkUInt<8>.

Let's try to use checkInt<8> now and the following code to see if it can help (no):
main.s:
.byte foo

input.s:
.globl foo
.hidden foo
foo = 0xff

Here, foo is 0xFF. And addend is 0x0. Final value is 0x00000000000000FF.
Again, it fits one byte well, but with checkInt<8>,
we would error out it, so we can't use it.

What we want to do is to check that the result fits 1 byte well.
Patch changes the check to checkIntUInt to fix the issue.

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

llvm-svn: 329061

6 years ago[ELF] - Simplify createFiles. NFCI.
George Rimar [Tue, 3 Apr 2018 12:06:29 +0000 (12:06 +0000)]
[ELF] - Simplify createFiles. NFCI.

Groups paired options together.

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

llvm-svn: 329060

6 years ago[ELF] - X86_64: don't allow 8/16 bit dynamic relocations.
George Rimar [Tue, 3 Apr 2018 11:58:23 +0000 (11:58 +0000)]
[ELF] - X86_64: don't allow 8/16 bit dynamic relocations.

Having 8/16 bits dynamic relocations is incorrect.

Both gold and bfd (built from latest sources) disallow
that too.

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

llvm-svn: 329059

6 years ago[ELF] - Remove dead declaration. NFC.
George Rimar [Tue, 3 Apr 2018 10:40:39 +0000 (10:40 +0000)]
[ELF] - Remove dead declaration. NFC.

llvm-svn: 329058

6 years ago[x86] Fix a pretty obvious think-o with my asm scrubbing. You have to in
Chandler Carruth [Tue, 3 Apr 2018 10:28:56 +0000 (10:28 +0000)]
[x86] Fix a pretty obvious think-o with my asm scrubbing. You have to in
fact use regular expression syntax to use regular expressions.

Should restore the bots. Sorry for the noise on this test.

Thanks to Philip for spotting the bug!

llvm-svn: 329057

6 years ago[x86] Clean up and enhance a test around eflags copying.
Chandler Carruth [Tue, 3 Apr 2018 10:04:37 +0000 (10:04 +0000)]
[x86] Clean up and enhance a test around eflags copying.

This adds the basic test cases from all the EFLAGS bugs in more direct
forms. It also switches to generated check lines, and includes both
32-bit and 64-bit variations.

No functionality changing here, just setting things up to have a nice
clean asm diff in my EFLAGS patch.

llvm-svn: 329056

6 years ago[x86] Extend my goofy SP offset scrubbing for llc test cases to actually
Chandler Carruth [Tue, 3 Apr 2018 09:57:05 +0000 (09:57 +0000)]
[x86] Extend my goofy SP offset scrubbing for llc test cases to actually
do explicit scrubbing of the offsets of stack spills and reloads.

You can always turn this off in order to test specific stack slot usage.
We were already hiding most of this, but the new logic hides it more
generically. Notably, we should effectively hide stack slot churn in
functions that have a frame pointer now, and should also hide it when
changing a function from stack pointer to frame pointer. That transition
already changes enough to be clearly noticed in the test case diff,
showing *every* spill and reload is really noisy without benefit. See
the test case I ran this on as a classic example.

llvm-svn: 329055

6 years agoMSan: introduce the conservative assembly handling mode.
Alexander Potapenko [Tue, 3 Apr 2018 09:50:06 +0000 (09:50 +0000)]
MSan: introduce the conservative assembly handling mode.

The default assembly handling mode may introduce false positives in the
cases when MSan doesn't understand that the assembly call initializes
the memory pointed to by one of its arguments.

We introduce the conservative mode, which initializes the first
|sizeof(type)| bytes for every |type*| pointer passed into the
assembly statement.

llvm-svn: 329054

6 years ago[clangd][cmake] Provide libatomic when there is no native support for 64bit atomics
Simon Dardis [Tue, 3 Apr 2018 09:40:07 +0000 (09:40 +0000)]
[clangd][cmake] Provide libatomic when there is no native support for 64bit atomics

This addresses a persistent failure on clang-cmake-mips buildbot.

Reviewers: ioeric

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

llvm-svn: 329053

6 years agoUsersManual.rst: update text for /GX- to match r328708
Hans Wennborg [Tue, 3 Apr 2018 09:28:21 +0000 (09:28 +0000)]
UsersManual.rst: update text for /GX- to match r328708

llvm-svn: 329052

6 years ago[SCEV] Fix PR36974.
Serguei Katkov [Tue, 3 Apr 2018 07:29:00 +0000 (07:29 +0000)]
[SCEV] Fix PR36974.

The patch changes the usage of dominate to properlyDominate
to satisfy the condition !(a < a) while using std::max.

It is actually NFC due to set data structure is used to keep
the Loops and no two identical loops can be in collection.
So in reality there is no difference between usage of
dominate and properlyDominate in this particular case.
However it might be changed so it is better to fix it.

llvm-svn: 329051

6 years agoAdd a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.
Eric Christopher [Tue, 3 Apr 2018 07:01:33 +0000 (07:01 +0000)]
Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.

Useful when looking for indirect calls/jmps the need mitigation
via retpoline or other mitigations for Spectre v2.

Feedback, extension, additional patches welcome.

llvm-svn: 329050