platform/upstream/llvm.git
5 years ago[GVNHoist] Re-enable GVNHoist by default
Alexandros Lamprineas [Tue, 11 Sep 2018 15:55:45 +0000 (15:55 +0000)]
[GVNHoist] Re-enable GVNHoist by default

Rebase rL340922 since https://bugs.llvm.org/show_bug.cgi?id=38807
has been fixed by rL341947.

llvm-svn: 341954

5 years ago[DagCombine][NFC] Some more tests fo for X % C == 0 (UREM case) transform
Roman Lebedev [Tue, 11 Sep 2018 15:34:26 +0000 (15:34 +0000)]
[DagCombine][NFC] Some more tests fo for X % C == 0 (UREM case) transform

For https://reviews.llvm.org/D50222

Patch by: hermord (Dmytro Shynkevych)!

llvm-svn: 341953

5 years ago[MIPS] Fix illegal type assert in single-float mode
Simon Atanasyan [Tue, 11 Sep 2018 15:32:47 +0000 (15:32 +0000)]
[MIPS] Fix illegal type assert in single-float mode

An fp_to_sint node would be incorrectly lowered to a TruncIntFP node in
single-float mode. This would trigger an "Unexpected illegal type!"
assert.

Patch by Dan Ravensloft.

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

llvm-svn: 341952

5 years ago[SanitizerCoverage] Create comdat for global arrays.
Matt Morehouse [Tue, 11 Sep 2018 15:23:14 +0000 (15:23 +0000)]
[SanitizerCoverage] Create comdat for global arrays.

Summary:
Place global arrays in comdat sections with their associated functions.
This makes sure they are stripped along with the functions they
reference, even on the BFD linker.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: eraman, hiraditya, llvm-commits

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

llvm-svn: 341951

5 years ago[clangd] Add unittests for D51917
Kadir Cetinkaya [Tue, 11 Sep 2018 15:12:10 +0000 (15:12 +0000)]
[clangd] Add unittests for D51917

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 341950

5 years ago[CodeCompletion] Enable signature help when initializing class/struct/union members.
Kadir Cetinkaya [Tue, 11 Sep 2018 15:02:18 +0000 (15:02 +0000)]
[CodeCompletion] Enable signature help when initializing class/struct/union members.

Summary:
Factors out member decleration gathering and uses it in parsing to call signature
help. Doesn't support signature help for base class constructors, the code was too
coupled with diagnostic handling, but still can be factored out but just needs
more afford.

Reviewers: sammccall, ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 341949

5 years agoSimplify.
Rui Ueyama [Tue, 11 Sep 2018 14:37:27 +0000 (14:37 +0000)]
Simplify.

Instead of Map<StringRef, bool>, we can simply use Set<StringRef>.

llvm-svn: 341948

5 years ago[MemorySSAUpdater] Avoid creating self-referencing MemoryDefs
Alexandros Lamprineas [Tue, 11 Sep 2018 14:29:59 +0000 (14:29 +0000)]
[MemorySSAUpdater] Avoid creating self-referencing MemoryDefs

Fix for https://bugs.llvm.org/show_bug.cgi?id=38807, which occurred
while compiling SemaTemplateInstantiate.cpp with clang and GVNHoist
enabled. In the following example:

      1=def(entry)
      /        \
2=def(1)       4=def(1)
3=def(2)       5=def(4)

When removing the MemoryDef 2=def(1) from its basic block, and just
before adding it to the end of the parent basic block, we first
replace all its uses with the defining memory access:

3=def(2) -> 3=def(1)

Then we call insertDef for adding 2=def(1) to the parent basic block,
where we replace the uses of 1=def(entry) with 2=def(1). Doing so we
create a self reference:

2=def(1) -> 2=def(2)  (bad)
3=def(1) -> 3=def(2)  (ok)
4=def(1) -> 4=def(2)  (ok)

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

llvm-svn: 341947

5 years ago [PerfMonitor] Fix rdtscp callsites
Tobias Grosser [Tue, 11 Sep 2018 14:17:44 +0000 (14:17 +0000)]
 [PerfMonitor] Fix rdtscp callsites

Summary:
Update all rdtscp callsites in PerfMonitor so that they conform with the signature changes introduced in r341698.

Reviewers: grosser, bollu

Subscribers: llvm-commits

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

llvm-svn: 341946

5 years agopdb output: Initialize padding in PublicsStreamHeader.
Nico Weber [Tue, 11 Sep 2018 14:11:52 +0000 (14:11 +0000)]
pdb output: Initialize padding in PublicsStreamHeader.

Makes the produced pdbs more deterministic; before they'd contain 2 arbitary
bytes where this padding was.

Also reorder initialization to match the order of the fields in the struct (nfc)

llvm-svn: 341945

5 years agoMake malformed-machos.test pass on my Mac.
Nico Weber [Tue, 11 Sep 2018 14:10:33 +0000 (14:10 +0000)]
Make malformed-machos.test pass on my Mac.

For some reason, llvm-objdump defaults to -arch=i386 on this system while
the test checks x86_64 output. Explicitly pass -arch=x86_64.

llvm-svn: 341944

5 years ago[Hexagon] [Test] Remove undef and infinite loop from test
Roman Lebedev [Tue, 11 Sep 2018 14:06:14 +0000 (14:06 +0000)]
[Hexagon] [Test] Remove undef and infinite loop from test

Summary:
The undef and the infinite loop at the end cause this test to be translated
unpredictably. In particular, the checked-for `mpy` disappears under
certain legal optimizations (e.g. the one in D50222).
Since the use of these constructs is not relevant to the behavior tested,
according to the header comment, this change, suggested by @kparzysz,
eliminates them.

Was initially committed in r341046, but was reverted.

Patch by: hermord (Dmytro Shynkevych)!

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: lebedev.ri, llvm-commits, kparzysz

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

llvm-svn: 341943

5 years ago[PDB] Fix problems after rL341782
Aleksandr Urakov [Tue, 11 Sep 2018 14:03:12 +0000 (14:03 +0000)]
[PDB] Fix problems after rL341782

Summary:
This commit fixes following problems after rL341782:
- Broken SymbolFilePDBTests
- Warning on comparison of integers of different signs

Tags: #lldb

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

llvm-svn: 341942

5 years ago[ARM] Add smlald support in ARMParallelDSP
Sam Parker [Tue, 11 Sep 2018 14:01:22 +0000 (14:01 +0000)]
[ARM] Add smlald support in ARMParallelDSP

Search from i64 reducing phis, as well as i32, to allow the
generation of smlald instructions.

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

llvm-svn: 341941

5 years agoPrint the correct error when our DynamicCheckerFunctions fail to install
Raphael Isemann [Tue, 11 Sep 2018 13:59:47 +0000 (13:59 +0000)]
Print the correct error when our DynamicCheckerFunctions fail to install

Summary:
The check is inverted here: If we have error messages, we should print those instead
of our default error message. But currently we print the default message when we
actually have a sensible error to print.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38383
Thanks Nat for the patch!

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 341940

5 years ago[OPENMP] Simplified checks for declarations in declare target regions.
Alexey Bataev [Tue, 11 Sep 2018 13:59:10 +0000 (13:59 +0000)]
[OPENMP] Simplified checks for declarations in declare target regions.

Sema analysis should not mark functions as an implicit declare target,
it may break codegen. Simplified semantic analysis and removed extra
code for implicit declare target functions.

llvm-svn: 341939

5 years agoRemove unnecessary semicolon to silence -Wpedantic warning. NFCI.
Simon Pilgrim [Tue, 11 Sep 2018 13:42:15 +0000 (13:42 +0000)]
Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.

llvm-svn: 341938

5 years agoStyle fix.
Rui Ueyama [Tue, 11 Sep 2018 13:41:58 +0000 (13:41 +0000)]
Style fix.

llvm-svn: 341937

5 years ago[AArch64] test codegen for unsigned saturated add; NFC
Sanjay Patel [Tue, 11 Sep 2018 13:21:28 +0000 (13:21 +0000)]
[AArch64] test codegen for unsigned saturated add; NFC

This is identical to the tests added for x86 at rL341845.
A semi-generic DAGCombine should improve things universally.

llvm-svn: 341935

5 years ago[MIPS] ORC JIT support
Petar Jovanovic [Tue, 11 Sep 2018 13:10:04 +0000 (13:10 +0000)]
[MIPS] ORC JIT support

This patch adds support for ORC JIT for mips/mips64 architecture.
In common code $static is changed to __ORCstatic because on MIPS
architecture "$" is a reserved character.

Patch by Luka Ercegovcevic

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

llvm-svn: 341934

5 years ago[NFC][clangd] fix warning for extra semicolon
Jonas Toth [Tue, 11 Sep 2018 13:01:49 +0000 (13:01 +0000)]
[NFC][clangd] fix warning for extra semicolon

llvm-svn: 341933

5 years ago[ARM] Enable ARMCodeGenPrepare by default
Sam Parker [Tue, 11 Sep 2018 12:45:43 +0000 (12:45 +0000)]
[ARM] Enable ARMCodeGenPrepare by default

We've had the pass enabled downstream for a couple of weeks and it
seems to be okay, so enable it by default.

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

llvm-svn: 341932

5 years ago[NFC] Fix compiler warning in TestArmv7Disassembly.cpp
Raphael Isemann [Tue, 11 Sep 2018 12:45:22 +0000 (12:45 +0000)]
[NFC] Fix compiler warning in TestArmv7Disassembly.cpp

The warning is
    comparison of integers of different signs: 'const int' and 'const unsigned long'
and triggered by
    EXPECT_EQ (num_of_instructions, inst_list.GetSize());
as num_of_instructions is an int in this comparison (and the RHS is size_t).

llvm-svn: 341931

5 years ago[python bindings] Expose getNumTemplateArguments
Jonathan Coe [Tue, 11 Sep 2018 12:44:52 +0000 (12:44 +0000)]
[python bindings] Expose getNumTemplateArguments

Expose the C bindings for clang_Type_getNumTemplateArguments() and
clang_Type_getTemplateArgumentAsType() in the python API.

Patch by kjteske (Kyle Teske).

Reviewed By: jbcoe

Subscribers: cfe-commits

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

llvm-svn: 341930

5 years ago[clang-tidy] Insert absl::StrAppend when replacing StrCat.
Benjamin Kramer [Tue, 11 Sep 2018 12:19:45 +0000 (12:19 +0000)]
[clang-tidy] Insert absl::StrAppend when replacing StrCat.

There might be no using decl for StrAppend around, inserting the
qualified name is less likely to break things.

llvm-svn: 341929

5 years ago[AMDGPU] Preliminary patch for divergence driven instruction selection. Immediate...
Alexander Timofeev [Tue, 11 Sep 2018 11:56:50 +0000 (11:56 +0000)]
[AMDGPU] Preliminary patch for divergence driven instruction selection. Immediate selection predicate changed
Differential revision: https://reviews.llvm.org/D51734
Reviewers: rampitec

llvm-svn: 341928

5 years ago[FuncAttrs] Remove "access range attributes" for read-none functions
Johannes Doerfert [Tue, 11 Sep 2018 11:51:29 +0000 (11:51 +0000)]
[FuncAttrs] Remove "access range attributes" for read-none functions

The presence of readnone and an access range attribute (argmemonly,
inaccessiblememonly, inaccessiblemem_or_argmemonly) is considered an
error by the verifier. This seems strict but also not wrong. This
patch makes sure function attribute detection will remove all access
range attributes for readnone functions.

llvm-svn: 341927

5 years ago[LoopInfo] Fix Loop::getLoopID() for loops with multiple latches
Johannes Doerfert [Tue, 11 Sep 2018 11:44:17 +0000 (11:44 +0000)]
[LoopInfo] Fix Loop::getLoopID() for loops with multiple latches

The previous implementation traversed all loop blocks and bailed if one
was not a latch block. Since we are only interested in latch blocks, we
should only traverse those.

llvm-svn: 341926

5 years ago[clang-tidy] Add a missing comma after "flags"
Benjamin Kramer [Tue, 11 Sep 2018 10:37:08 +0000 (10:37 +0000)]
[clang-tidy] Add a missing comma after "flags"

llvm-svn: 341925

5 years ago[Msan] Fix unit test linkage issue on FreeBSD
David Carlier [Tue, 11 Sep 2018 10:35:32 +0000 (10:35 +0000)]
[Msan] Fix unit test linkage issue on FreeBSD

Fix typical relocation linkage issue.

Reviwewers: dim, emaste

Reviewed By: krytarowski

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

llvm-svn: 341924

5 years ago[clangd] NFC: Use uint32_t for FuzzyFindRequest limits
Kirill Bobyrev [Tue, 11 Sep 2018 10:31:38 +0000 (10:31 +0000)]
[clangd] NFC: Use uint32_t for FuzzyFindRequest limits

Reviewed By: ioeric

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

llvm-svn: 341921

5 years ago[mips] Add a pattern for 64-bit GPR variant of the `rdhwr` instruction
Simon Atanasyan [Tue, 11 Sep 2018 09:57:25 +0000 (09:57 +0000)]
[mips] Add a pattern for 64-bit GPR variant of the `rdhwr` instruction

MIPS ISAs start to support third operand for the `rdhwr` instruction
starting from Revision 6. But LLVM generates assembler code with
three-operands version of this instruction on any MIPS64 ISA. The third
operand is always zero, so in case of direct code generation we get
correct code.

This patch fixes the bug by adding an instruction alias. The same alias
already exists for 32-bit ISA.

Ideally, we also need to reject three-operands version of the `rdhwr`
instruction in an assembler code if ISA revision is less than 6. That is
a task for a separate patch.

This fixes PR38861 (https://bugs.llvm.org/show_bug.cgi?id=38861)

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

llvm-svn: 341919

5 years ago[NFC] Sanitizing asserts for OrderedBasicBlock
Max Kazantsev [Tue, 11 Sep 2018 08:46:19 +0000 (08:46 +0000)]
[NFC] Sanitizing asserts for OrderedBasicBlock

llvm-svn: 341917

5 years ago[X86] In combineMOVMSK, look through int->fp bitcasts before callling SimplifyDemande...
Craig Topper [Tue, 11 Sep 2018 08:20:02 +0000 (08:20 +0000)]
[X86] In combineMOVMSK, look through int->fp bitcasts before callling SimplifyDemandedBits.

MOVMSKPS and MOVMSKPD both take FP types, but likely the operations before it are on integer types with just a int->fp bitcast between them. If the bitcast isn't used by anything else and doesn't change the element width we can look through it to simplify the integer ops.

llvm-svn: 341915

5 years ago[XRay] Ensure lambda outlives llvm::function_ref
Dean Michael Berris [Tue, 11 Sep 2018 08:03:30 +0000 (08:03 +0000)]
[XRay] Ensure lambda outlives llvm::function_ref

Follow-up to D51912.

llvm-svn: 341912

5 years ago[Tooling] Restore working dir in ClangTool.
Ilya Biryukov [Tue, 11 Sep 2018 07:29:09 +0000 (07:29 +0000)]
[Tooling] Restore working dir in ClangTool.

Summary:
And add an option to disable this behavior. The option is only used in
AllTUsExecutor to avoid races when running concurrently on multiple
threads.

This fixes PR38869 introduced by r340937.

Reviewers: ioeric, steveire

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 341910

5 years ago[XRay] Write the TSC along with CPUID
Dean Michael Berris [Tue, 11 Sep 2018 07:27:59 +0000 (07:27 +0000)]
[XRay] Write the TSC along with CPUID

Fixes builds in non-little-endian systems.

This is a follow-up to D51911.

llvm-svn: 341909

5 years ago[X86] Add test cases inspired by PR38840.
Craig Topper [Tue, 11 Sep 2018 07:23:29 +0000 (07:23 +0000)]
[X86] Add test cases inspired by PR38840.

These are test cases inspired by sequences like below for extracting the same bit from every vector element and checking for all zeros/ones.

define i1 @and256_x8(<8 x i32>) {
    %a = trunc <8 x i32> %0 to <8 x i1>
    %b = bitcast <8 x i1> %a to i8
    %d = icmp eq i8 %b, -1
    ret i1 %d
}

This is what the above looks like after InstCombine.

define i1 @and256_x8_opt(<8 x i32>) {
  %2 = and <8 x i32> %0, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
  %a = icmp ne <8 x i32> %2, zeroinitializer
  %b = bitcast <8 x i1> %a to i8
  %d = icmp eq i8 %b, -1
  ret i1 %d
}

llvm-svn: 341908

5 years agoMake test more robust in case the expected output appears in clang version string.
Douglas Yung [Tue, 11 Sep 2018 06:48:45 +0000 (06:48 +0000)]
Make test more robust in case the expected output appears in clang version string.

llvm-svn: 341907

5 years ago[XRay] Use FDR Records+Visitors for Trace Loading
Dean Michael Berris [Tue, 11 Sep 2018 06:45:59 +0000 (06:45 +0000)]
[XRay] Use FDR Records+Visitors for Trace Loading

Summary:
In this change, we overhaul the implementation for loading
`llvm::xray::Trace` objects from files by using the combination of
specific FDR Record types and visitors breaking up the logic to
reconstitute an execution trace from flight-data recorder mode traces.

This change allows us to handle out-of-temporal order blocks as written
in files, and more consistently recreate an execution trace spanning
multiple blocks and threads. To do this, we use the `WallclockRecord`
associated with each block to maintain temporal order of blocks, before
attempting to recreate an execution trace.

The new addition in this change is the `TraceExpander` type which can be
thought of as a decompression/decoding routine. This allows us to
maintain the state of an execution environment (thread+process) and
create `XRayRecord` instances that fit nicely into the `Trace`
container. We don't have a specific unit test for the TraceExpander
type, since the end-to-end tests for the `llvm-xray convert` tools
already cover precisely this codepath.

This change completes the refactoring started with D50441.

Depends on D51911.

Reviewers: mboerger, eizan

Subscribers: mgorny, hiraditya, mgrang, llvm-commits

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

llvm-svn: 341906

5 years ago[XRay] Add TSC to NewCPUId Records
Dean Michael Berris [Tue, 11 Sep 2018 06:36:51 +0000 (06:36 +0000)]
[XRay] Add TSC to NewCPUId Records

Summary:
This more correctly reflects the data written by the FDR mode runtime.

This is a continuation of the work in D50441.

Reviewers: mboerger, eizan

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 341905

5 years ago[NFC] Specify test's option to reduce reliance on defaults
Max Kazantsev [Tue, 11 Sep 2018 06:34:43 +0000 (06:34 +0000)]
[NFC] Specify test's option to reduce reliance on defaults

llvm-svn: 341904

5 years ago[ASan] [Windows] Remove const from _msize function declaration parameter
Martin Storsjo [Tue, 11 Sep 2018 06:07:32 +0000 (06:07 +0000)]
[ASan] [Windows] Remove const from _msize function declaration parameter

This function isn't declared with a const parameter anywhere; neither
in MSVC (neither in ucrt or in older msvcrt versions) nor in mingw-w64.

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

llvm-svn: 341903

5 years ago[Modules] Add imported modules to the output of -module-file-info
Bruno Cardoso Lopes [Tue, 11 Sep 2018 05:17:13 +0000 (05:17 +0000)]
[Modules] Add imported modules to the output of -module-file-info

Fix a bug in the deserialization of IMPORTS section and allow for
imported modules to also be printed with -module-file-info.

rdar://problem/43867753

llvm-svn: 341902

5 years ago[NFC] Rename variable
Max Kazantsev [Tue, 11 Sep 2018 05:10:01 +0000 (05:10 +0000)]
[NFC] Rename variable

llvm-svn: 341901

5 years agoNCF: use bit_cast in IntervalMap
JF Bastien [Tue, 11 Sep 2018 04:52:21 +0000 (04:52 +0000)]
NCF: use bit_cast in IntervalMap

This use is sketchy because it basically reinterprets a pointer to another pointer, but right now it's hiding in a union. After this change it'll be easy to grep for bit_cast of a pointer and un-sketch things if we want. This patch therefore obeys the law of conservation of sketch, with minor improvement.

llvm-svn: 341900

5 years ago[XRay] Add missing LLVMTestingSupport target_link_libraries
Heejin Ahn [Tue, 11 Sep 2018 04:48:08 +0000 (04:48 +0000)]
[XRay] Add missing LLVMTestingSupport target_link_libraries

Without this builds with `-DLLVM_LINK_LLVM_DYLIB=ON` fail.

llvm-svn: 341899

5 years agoAMDGPU: Fix r600 test
Matt Arsenault [Tue, 11 Sep 2018 04:39:16 +0000 (04:39 +0000)]
AMDGPU: Fix r600 test

llvm-svn: 341898

5 years agoNFC: use bit_cast more in AArch64AddressingModes
JF Bastien [Tue, 11 Sep 2018 04:08:05 +0000 (04:08 +0000)]
NFC: use bit_cast more in AArch64AddressingModes

The was previously committed as r341749 then reverted as r341750 because
bit_cast needed to do its own thing to check is_trivially_copyable on GCC 4.x.
This is now done and std;:array should now get accepted.

llvm-svn: 341897

5 years ago[LICM] Avoid duplicate work during building AliasSetTracker
Serguei Katkov [Tue, 11 Sep 2018 04:07:36 +0000 (04:07 +0000)]
[LICM] Avoid duplicate work during building AliasSetTracker

Currently we re-use cached info from sub loops or traverse them
to populate AliasSetTracker. But after that we traverse all basic blocks
from the current loop. This is redundant work.

All what we need is traversing the all basic blocks from the loop except
those which are used to get the data from the cache.

This should improve compile time only.

Reviewers: mkazantsev, reames, kariddi, anna
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51715

llvm-svn: 341896

5 years agoAMDGPU: Remove leftovers from configurable address spaces
Matt Arsenault [Tue, 11 Sep 2018 04:00:49 +0000 (04:00 +0000)]
AMDGPU: Remove leftovers from configurable address spaces

llvm-svn: 341895

5 years agoAMDGPU: Don't error on out of bounds address spaces
Matt Arsenault [Tue, 11 Sep 2018 04:00:41 +0000 (04:00 +0000)]
AMDGPU: Don't error on out of bounds address spaces

We should never abort on valid IR. The most reasonable
interpretation of an arbitrary address space pointer is
probably some kind of special subset of global memory.

llvm-svn: 341894

5 years ago[IndVars][NFC] Refactor to make modifications of Changed transparent
Max Kazantsev [Tue, 11 Sep 2018 03:57:22 +0000 (03:57 +0000)]
[IndVars][NFC] Refactor to make modifications of Changed transparent

IndVarSimplify's design is somewhat odd in the way how it reports that
some transform has made a change. It has a `Changed` field which can
be set from within any function, which makes it hard to track whether or
not it was set properly after a transform was made. It leads to oversights
in setting this flag where needed, see example in PR38855.

This patch removes the `Changed` field, turns it into a local and unifies
the signatures of all relevant transform functions to return boolean value
which designates whether or not this transform has made a change.

Differential Revision: https://reviews.llvm.org/D51850
Reviewed By: skatkov

llvm-svn: 341893

5 years ago[LICM] (re-)simplify code using MemoryLocation API [NFC]
Philip Reames [Tue, 11 Sep 2018 03:28:28 +0000 (03:28 +0000)]
[LICM] (re-)simplify code using MemoryLocation API [NFC]

I'd made exactly this same change before, but it appears to have been accidentally reverted in another change.  (I'm assuming accidental since it was without comment or test case, and in an unrelated change.)

llvm-svn: 341892

5 years agoRevert "Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer""
Shuai Wang [Tue, 11 Sep 2018 02:23:35 +0000 (02:23 +0000)]
Revert "Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer""

This is the same as D50619 plus fixes for buildbot failures on windows.
The test failures on windows are caused by -fdelayed-template-parsing
and is fixed by forcing -fno-delayed-template-parsing on test cases that
requires AST for uninstantiated templates.

llvm-svn: 341891

5 years agollvm-symbolizer: Fix bug related to TUs interfering with symbolizing
David Blaikie [Tue, 11 Sep 2018 02:04:45 +0000 (02:04 +0000)]
llvm-symbolizer: Fix bug related to TUs interfering with symbolizing

With the merge of TUs and CUs into a single container, some code that
relied on the CU range having an ordered range of contiguous addresses
(for locating a CU at a given offset) broke. But the units from
debug_info (currently only CUs, but CUs and TUs in DWARFv5) are in a
contiguous sub-range of that container - searching only through that
subrange is still valid & so do that.

llvm-svn: 341889

5 years agoPrevent Constant Folding From Optimizing inrange GEP
Peter Collingbourne [Tue, 11 Sep 2018 01:53:36 +0000 (01:53 +0000)]
Prevent Constant Folding From Optimizing inrange GEP

This patch does the following things:

1. update SymbolicallyEvaluateGEP so that it bails out if it cannot preserve inrange arribute;
2. update llvm/test/Analysis/ConstantFolding/gep.ll to remove UB in it;
3. remove inaccurate comment above ConstantFoldInstOperandsImpl in llvm/lib/Analysis/ConstantFolding.cpp;
4. add a new regression test that makes sure that no optimizations change an inrange GEP in an unexpected way.

Patch by Zhaomo Yang!

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

llvm-svn: 341888

5 years ago[XRay] Add the `llvm-xray fdr-dump` implementation
Dean Michael Berris [Tue, 11 Sep 2018 00:22:53 +0000 (00:22 +0000)]
[XRay] Add the `llvm-xray fdr-dump` implementation

Summary:
In this change, we implement a `BlockPrinter` which orders records in a
Block that's been indexed by the `BlockIndexer`. This is used in the
`llvm-xray fdr-dump` tool which ties together the various types and
utilities we've been working on, to allow for inspection of XRay FDR
mode traces both with and without verification.

This change is the final step of the refactoring of D50441.

Reviewers: mboerger, eizan

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 341887

5 years agoRevert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"
Shuai Wang [Mon, 10 Sep 2018 23:58:04 +0000 (23:58 +0000)]
Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"

Summary:
Tests somehow break on windows (and only on windows)
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13003
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/13747

I have yet figure out why so reverting to unbreak first.

Reviewers: george.karpenkov

Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits

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

llvm-svn: 341886

5 years agoAdd REQUIRES line to machine-size-remarks
Jessica Paquette [Mon, 10 Sep 2018 23:53:08 +0000 (23:53 +0000)]
Add REQUIRES line to machine-size-remarks

Just was made aware that this is necessary for tests outside of
the X86 subdirectory. Add a REQUIRES line to make sure bots that
don't enable x86 are happy.

llvm-svn: 341885

5 years ago[InstCombine] Add testcases for (mul (sext x), cst) --> (sext (mul x, cst')) and...
Craig Topper [Mon, 10 Sep 2018 23:48:21 +0000 (23:48 +0000)]
[InstCombine] Add testcases for (mul (sext x), cst) --> (sext (mul x, cst')) and (mul (zext x), cst) --> (zext (mul x, cst')) for vectors constants.

If the multiply won't overflow in the original type we can use a smaller mul and sign extend afterwards. We don't currently support this for vector constants.

llvm-svn: 341884

5 years ago[InstCombine] Partially revert rL341674 due to PR38897.
Alina Sbirlea [Mon, 10 Sep 2018 23:47:21 +0000 (23:47 +0000)]
[InstCombine] Partially revert rL341674 due to PR38897.

Summary:
Revert min/max changes in rL341674 dues to high compile times causing timeouts (PR38897).
Checking in to unblock failing builds. Patch available for post-commit review and re-revert once resolved.
Working on a smaller reproducer for PR38897.

Reviewers: craig.topper, spatel

Subscribers: sanjoy, jlebar, llvm-commits

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

llvm-svn: 341883

5 years agoExplicitly state triple in machine-size-remarks.ll
Jessica Paquette [Mon, 10 Sep 2018 23:30:53 +0000 (23:30 +0000)]
Explicitly state triple in machine-size-remarks.ll

A bot was unhappy with the x86 triple there before. Set it explicitly to
x86_64-apple-darwin just to get something consistent.

Example failure:
http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/16846

llvm-svn: 341882

5 years agoUndoing first commit which added a space to a comment
Shafik Yaghmour [Mon, 10 Sep 2018 23:18:32 +0000 (23:18 +0000)]
Undoing first commit which added a space to a comment

llvm-svn: 341881

5 years ago[AST] Add test coverage of memsets
Philip Reames [Mon, 10 Sep 2018 23:14:30 +0000 (23:14 +0000)]
[AST] Add test coverage of memsets

Immediately after posting https://reviews.llvm.org/D51895, I noticed a small bug.  These tests would have caught that.

llvm-svn: 341880

5 years agoFirst test commit into svn, adding space to comment
Shafik Yaghmour [Mon, 10 Sep 2018 23:12:29 +0000 (23:12 +0000)]
First test commit into svn, adding space to comment

llvm-svn: 341879

5 years agoRollback "Fix raw address breakpoints not resolving".
Davide Italiano [Mon, 10 Sep 2018 23:09:09 +0000 (23:09 +0000)]
Rollback "Fix raw address breakpoints not resolving".

It broke a bunch of bots. Ted confirmed, but can't revert for
now so I'm reverting on his behalf.

llvm-svn: 341878

5 years agoclang-check: rename the local FixItAction
Saleem Abdulrasool [Mon, 10 Sep 2018 22:57:26 +0000 (22:57 +0000)]
clang-check: rename the local FixItAction

Resolve the ambiguity in the FixItAction definition by renaming the type.  With
Xcode 9.2, you would fail to build this with:

  llvm/tools/clang/tools/clang-check/ClangCheck.cpp:183:48: error: reference to 'FixItAction' is ambiguous
      FrontendFactory = newFrontendActionFactory<FixItAction>();
                                                 ^

llvm-svn: 341877

5 years agoAdd size remarks to MachineFunctionPass
Jessica Paquette [Mon, 10 Sep 2018 22:24:10 +0000 (22:24 +0000)]
Add size remarks to MachineFunctionPass

This adds per-function size remarks to codegen, similar to what we have in the
IR layer as of r341588. This only impacts MachineFunctionPasses.

This does the same thing, but for `MachineInstr`s instead of just
`Instructions`. After this, when a `MachineFunctionPass` modifies the number of
`MachineInstr`s in the function it ran on, you'll get a remark.

To enable this, use the size-info analysis remark as before.

llvm-svn: 341876

5 years ago[hwasan] Re-enable print-memory-usage-android test.
Evgeniy Stepanov [Mon, 10 Sep 2018 22:22:02 +0000 (22:22 +0000)]
[hwasan] Re-enable print-memory-usage-android test.

The problem was not in a non-rooted device, but in tagged local
variable address passed to a system call, see comments in the code.

llvm-svn: 341875

5 years ago[Sema][ObjC] Infer availability of +new from availability of -init.
Erik Pilkington [Mon, 10 Sep 2018 22:20:09 +0000 (22:20 +0000)]
[Sema][ObjC] Infer availability of +new from availability of -init.

When defined in NSObject, +new will call -init. If -init has been marked
unavailable, diagnose uses of +new.

rdar://18335828

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

llvm-svn: 341874

5 years ago[ORC] Render unresolved symbol addresses as "<not resolved>" in JITDylib::dump.
Lang Hames [Mon, 10 Sep 2018 22:09:11 +0000 (22:09 +0000)]
[ORC] Render unresolved symbol addresses as "<not resolved>" in JITDylib::dump.

This is easier to spot among the real addresses than "0x0000000000000000".

llvm-svn: 341873

5 years ago[ORC] Simplify LLJIT::Create by removing the ExecutionSession parameter.
Lang Hames [Mon, 10 Sep 2018 22:08:57 +0000 (22:08 +0000)]
[ORC] Simplify LLJIT::Create by removing the ExecutionSession parameter.

The Create method can just construct the ExecutionSession, rather than having the
client pass it in.

llvm-svn: 341872

5 years agoFix test regression in r341862
Erich Keane [Mon, 10 Sep 2018 21:57:53 +0000 (21:57 +0000)]
Fix test regression in r341862

The commit updates when AES is enabled, but failed to update the tests.
This patch fixes them.

llvm-svn: 341871

5 years ago[ELF] Don't emit .relr.dyn section if there are no relocs
Petr Hosek [Mon, 10 Sep 2018 21:54:56 +0000 (21:54 +0000)]
[ELF] Don't emit .relr.dyn section if there are no relocs

This resolves PR38875.

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

llvm-svn: 341870

5 years ago[AST] Fix a crash on invalid.
Erik Pilkington [Mon, 10 Sep 2018 21:54:04 +0000 (21:54 +0000)]
[AST] Fix a crash on invalid.

Problem was that we were appending to the source location info buffer in the
copy assignment operator (instead of overwriting).

rdar://42746401

llvm-svn: 341869

5 years ago[X89] Explicitly enable aes in aes-schedule.ll to fix failures after r341861.
Craig Topper [Mon, 10 Sep 2018 21:49:01 +0000 (21:49 +0000)]
[X89] Explicitly enable aes in aes-schedule.ll to fix failures after r341861.

llvm-svn: 341868

5 years agoFix bit_cast properly
JF Bastien [Mon, 10 Sep 2018 21:43:17 +0000 (21:43 +0000)]
Fix bit_cast properly

Mismatched braces.

llvm-svn: 341867

5 years agoFix bit_cast __is_trivially_copyable
JF Bastien [Mon, 10 Sep 2018 21:41:14 +0000 (21:41 +0000)]
Fix bit_cast __is_trivially_copyable

It's a function-like builtin, not a template.

llvm-svn: 341866

5 years ago[ADT] bit_cast: check for is_trivially_copyable more portably
JF Bastien [Mon, 10 Sep 2018 21:33:45 +0000 (21:33 +0000)]
[ADT] bit_cast: check for is_trivially_copyable more portably

Summary:
It turns out that isPodLike isn't a good workaround for is_trivially_copyable for bit_cast's purpose. In D51872 Louis points out that tuple and pair really aren't a good fit, and for bit_cast I want to capture array. This patch instead checks is_trivially_copyable directly in bit_cast for all but GCC 4.x. In GCC 4.x developers only check for sizeof match, which means any mistake they make will succeed locally and fail on the bots. Realistically that's few developers and they'll be left behind once we upgrade past C++11.

This will allow using bit_cast with std::array.

Subscribers: dexonsmith, llvm-commits, ldionne, rsmith

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

llvm-svn: 341865

5 years agoRe-run clang-format on one file.
Zachary Turner [Mon, 10 Sep 2018 21:31:21 +0000 (21:31 +0000)]
Re-run clang-format on one file.

clang-format was getting confused due to the presence of a macro
invocation that was not terminated by a semicolon.  Fixed this by
terminating the macro lines with semicolons and re-ran clang-format
on the file.

llvm-svn: 341864

5 years ago[PDB] Change uint32_t to SymIndex wherever it makes sense.
Zachary Turner [Mon, 10 Sep 2018 21:30:59 +0000 (21:30 +0000)]
[PDB] Change uint32_t to SymIndex wherever it makes sense.

Although it's just a typedef, it helps for readability.  NFC.

llvm-svn: 341863

5 years agoMove AESNI generation to Skylake and Goldmont
Erich Keane [Mon, 10 Sep 2018 21:12:21 +0000 (21:12 +0000)]
Move AESNI generation to Skylake and Goldmont

The instruction set first appeared with Westmere, but not all processors
in that and the next few generations have the instructions. According to
Wikipedia[1], the first generation in which all SKUs have AES
instructions are Skylake and Goldmont. I can't find any Skylake,
Kabylake, Kabylake-R or Cannon Lake currently listed at
https://ark.intel.com that says "IntelĀ® AES New Instructions" "No".

This matches GCC commit
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01940.html

[1] https://en.wikipedia.org/wiki/AES_instruction_set

Patch By: thiagomacieira
Differential Revision: https://reviews.llvm.org/D51510

llvm-svn: 341862

5 years agoMove FeatureAES from SLM, WSM and SNB to GLM and SKL
Erich Keane [Mon, 10 Sep 2018 21:12:19 +0000 (21:12 +0000)]
Move FeatureAES from SLM, WSM and SNB to GLM and SKL

Complements https://reviews.llvm.org/D51510 and matches
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01940.html

GoldmontProc already has FeatureAES.

Patch By: thiagomacieira

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

llvm-svn: 341861

5 years agoImplement -Watomic-implicit-seq-cst
JF Bastien [Mon, 10 Sep 2018 20:42:56 +0000 (20:42 +0000)]
Implement -Watomic-implicit-seq-cst

Summary:
_Atomic and __sync_* operations are implicitly sequentially-consistent. Some
codebases want to force explicit usage of memory order instead. This warning
allows them to know where implicit sequentially-consistent memory order is used.
The warning isn't on by default because _Atomic was purposefully designed to
have seq_cst as the default: the idea was that it's the right thing to use most
of the time. This warning allows developers who disagree to enforce explicit
usage instead.

A follow-up patch will take care of C++'s std::atomic. It'll be different enough
from this patch that I think it should be separate: for C++ the atomic
operations all have a memory order parameter (or two), but it's defaulted. I
believe this warning should trigger when the default is used, but not when
seq_cst is used explicitly (or implicitly as the failure order for cmpxchg).

<rdar://problem/28172966>

Reviewers: rjmccall

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 341860

5 years ago[X86] Mark the ISD::SETLT/SETLE condition codes as illegal for v32i16/v64i8 to match...
Craig Topper [Mon, 10 Sep 2018 20:31:27 +0000 (20:31 +0000)]
[X86] Mark the ISD::SETLT/SETLE condition codes as illegal for v32i16/v64i8 to match the other vector types.

I'm having a hard time finding a test case for this, but we should be consistent here. The fact that we canonicalize all zeros and all ones constants to vXi32 and all other constants to loads makes this hard to hit the easy DAG combine infinite loop we get for some of the other types.

llvm-svn: 341859

5 years agoEnhance -Wc++14-compat for class template argument deduction to list the
Richard Smith [Mon, 10 Sep 2018 20:31:03 +0000 (20:31 +0000)]
Enhance -Wc++14-compat for class template argument deduction to list the
deduced type (if known).

llvm-svn: 341858

5 years ago[Windows] Include BaseTsd.h with lowercase
Martin Storsjo [Mon, 10 Sep 2018 20:28:06 +0000 (20:28 +0000)]
[Windows] Include BaseTsd.h with lowercase

This fixes building on a case sensitive filesystem with mingw-w64
headers, where all headers are lowercase. This header actually also
is named with a lowercase name in the Windows SDK as well.

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

llvm-svn: 341857

5 years ago[lit] Disable shtest-timeout on Windows
Stella Stamenova [Mon, 10 Sep 2018 20:24:05 +0000 (20:24 +0000)]
[lit] Disable shtest-timeout on Windows

Summary: This is the only test that is still failing on Windows - or rather, it is expected to fail on the bots, but passes on the new bot that we're preparing causing a failure, so I'm going to disable it. Since the test has rarely, if ever, passed on the bots, this should have the same effect and it will unblock the creation of the new bot.

Reviewers: asmith, delcypher, zturner

Subscribers: stella.stamenova, llvm-commits

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

llvm-svn: 341856

5 years agoAPI to update MemorySSA for cloned blocks and added CFG edges.
Alina Sbirlea [Mon, 10 Sep 2018 20:13:01 +0000 (20:13 +0000)]
API to update MemorySSA for cloned blocks and added CFG edges.

Summary:
End goal is to update MemorySSA in all loop passes. LoopUnswitch clones all blocks in a loop. SimpleLoopUnswitch clones some blocks. LoopRotate clones some instructions.
Some of these loop passes also make CFG changes.
This is an API based on what I found needed in LoopUnswitch, SimpleLoopUnswitch, LoopRotate, LoopInstSimplify, LoopSimplifyCFG.
Adding dependent patches using this API for context.

Reviewers: george.burgess.iv, dberlin

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 341855

5 years ago[clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888
Roman Lebedev [Mon, 10 Sep 2018 19:59:18 +0000 (19:59 +0000)]
[clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888

Summary:
I have hit this the rough way, while trying to use this in D51870.

There is no particular point in storing the pointers, and moreover
the pointers are assumed to be non-null, and that assumption is not
enforced. If they are null, it won't be able to do anything good
with them anyway.

Initially i thought about simply adding asserts() that they are
not null, but taking/storing references looks like even cleaner solution?

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=38888 | PR38888 ]]

Reviewers: JonasToth, shuaiwang, alexfh, george.karpenkov

Reviewed By: shuaiwang

Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 341854

5 years agoNFC: bit.h don't warn on strict aliasing for GCC <= 7.1
JF Bastien [Mon, 10 Sep 2018 19:56:42 +0000 (19:56 +0000)]
NFC: bit.h don't warn on strict aliasing for GCC <= 7.1

Summary: Addressed https://bugs.llvm.org/show_bug.cgi?id=38885

Subscribers: dexonsmith, llvm-commits, rsmith, steven_wu, RKSimon, Abhilash, srhines

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

llvm-svn: 341853

5 years ago[ADT] Support converting to lowercase string in toHex
Petr Hosek [Mon, 10 Sep 2018 19:34:44 +0000 (19:34 +0000)]
[ADT] Support converting to lowercase string in toHex

This is useful in certain use-cases such as D51833.

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

llvm-svn: 341852

5 years ago[Hexagon] Split large offsets into properly aligned addends
Krzysztof Parzyszek [Mon, 10 Sep 2018 18:49:16 +0000 (18:49 +0000)]
[Hexagon] Split large offsets into properly aligned addends

llvm-svn: 341851

5 years ago[InstCombine] use SelectInst operand names to make code clearer; NFC
Sanjay Patel [Mon, 10 Sep 2018 18:37:59 +0000 (18:37 +0000)]
[InstCombine] use SelectInst operand names to make code clearer; NFC

Cleanup step for D51433.

llvm-svn: 341850

5 years agoFix raw address breakpoints not resolving
Ted Woodward [Mon, 10 Sep 2018 18:19:01 +0000 (18:19 +0000)]
Fix raw address breakpoints not resolving

Summary: An address breakpoint of the form "b 0x1000" won't resolve if it's created while the process isn't running. This patch deletes Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to SectionWasDeleted (and makes it public), and changes the section check in Breakpoint::ModulesChanged back to its original form

Reviewers: jingham, #lldb

Reviewed By: jingham

Subscribers: davide, lldb-commits

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

llvm-svn: 341849

5 years ago[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer
Shuai Wang [Mon, 10 Sep 2018 18:05:13 +0000 (18:05 +0000)]
[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

Summary:
- If a function is unresolved, assume it mutates its arguments
- Follow unresolved member expressions for nested mutations

Reviewers: aaron.ballman, JonasToth, george.karpenkov

Subscribers: xazax.hun, a.sidorin, cfe-commits

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

llvm-svn: 341848

5 years ago[clang-cl] Enable -march option
Alexandre Ganea [Mon, 10 Sep 2018 17:54:32 +0000 (17:54 +0000)]
[clang-cl] Enable -march option

This change allows usage of -march when using the clang-cl driver. This is similar to MSVC's /arch; however -march can target precisely all supported CPUs, while /arch has a more restricted set.

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

llvm-svn: 341847

5 years ago[MinGW] Hook up the --require-defined option to -include:
Martin Storsjo [Mon, 10 Sep 2018 17:41:40 +0000 (17:41 +0000)]
[MinGW] Hook up the --require-defined option to -include:

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

llvm-svn: 341846

5 years ago[x86] test codegen for unsigned saturated add; NFC
Sanjay Patel [Mon, 10 Sep 2018 17:40:15 +0000 (17:40 +0000)]
[x86] test codegen for unsigned saturated add; NFC

All of the ISA holes are going to make this difficult,
but we can't canonicalize the IR and try to solve PR14613
until we have backend support to get this right.

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

https://rise4fun.com/Alive/Guv
https://rise4fun.com/Alive/AADG

llvm-svn: 341845