14 months ago[PDB] Drop LF_PRECOMP from debugTypes earlier
Reid Kleckner [Wed, 16 Sep 2020 01:50:34 +0000 (18:50 -0700)]
[PDB] Drop LF_PRECOMP from debugTypes earlier

This is a minor simplification to avoid firing up a BinaryStreamReader
and CVType parser.

14 months ago[Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8
Krzysztof Parzyszek [Wed, 16 Sep 2020 01:32:09 +0000 (20:32 -0500)]
[Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8

V6_vdealb4w is not correct for pairs, use V6_vpackeh/V6_vpackeb instead.

14 months ago[NewPM] Port strip* passes to NPM
Arthur Eubanks [Mon, 14 Sep 2020 21:37:46 +0000 (14:37 -0700)]
[NewPM] Port strip* passes to NPM

strip-nondebug and strip-debug-declare have no existing associated tests

Reviewed By: ychen

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

14 months ago[LowerSwitch][NewPM] Port lowerswitch to NPM
Arthur Eubanks [Tue, 15 Sep 2020 22:02:23 +0000 (15:02 -0700)]
[LowerSwitch][NewPM] Port lowerswitch to NPM

Reviewed By: ychen

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

14 months agoTest commit
Michael Kitzan [Wed, 16 Sep 2020 00:50:48 +0000 (17:50 -0700)]
Test commit

14 months agoSVML support for log10, sqrt
Wenlei He [Wed, 16 Sep 2020 00:29:32 +0000 (17:29 -0700)]
SVML support for log10, sqrt

Although LLVM supports vectorization of loops containing log10/sqrt, it did not support using SVML implementation of it. Added support so that when clang is invoked with -fveclib=SVML now an appropriate SVML library log2 implementation will be invoked.

Follow up on: https://reviews.llvm.org/D77114

Added unit tests to svml-calls.ll, svml-calls-finite.ll. Can be run with llvm-lint.
Created a simple c++ file that tests log10/sqrt, and used clang+ to build it, and output final assembly.

Reviewed By: craig.topper

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

14 months ago[LICM] Make Loop ICM profile aware again
Wenlei He [Wed, 16 Sep 2020 00:21:32 +0000 (17:21 -0700)]
[LICM] Make Loop ICM profile aware again

D65060 was reverted because it introduced non-determinism by using BFI counts from already freed blocks. The parent of this revision fixes that by using a VH callback on blocks to prevent this from happening and makes sure BFI data is passed correctly in LoopStandardAnalysisResults.

This re-introduces the previous optimization of using BFI data to prevent LICM from hoisting/sinking if the instruction will end up moving to a colder block.

Internally at Facebook this change results in a ~7% win in a CPU related metric in one of our big services by preventing hoisting cold code into a hot pre-header like the added test case demonstrates.

ninja check

Reviewed By: asbirlea

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

14 months ago[AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions
Jessica Paquette [Thu, 10 Sep 2020 20:34:15 +0000 (13:34 -0700)]
[AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions

These functions were extremely similar:

- `emitADD`
- `emitADDS`
- `emitCMN`

Refactor them a little, introducing a more generic `emitInstr` function to
do most of the work.

Also add support for the immediate + shifted register addressing modes in each
of them.

Update select-uaddo.mir to show that selecing ADDS now supports folding
immediates + shifts. (I don't think this can impact CMN, because the CMN checks
require a G_SUB with a non-constant on the RHS.)

This is around a 0.02% code size improvement on CTMark at -O3.

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

14 months ago[CGSCC][NewPM] Fix adding mutually recursive new functions
Arthur Eubanks [Mon, 14 Sep 2020 18:06:36 +0000 (11:06 -0700)]
[CGSCC][NewPM] Fix adding mutually recursive new functions

When adding a new function via addNewFunctionIntoRefSCC(), it creates a
new node and immediately populates the edges. Since populateSlow() calls
G->get() on all referenced functions, it will create a node (but not
populate it) for functions that haven't yet been added. If we add two
mutually recursive functions, the assert that the node should never have
been created will fire when the second function is added. So here we
remove that assert since the node may have already been created (but not
yet populated).

createNode() is only called from addNewFunctionInto{,Ref}SCC().


Reviewed By: jdoerfert

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

14 months agoGlobalISel: Fix a failing combiner test
Volkan Keles [Tue, 15 Sep 2020 23:40:38 +0000 (16:40 -0700)]
GlobalISel: Fix a failing combiner test

test/CodeGen/AArch64/GlobalISel/combine-trunc.mir was failing
due to the different order for evaluating function arguments.
This patch updates the related code to fix the issue.

14 months ago[llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean
Alexandre Ganea [Tue, 15 Sep 2020 23:18:24 +0000 (19:18 -0400)]
[llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean

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

14 months ago[BFI] Make BFI information available through loop passes inside LoopStandardAnalysisR...
Wenlei He [Tue, 15 Sep 2020 23:09:30 +0000 (16:09 -0700)]
[BFI] Make BFI information available through loop passes inside LoopStandardAnalysisResults

~~D65060 uncovered that trying to use BFI in loop passes can lead to non-deterministic behavior when blocks are re-used while retaining old BFI data.~~

~~To make sure BFI is preserved through loop passes a Value Handle (VH) callback is registered on blocks themselves. When a block is freed it now also wipes out the accompanying BFI entry such that stale BFI data can no longer persist resolving the determinism issue. ~~

~~An optimistic approach would be to incrementally update BFI information throughout the loop passes rather than only invalidating them on removed blocks. The issues with that are:~~
~~1. It is not clear how BFI information should be incrementally updated: If a block is duplicated does its BFI information come with? How about if it's split/modified/moved around? ~~
~~2. Assuming we can address these problems the implementation here will be a massive undertaking. ~~

~~There's a known need of BFI in LICM analysis which requires correct but not incrementally updated BFI data. A follow-up change can register BFI in all loop passes so this preserved but potentially lossy data is available to any loop pass that wants it.~~

See: D75341 for an identical implementation of preserving BFI via VH callbacks. The previous statements do still apply but this change no longer has to be in this diff because it's already upstream ­čśä .

This diff also moves BFI to be a part of LoopStandardAnalysisResults since the previous method using getCachedResults now (correctly!) statically asserts (D72893) that this data isn't static through the loop passes.

Ninja check

Reviewed By: asbirlea, nikic

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

14 months ago[GISel] Add new GISel combiners for G_MUL
Aditya Nandakumar [Tue, 15 Sep 2020 23:06:55 +0000 (16:06 -0700)]
[GISel] Add new GISel combiners for G_MUL


Patch adds two new GICombinerRules, one for G_MUL(X, 1) and another for G_MUL(X, -1).
G_MUL(X, 1) is an identity combine, and G_MUL(X, -1) gets replaced with G_SUB(0, X).
Patch additionally adds new combiner tests for the AArch64 target to test these
new combiner rules, as well as updates AMDGPU GISel tests.

Patch by mkitzan

14 months ago[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode
Mircea Trofin [Mon, 14 Sep 2020 17:45:00 +0000 (10:45 -0700)]
[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode

This will embed bitcode after (Thin)LTO merge, but before optimizations.
In the case the thinlto backend is called from clang, the .llvmcmd
section is also produced. Doing so in the case where the caller is the
linker doesn't yet have a motivation, and would require plumbing through
command line args.

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

14 months ago[SourceManager] Explicitly check for potential iterator underflow
Jan Korous [Wed, 19 Aug 2020 05:36:16 +0000 (22:36 -0700)]
[SourceManager] Explicitly check for potential iterator underflow

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

14 months agoGlobalISel: Add combines for G_TRUNC
Volkan Keles [Tue, 15 Sep 2020 22:50:34 +0000 (15:50 -0700)]
GlobalISel: Add combines for G_TRUNC


14 months ago[AMDGPU] Unify intrinsic ret/nortn interface
Stanislav Mekhanoshin [Thu, 10 Sep 2020 22:10:52 +0000 (15:10 -0700)]
[AMDGPU] Unify intrinsic ret/nortn interface

We have a single noret intrinsic an a lot of special handling
around it. Declare it just as any other but do not define rtn
instructions itself instead.

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

14 months ago[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)
Xun Li [Tue, 15 Sep 2020 22:19:57 +0000 (15:19 -0700)]
[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)

Call instructions with musttail tag must be optimized as a tailcall, otherwise could lead to incorrect program behavior.
When TSAN is instrumenting functions, it broke the contract by adding a call to the tsan exit function inbetween the musttail call and return instruction, and also inserted exception handling code.
This happend throguh EscapeEnumerator, which adds exception handling code and returns ret instructions as the place to insert instrumentation calls.
This becomes especially problematic for coroutines, because coroutines rely on tail calls to do symmetric transfers properly.
To fix this, this patch moves the location to insert instrumentation calls prior to the musttail call for ret instructions that are following musttail calls, and also does not handle exception for musttail calls.

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

14 months ago[OpenMP] Additional Information for Libomptarget Mappings
Joseph Huber [Tue, 15 Sep 2020 19:04:37 +0000 (15:04 -0400)]
[OpenMP] Additional Information for Libomptarget Mappings

This patch adds additonal support for priting infromation from Libomptarget for
already existing maps and printing the final data mapped on the device at
device destruction.

Reviewers: jdoerfort gkistanova

Subscribers: guansong openmp-commits sstefan1 yaxunl

Tags: #OpenMP

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

14 months ago[OPENMP]Fix codegen for is_device_ptr component, captured by reference.
Alexey Bataev [Tue, 15 Sep 2020 19:57:11 +0000 (15:57 -0400)]
[OPENMP]Fix codegen for is_device_ptr component, captured by reference.

Need to map the component as TO instead of the literal, because need to
pass a reference to a component if the pointer is overaligned.

Reviewed By: jdoerfert

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

14 months ago[mlir] Rename 'setInsertionPointAfter' to avoid ambiguity
Diego Caballero [Fri, 4 Sep 2020 18:44:32 +0000 (11:44 -0700)]
[mlir] Rename 'setInsertionPointAfter' to avoid ambiguity

Rename 'setInsertionPointAfter(Value)' API to avoid ambiguity with
'setInsertionPointAfter(Operation *)' for SingleResult operations which
implicitly convert to Value (see D86756).

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

14 months ago[libc] Remove special case for 8 and 16 bytes
Guillaume Chatelet [Tue, 15 Sep 2020 20:48:08 +0000 (20:48 +0000)]
[libc] Remove special case for 8 and 16 bytes

They don't seem to gain much in real apps and its better to favor less branches and smaller code.

14 months agoSema: add support for `__attribute__((__swift_bridged_typedef__))`
Saleem Abdulrasool [Tue, 8 Sep 2020 22:49:41 +0000 (22:49 +0000)]
Sema: add support for `__attribute__((__swift_bridged_typedef__))`

Extend the semantic attributes that clang processes for Swift to include
`swift_bridged_typedef`.  This attribute enables typedefs to be bridged
into Swift with a bridged name.

This is based on the work of the original changes in

Differential Revision: https://reviews.llvm.org/D87396
Reviewed By: Aaron Ballman

14 months ago[libc] use stddef instead of string header
Guillaume Chatelet [Tue, 15 Sep 2020 20:09:50 +0000 (20:09 +0000)]
[libc] use stddef instead of string header

14 months ago[SLPVectorizer][SVE] Skip scalable-vector instructions before vectorizeSimpleInstruct...
Huihui Zhang [Tue, 15 Sep 2020 20:09:56 +0000 (13:09 -0700)]
[SLPVectorizer][SVE] Skip scalable-vector instructions before vectorizeSimpleInstructions.

For scalable type, the aggregated size is unknown at compile-time.
Skip instructions with scalable type to ensure the list of instructions
for vectorizeSimpleInstructions does not contains any scalable-vector instructions.

Reviewed By: RKSimon

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

14 months ago[libc] remove useless headers
Guillaume Chatelet [Tue, 15 Sep 2020 20:03:59 +0000 (20:03 +0000)]
[libc] remove useless headers

14 months agoImplement __isOSVersionAtLeast for Android
Stephen Hines [Tue, 15 Sep 2020 19:50:42 +0000 (12:50 -0700)]
Implement __isOSVersionAtLeast for Android

Add the implementation of __isOSVersionAtLeast for Android. Currently,
only the major version is checked against the API level of the platform
which is an integer. The API level is retrieved by reading the system
property ro.build.version.sdk (and optionally ro.build.version.codename
to see if the platform is released or not).

Patch by jiyong@google.com

Bug: 150860940
Bug: 134795810
Test: m

Reviewed By: srhines

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

14 months ago[TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSub...
Ta-Wei Tu [Tue, 15 Sep 2020 19:38:06 +0000 (15:38 -0400)]
[TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSubRegs`

Building LLVM with -DEXPENSIVE_CHECKS fails with the following error
message with libstdc++ in debug mode:

Error: comparison doesn't meet irreflexive requirements,
assert(!(a < a)).

The patch fixes the comparison function SizeOrder by returning false
when comparing two equal items.

14 months agoInferAddressSpaces: Fix assert with unreachable code
Matt Arsenault [Tue, 15 Sep 2020 17:46:23 +0000 (13:46 -0400)]
InferAddressSpaces: Fix assert with unreachable code

Invalid IR in unreachable code is technically valid IR. In this case,
the address space of the value was never inferred, and we tried to
rewrite it with an invalid address space value which would assert.

14 months ago[clang] Add a command line flag for the Machine Function Splitter.
Snehasish Kumar [Wed, 2 Sep 2020 18:00:46 +0000 (11:00 -0700)]
[clang] Add a command line flag for the Machine Function Splitter.

This patch adds a command line flag for the machine function splitter
(added in rG94faadaca4e1).

Split machine functions using profile information (x86 ELF). On
other targets an error is emitted. If profile information is not
provided a warning is emitted notifying the user that profile
information is required.

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

14 months ago[AArch64][SVE] Add lowering for llvm fsqrt
Muhammad Asif Manzoor [Tue, 15 Sep 2020 19:20:55 +0000 (15:20 -0400)]
[AArch64][SVE] Add lowering for llvm fsqrt

Add the functionality to lower fsqrt for passthru variant

Reviewed By: paulwalker-arm

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

14 months ago[PowerPC] Implement __int128 vector divide operations
Albion Fung [Tue, 15 Sep 2020 19:18:54 +0000 (15:18 -0400)]
[PowerPC] Implement __int128 vector divide operations

This patch implements __int128 vector divide operations for ISA3.1.

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

14 months ago[CodeGen][typeid] Emit typeinfo directly if type is known at compile-time
Zequan Wu [Mon, 14 Sep 2020 17:57:23 +0000 (10:57 -0700)]
[CodeGen][typeid] Emit typeinfo directly if type is known at compile-time

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

14 months ago[ASTMatchers] extract public matchers from const-analysis into own patch
Jonas Toth [Sun, 13 Sep 2020 17:30:56 +0000 (19:30 +0200)]
[ASTMatchers] extract public matchers from const-analysis into own patch

The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are decompositionDecl and forEachArgumentWithParamType, that works
for calls through function pointers as well.

This is a reupload of https://reviews.llvm.org/D72505, that already landed,
but had to be reverted due to a GCC crash on powerpc

Because this took a long time to adress, i decided to redo this patch and
have a clean workflow.
I try to coordinate with someone that has a PPC to apply this patch and
test for the crash. If everything is fine, I intend to just commit.
If the crash is still happening, i hope to at least find the cause.

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

14 months ago[libc++] Fix broken test for std::any and allocators
Louis Dionne [Tue, 15 Sep 2020 18:59:27 +0000 (14:59 -0400)]
[libc++] Fix broken test for std::any and allocators

The test was not allocating the right number of bytes. This is my fault,
not Marshall's, as I was the one to write the tests for 39c879514170.

14 months ago[Dominators][NewPM] Pin tests with -analyze to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 18:59:00 +0000 (11:59 -0700)]
[Dominators][NewPM] Pin tests with -analyze to legacy PM

-analyze isn't supported in NPM. All affected tests have corresponding
NPM RUN line.

14 months ago[DemandedBits][NewPM] Pin some tests to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 18:55:10 +0000 (11:55 -0700)]
[DemandedBits][NewPM] Pin some tests to legacy PM

All tests have corresponding NPM RUN lines.
-analyze doesn't work under NPM.

14 months agoFix .debug_aranges parsing.
Greg Clayton [Mon, 14 Sep 2020 19:20:45 +0000 (12:20 -0700)]
Fix .debug_aranges parsing.

Code was added that used llvm error checking to parse .debug_aranges, but the error check after parsing the DWARFDebugArangesSet was reversed and was causing no error to be returned with no valid address ranges being actually used. This meant we always would fall back onto creating out own address ranges by parsing the compile unit's ranges. This was causing problems for cases where the DW_TAG_compile_unit had a single address range by using a DW_AT_low_pc and DW_AT_high_pc attribute pair (not using a DW_AT_ranges attribute), but the .debug_aranges had correct split ranges. In this case we would end up using the single range for the compile unit that encompassed all of the ranges from the .debug_aranges section and would cause address resolving issues in LLDB where address lookups would fail for certain addresses.

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

14 months ago[gn build] Port 3d42d549554
LLVM GN Syncbot [Tue, 15 Sep 2020 18:32:17 +0000 (18:32 +0000)]
[gn build] Port 3d42d549554

14 months ago[ConstraintElimination] Add constraint elimination pass.
Florian Hahn [Tue, 15 Sep 2020 13:47:23 +0000 (14:47 +0100)]
[ConstraintElimination] Add constraint elimination pass.

This patch is a first draft of a new pass that adds a more flexible way
to eliminate compares based on more complex constraints collected from
dominating conditions.

In particular, it aims at simplifying conditions of the forms below
using a forward propagation approach, rather than instcomine-style
ad-hoc backwards walking of def-use chains.

    if (x < y)
      if (y < z)
        if (x < z) <- simplify


    if (x + 2 < y)
        if (x + 1 < y) <- simplify assuming no wraps

The general approach is to collect conditions and blocks, sort them by
dominance and then iterate over the sorted list. Conditions are turned
into a linear inequality and add it to a system containing the linear
inequalities that hold on entry to the block. For blocks, we check each
compare against the system and see if it is implied by the constraints
in the system.

We also keep a stack of processed conditions and remove conditions from
the stack and the constraint system once they go out-of-scope (= do not
dominate the current block any longer).

Currently there still are the least the following areas for improvements

* Currently large unsigned constants cannot be added to the system
  (coefficients must be represented as integers)
* The way constraints are managed currently is not very optimized.

Reviewed By: spatel

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

14 months ago[Bugpoint][NewPM] Pin bugpoint to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 00:17:32 +0000 (17:17 -0700)]
[Bugpoint][NewPM] Pin bugpoint to legacy PM

Bugpoint has lots of assumptions and hacks around the legacy PM, put off migrating it to NPM until later.
Fixes tests under BugPoint under NPM.

Reviewed By: arsenm

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

14 months ago[X86] Use Align in reduceMaskedLoadToScalarLoad/reduceMaskedStoreToScalarStore. Corre...
Craig Topper [Tue, 15 Sep 2020 18:07:52 +0000 (11:07 -0700)]
[X86] Use Align in reduceMaskedLoadToScalarLoad/reduceMaskedStoreToScalarStore. Correct pointer info.

If we offset the pointer, we also need to offset the pointer info

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

14 months ago[libc++] Add missing friend keyword
Louis Dionne [Tue, 15 Sep 2020 18:19:06 +0000 (14:19 -0400)]
[libc++] Add missing friend keyword

Otherwise, we're declaring a non-static member function, and that
gives errors in C++11 because of the change of semantics between
C++11 and C++14 for non-const constexpr member functions.

This was always intended to be a friend declaration.

14 months ago[PostDominators][NewPM] Fix tests to work under NPM
Arthur Eubanks [Tue, 15 Sep 2020 01:11:09 +0000 (18:11 -0700)]
[PostDominators][NewPM] Fix tests to work under NPM

Each test has a legacy PM pinned to legacy PM and a NPM RUN line.

Reviewed By: asbirlea

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

14 months ago[NewPM][opt] Fix -globals-aa not being recognized as alias analysis in NPM
Arthur Eubanks [Tue, 15 Sep 2020 01:35:12 +0000 (18:35 -0700)]
[NewPM][opt] Fix -globals-aa not being recognized as alias analysis in NPM

Was missing MODULE_ALIAS_ANALYSIS, previously only FUNCTION_ALIAS_ANALYSIS was taken into account.

Reviewed By: asbirlea

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

14 months ago[RegionInfo][NewPM] Fix RegionInfo tests to work under NPM
Arthur Eubanks [Tue, 15 Sep 2020 00:49:58 +0000 (17:49 -0700)]
[RegionInfo][NewPM] Fix RegionInfo tests to work under NPM

Pin RUN lines with -analyze to legacy PM, add corresponding NPM RUN line if missing.

Reviewed By: asbirlea

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

14 months ago[DependenceAnalysis][NewPM] Fix tests to work under NPM
Arthur Eubanks [Tue, 15 Sep 2020 01:45:30 +0000 (18:45 -0700)]
[DependenceAnalysis][NewPM] Fix tests to work under NPM

All tests had corresponding NPM lines, simply pin non-NPM lines to legacy PM.

Reviewed By: fhahn

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

14 months ago[LoopAccessAnalysis][NewPM] Fix tests to work under NPM
Arthur Eubanks [Tue, 15 Sep 2020 01:23:08 +0000 (18:23 -0700)]
[LoopAccessAnalysis][NewPM] Fix tests to work under NPM

Pin RUN lines with -analyze to legacy PM, add corresponding NPM RUN lines.

Reviewed By: fhahn

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

14 months ago[OPENMP]Add support for allocate vars in untied tasks.
Alexey Bataev [Tue, 15 Sep 2020 15:21:47 +0000 (11:21 -0400)]
[OPENMP]Add support for allocate vars in untied tasks.

Local vars, marked with pragma allocate, mustbe allocate by the call of
the runtime function and cannot be allocated as other local variables.
Instead, we allocate a space for the pointer in private record and store
the address, returned by kmpc_alloc call in this pointer.
So, for untied tasks

 #pragma omp task untied
   S s;
    #pragma omp allocate(s) allocator(allocator)
   s = x;
compiler generates something like this:
struct task_with_privates {
  S *ptr;

void entry(task_with_privates *p) {
  S *s = p->s;
  switch(partid) {
  case 1:
    p->s = (S*)kmpc_alloc();
    br exit;
  case 2:
    *s = x;
    br exit;
  case 2:
    br exit;

Reviewed By: jdoerfert

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

14 months agoFix bot failure after ccb4124a4172
Nemanja Ivanovic [Tue, 15 Sep 2020 17:33:31 +0000 (12:33 -0500)]
Fix bot failure after ccb4124a4172

The test case has a check line for the option on a line that includes
the string lld surrounded by any characters. This causes failures
when said string is in the build path. What the test case presumably
means to test is the actual invocation of the LLD linker (i.e. a
linker that has that string as a suffix). This patch simply removes
the erroneous wildcard after the string.

14 months ago[MemoryBuffer] Revert unintended MemoryBuffer change from D86996
Fangrui Song [Tue, 15 Sep 2020 17:20:08 +0000 (10:20 -0700)]
[MemoryBuffer] Revert unintended MemoryBuffer change from D86996

Fixes SupportsTest MemoryBufferTest.mmapVolatileNoNull

14 months agoRevert "[DSE] Switch to MemorySSA-backed DSE by default."
Florian Hahn [Tue, 15 Sep 2020 16:52:50 +0000 (17:52 +0100)]
Revert "[DSE] Switch to MemorySSA-backed DSE by default."

This reverts commit fb109c42d91c30c8c7497ef1fd7aff6f2969c6e7.

Temporarily revert due to a mis-compile pointed out at D87163.

14 months agoRevert "[DebugInfo] Remove dots from getFilenameByIndex return value"
Petr Hosek [Tue, 15 Sep 2020 17:06:15 +0000 (10:06 -0700)]
Revert "[DebugInfo] Remove dots from getFilenameByIndex return value"

This is failing on Windows bots due to path separator normalization.

This reverts commit 042c23506869b4ae9a49d2c4bc5ea6e6baeabe78.

14 months ago[VectorCombine] Don't vectorize scalar load under asan/hwasan/memtag/tsan
Fangrui Song [Mon, 14 Sep 2020 22:11:55 +0000 (15:11 -0700)]
[VectorCombine] Don't vectorize scalar load under asan/hwasan/memtag/tsan

Similar to the tsan suppression in
`Utils/VNCoercion.cpp:getLoadLoadClobberFullWidthSize` (rL175034; load widening used by GVN),
the D81766 optimization should be suppressed under tsan due to potential
spurious data race reports:

  struct A {
    int i;
    const short s; // the load cannot be vectorized because
    int modify;    // it overlaps with bytes being concurrently modified
    long pad1, pad2;
  // __tsan_read16 does not know that some bytes are undef and accessing is safe

Similarly, under asan, users can mark memory regions with
`__asan_poison_memory_region`. A widened load can lead to a spurious
use-after-poison error. hwasan/memtag should be similarly suppressed.

`mustSuppressSpeculation` suppresses asan/hwasan/tsan but not memtag, so
we need to exclude memtag in `vectorizeLoadInsert`.

Note, memtag suppression can be relaxed if the load is aligned to the
its granule (usually 16), but that is out of scope of this patch.

Reviewed By: spatel, vitalybuka

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

14 months ago[lldb] Add -l/--language option to script command
Jonas Devlieghere [Tue, 15 Sep 2020 16:36:28 +0000 (09:36 -0700)]
[lldb] Add -l/--language option to script command

Make it possible to run the script command with a different language
than currently selected.

  $ ./bin/lldb -l python
  (lldb) script -l lua
  >>> io.stdout:write("Hello, World!\n")
  Hello, World!

When passing the language option and a raw command, you need to separate
the flag from the script code with --.

  $ ./bin/lldb -l python
  (lldb) script -l lua -- io.stdout:write("Hello, World!\n")
  Hello, World!

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

14 months ago[X86][AVX] lowerShuffleWithSHUFPS - handle missed canonicalization cases.
Simon Pilgrim [Tue, 15 Sep 2020 16:08:45 +0000 (17:08 +0100)]
[X86][AVX] lowerShuffleWithSHUFPS - handle missed canonicalization cases.

PR47534 exposes a case where calling lowerShuffleWithSHUFPS directly from a derived repeated mask (found by is128BitLaneRepeatedShuffleMask) results in us using an non-canonicalized mask.

The missed canonicalization in this case is trivial - just commute the mask so we have more (swapped) LHS than RHS references so lowerShuffleWithSHUFPS can handle it.

14 months agoNFC: Add whitespace change to .git-blame-ignore-revs
Louis Dionne [Tue, 15 Sep 2020 16:29:41 +0000 (12:29 -0400)]
NFC: Add whitespace change to .git-blame-ignore-revs

14 months ago[MachineBasicBlock] Fix a typo in function copySuccessor
Guozhi Wei [Tue, 15 Sep 2020 16:18:18 +0000 (09:18 -0700)]
[MachineBasicBlock] Fix a typo in function copySuccessor

The condition used to decide if need to copy probability should be reversed.

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

14 months ago[libc++] Add a benchmark for std::map operations
Mark de Wever [Tue, 15 Sep 2020 15:08:13 +0000 (11:08 -0400)]
[libc++] Add a benchmark for std::map operations

Before tackling http://llvm.org/PR38722, make sure there is a baseline

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

14 months ago[XCOFF] Run resource intense test only on platforms where it makes sense
jasonliu [Tue, 15 Sep 2020 15:50:26 +0000 (15:50 +0000)]
[XCOFF] Run resource intense test only on platforms where it makes sense

This is a follow up commit for the issue raised in

14 months ago[analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn...
Krist├│f Umann [Tue, 15 Sep 2020 15:43:02 +0000 (17:43 +0200)]
[analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn't exist

The summary and very short discussion in D82122 summarizes whats happening here.

In short, liveness talks about variables, or expressions, anything that
has a value. Well, statements just simply don't have a one.

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

14 months ago[mlir][openacc] Add loop op verifier
Valentin Clement [Tue, 15 Sep 2020 15:41:50 +0000 (11:41 -0400)]
[mlir][openacc] Add loop op verifier

Add a verifier for the loop op in the OpenACC dialect. Check basic restriction
from 2.9 Loop construct from the OpenACC 3.0 specs.

Reviewed By: ftynse

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

14 months agoSLPVectorizer.h - remove unnecessary AliasAnalysis.h include. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 14:23:19 +0000 (15:23 +0100)]
SLPVectorizer.h - remove unnecessary AliasAnalysis.h include. NFCI.

Forward declare AAResults instead of the (old) AliasAnalysis type.

Remove includes from SLPVectorizer.cpp that are already included in SLPVectorizer.h.

14 months ago[libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy...
Marshall Clow [Tue, 15 Sep 2020 13:56:03 +0000 (09:56 -0400)]
[libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy objects in std::any

https://llvm.org/PR45099 notes (correctly) that we're inconsistent in memory
allocation in `std::any`. We allocate memory with `std::allocator<T>::allocate`,
construct with placement new, destroy by calling the destructor directly, and
deallocate by calling `delete`. Most of those are customizable by the user,
but in different ways.

The standard is silent on how these things are to be accomplished.
This patch makes it so we use `allocator_traits<allocator<T>>` for all
of these operations (allocate, construct, destruct, deallocate).
This is, at least, consistent.

Fixes https://llvm.org/PR45099.

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

14 months ago[InstSimplify] add limit folds for fmin/fmax
Sanjay Patel [Tue, 15 Sep 2020 14:30:35 +0000 (10:30 -0400)]
[InstSimplify] add limit folds for fmin/fmax

If the constant operand is the opposite of the min/max value,
then the result must be the other value.

This is based on the similar codegen transform proposed in:

14 months ago[analyzer] Add documentation for alpha.fuchsia.Lock and alpha.core.C11Lock
Krist├│f Umann [Tue, 25 Aug 2020 11:49:41 +0000 (13:49 +0200)]
[analyzer] Add documentation for alpha.fuchsia.Lock and alpha.core.C11Lock

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

14 months ago[llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred...
Georgii Rymar [Tue, 1 Sep 2020 08:11:34 +0000 (11:11 +0300)]
[llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred from the hash table, is broken.

Currently we might derive the dynamic symbol table size from the DT_HASH hash table (using its `nchain` field).
It is possible to crash dumpers with a broken relocation that refers to a symbol with an index
that is too large. To trigger it, the inferred size of the dynamic symbol table should go past the end of the object.

This patch adds a size validation + warning.

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

14 months ago[analyzer][StdLibraryFunctionsChecker] Elaborate the summary of fread and fwrite
Gabor Marton [Thu, 3 Sep 2020 11:23:49 +0000 (13:23 +0200)]
[analyzer][StdLibraryFunctionsChecker] Elaborate the summary of fread and fwrite

Add the BufferSize argument constraint to fread and fwrite. This change
itself makes it possible to discover a security critical case, described

We also add the not-null constraint on the 3rd arguments.

In this patch, I also remove those lambdas that don't take any
parameters (Fwrite, Fread, Getc), thus making the code better

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

14 months ago[libc] Add missing TableGen dependency
Guillaume Chatelet [Tue, 15 Sep 2020 14:26:04 +0000 (14:26 +0000)]
[libc] Add missing TableGen dependency

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

14 months ago[libc] Add missing LibcFPTestHelpers library
Guillaume Chatelet [Tue, 15 Sep 2020 14:25:34 +0000 (14:25 +0000)]
[libc] Add missing LibcFPTestHelpers library

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

14 months ago[libc] Fix typo in platform_defs.h.inc
Guillaume Chatelet [Tue, 15 Sep 2020 14:25:00 +0000 (14:25 +0000)]
[libc] Fix typo in platform_defs.h.inc

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

14 months ago[LLD][PowerPC] Add support for R_PPC64_TPREL34 used in TLS Local Exec
Stefan Pintilie [Tue, 15 Sep 2020 13:23:58 +0000 (08:23 -0500)]
[LLD][PowerPC] Add support for R_PPC64_TPREL34 used in TLS Local Exec

Add Thread Local Storage Local Exec support to LLD. This is to support PC Relative addressing of Local Exec.
The patch teaches LLD to handle:
paddi r9, r13, x1@tprel
The relocation is:

Reviewed By: NeHuang, MaskRay

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

14 months agoRevert "[SelectionDAG] Remove unused FP constant in getNegatedExpression"
Qiu Chaofan [Tue, 15 Sep 2020 14:03:50 +0000 (22:03 +0800)]
Revert "[SelectionDAG] Remove unused FP constant in getNegatedExpression"

2508ef01 doesn't totally fix the issue since we did not handle the case
when unused temporary negated result is the same with the result, which
is found by address sanitizer.

14 months agoAMDGPUPrintfRuntimeBinding.cpp - drop unnecessary casts/dyn_casts. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 13:48:40 +0000 (14:48 +0100)]
AMDGPUPrintfRuntimeBinding.cpp - drop unnecessary casts/dyn_casts. NFCI.

GetElementPtrInst::Create returns a GetElementPtrInst* so we don't need to cast. Similarly IntegerType inherits from the Type base class.

Also, I've used auto* in a few places to cleanup the code.

Helps fix some clang-tidy warnings which saw the dyn_casts and warned that these can return null.

14 months ago[Utils] isLegalToPromote - Fix missing null check before writing to FailureReason.
Simon Pilgrim [Tue, 15 Sep 2020 12:48:40 +0000 (13:48 +0100)]
[Utils] isLegalToPromote - Fix missing null check before writing to FailureReason.

The FailureReason input parameter maybe null, we check this in all other cases in the method but this one was missed somehow.

Fixes clang-tidy warning.

14 months ago[mlir][openacc] Add missing print of vector_length in parallel op
Valentin Clement [Tue, 15 Sep 2020 13:48:24 +0000 (09:48 -0400)]
[mlir][openacc] Add missing print of vector_length in parallel op

This patch adds the missing print for the vector_length in the parallel operation.

Reviewed By: ftynse

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

14 months ago[mlir][Standard] Add canonicalizer for dynamic_tensor_from_elements
Stephan Herhut [Mon, 14 Sep 2020 09:54:55 +0000 (11:54 +0200)]
[mlir][Standard] Add canonicalizer for dynamic_tensor_from_elements

This add canonicalizer for

- extracting an element from a dynamic_tensor_from_elements
- propagating constant operands to the type of dynamic_tensor_from_elements

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

14 months ago[gn build] Port cd4edf94cd4
LLVM GN Syncbot [Tue, 15 Sep 2020 13:32:48 +0000 (13:32 +0000)]
[gn build] Port cd4edf94cd4

14 months ago[gn build] Port a8058c6f8d1
LLVM GN Syncbot [Tue, 15 Sep 2020 13:32:47 +0000 (13:32 +0000)]
[gn build] Port a8058c6f8d1

14 months ago[InstCombine] fix bug in pow expansion
Sanjay Patel [Tue, 15 Sep 2020 13:27:16 +0000 (09:27 -0400)]
[InstCombine] fix bug in pow expansion

There at least one other bug related to pow -> sqrt transforms:
...but we probably can't solve that without fixing this first.

14 months ago[InstCombine] add RUN to show miscompile of pow expansion; NFC
Sanjay Patel [Tue, 15 Sep 2020 13:21:20 +0000 (09:21 -0400)]
[InstCombine] add RUN to show miscompile of pow expansion; NFC

The code drops the sqrt op instead of bailing out,
so this is very wrong.

14 months ago[InstCombine] improve test names; NFC
Sanjay Patel [Tue, 15 Sep 2020 12:38:51 +0000 (08:38 -0400)]
[InstCombine] improve test names; NFC

This is not a valid transform unless we can prove
that the program does not read errno after the pow
call and before some other function changes it.

14 months ago[libcxx] Disable failing test for no-exceptions build
Oliver Stannard [Tue, 15 Sep 2020 10:40:05 +0000 (11:40 +0100)]
[libcxx] Disable failing test for no-exceptions build

This test tries to create a 2 GiB std::string, catching the bad_alloc
exception if the allocation fails. However, for no-exceptions builds
there is no way for the error to be reported, so this crashes with a
null pointer dereference.

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

14 months ago[ConstraintElimination] Add initial tests.
Florian Hahn [Fri, 24 Jul 2020 18:36:48 +0000 (19:36 +0100)]
[ConstraintElimination] Add initial tests.

14 months ago[gn build] (semi-manually) port 380e746bcca
Nico Weber [Tue, 15 Sep 2020 13:25:19 +0000 (09:25 -0400)]
[gn build] (semi-manually) port 380e746bcca

14 months ago[lld][WebAssembly] Fix --export-all when __stack_pointer is present
Sam Clegg [Tue, 15 Sep 2020 01:28:26 +0000 (18:28 -0700)]
[lld][WebAssembly] Fix --export-all when __stack_pointer is present

With https://reviews.llvm.org/D87537 we made it an error
to import or export a mutable global with the +mutable-globals
feature present.  However the scan was of the entire symbol
table rather than just the imports or exports and the filter
didn't match exaclyt meaning the `__stack_pointer` (a mutable
global) was always triggering with error when the `--export-all`
flag was used.

This also revealed that we didn't have any test coverage for
the `--export-all` flag.

This change fixes the current breakage on the emscripten-releases

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

14 months ago[Flang] Add GettingInvolved documentation page and sidebar.
sameeran joshi [Sun, 13 Sep 2020 11:54:34 +0000 (17:24 +0530)]
[Flang] Add GettingInvolved documentation page and sidebar.

Adds a new GettingInvolved page to documentation which provides details about
mailing list, chats and calls.

Adds a sidebar page which provides common links on
all documentation pages.
The links include:
-  Getting Started
-  Getting Involved
-  Github Repository
-  Bug Reports
-  Code Review

Depends on https://reviews.llvm.org/D87242

Reviewed By: richard.barton.arm

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

14 months ago[ConstraintSolver] Add isConditionImplied helper.
Florian Hahn [Tue, 15 Sep 2020 12:50:11 +0000 (13:50 +0100)]
[ConstraintSolver] Add isConditionImplied helper.

This patch adds a isConditionImplied function that
takes a constraint and returns true if the constraint
is implied by the current constraints in the system.

Reviewed By: spatel

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

14 months agoRestrict UnnecessaryCopyInitialization check to variables initialized from free funct...
Felix Berger [Tue, 15 Sep 2020 12:44:13 +0000 (08:44 -0400)]
Restrict UnnecessaryCopyInitialization check to variables initialized from free functions without arguments

This restriction avoids cases where an alias is returned to an argument and
which could lead to to a false positive change.

14 months ago[libc++] Allow building without threads in standalone builds
Louis Dionne [Tue, 15 Sep 2020 12:43:08 +0000 (08:43 -0400)]
[libc++] Allow building without threads in standalone builds

Setting _LIBCPP_HAS_NO_THREADS is needed when building libcxxabi without
threads in standalone mode. This is useful when target WASM. Otherwise,
you get an error like "No thread API" when building libcxxabi.

It would be better to link against a properly-configured libc++ headers
CMake target when building libc++abi instead, but we don't generate such
targets yet.

Thanks to Matthew Bauer for the patch.

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

14 months agoLoopCacheAnalysis.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 12:34:19 +0000 (13:34 +0100)]
LoopCacheAnalysis.h - remove unnecessary includes. NFCI.

More remaining dependencies down to LoopCacheAnalysis.cpp

14 months agoProvenanceAnalysis.h - remove unnecessary AliasAnalysis.h include. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 12:09:03 +0000 (13:09 +0100)]
ProvenanceAnalysis.h - remove unnecessary AliasAnalysis.h include. NFCI.

Forward declare AAResults instead of the (old) AliasAnalysis type.

14 months agoAliasSetTracker.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:59:00 +0000 (12:59 +0100)]
AliasSetTracker.cpp - remove unnecessary includes. NFCI.

These are all directly included in AliasSetTracker.h

14 months ago[ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount
Sjoerd Meijer [Tue, 15 Sep 2020 12:10:30 +0000 (13:10 +0100)]
[ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount

Loop tripcount expressions have a positive range, so use unsigned SCEV ranges
for them.

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

14 months ago[Scalarizer] Avoid changing name of non-instructions
Bjorn Pettersson [Mon, 14 Sep 2020 20:53:54 +0000 (22:53 +0200)]
[Scalarizer] Avoid changing name of non-instructions

The "takeName" logic in ScalarizerVisitor::gather did not consider
that the value vector could refer to non-instructions, such as
global variables. This patch make sure that we avoid changing the
name of a value if it isn't an instruction.

Reviewed By: lebedev.ri

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

14 months ago[lldb] Improve qemu interop for aarch64
Pavel Labath [Tue, 15 Sep 2020 11:20:09 +0000 (13:20 +0200)]
[lldb] Improve qemu interop for aarch64

qemu calls the "fp" and "lr" registers via their generic names
(x29/x30). This mismatch manifested itself as not being able to unwind
or display values of some local variables.

14 months ago[lldb/cmake] Fix testing support library dependencies
Pavel Labath [Fri, 28 Aug 2020 10:31:16 +0000 (12:31 +0200)]
[lldb/cmake] Fix testing support library dependencies

lldbUtilityHelpers does not depend on lldbSymbolHelpers. Remove that
dependency, and add direct lldbSymbolHelpers dependencies where needed.

14 months agoRevert "RegAllocFast: Record internal state based on register units"
Hans Wennborg [Tue, 15 Sep 2020 08:47:02 +0000 (10:47 +0200)]
Revert "RegAllocFast: Record internal state based on register units"

This seems to have caused incorrect register allocation in some cases,
breaking tests in the Zig standard library (PR47278).

As discussed on the bug, revert back to green for now.

> Record internal state based on register units. This is often more
> efficient as there are typically fewer register units to update
> compared to iterating over all the aliases of a register.
> Original patch by Matthias Braun, but I've been rebasing and fixing it
> for almost 2 years and fixed a few bugs causing intermediate failures
> to make this patch independent of the changes in
> https://reviews.llvm.org/D52010.

This reverts commit 66251f7e1de79a7c1620659b7f58352b8c8e892e, and
follow-ups 931a68f26b9a3de853807ffad7b2cd0a2dd30922
and 0671a4c5087d40450603d9d26cf239f1a8b1367e. It also adjust some
test expectations.

14 months agoSpillPlacement.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:18:06 +0000 (12:18 +0100)]
SpillPlacement.cpp - remove unnecessary includes. NFCI.

These are all directly included in SpillPlacement.h

14 months agoStatepointLowering.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:00:21 +0000 (12:00 +0100)]
StatepointLowering.cpp - remove unnecessary includes. NFCI.

These are all directly included in StatepointLowering.h