platform/upstream/llvm.git
4 years ago[MLIR] Introduce an op trait that defines a new scope for auto allocation
Uday Bondhugula [Thu, 9 Apr 2020 09:46:24 +0000 (15:16 +0530)]
[MLIR] Introduce an op trait that defines a new scope for auto allocation

Introduce a new operation property / trait (AutomaticAllocationScope)
for operations with regions that define a new scope for automatic allocations;
such allocations (typically realized on stack) are automatically freed when
control leaves such ops' regions. std.alloca's are freed at the closest
surrounding op that has this trait. All FunctionLike operations should normally
have this trait.

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

4 years agoRevert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."
Mehdi Amini [Fri, 10 Apr 2020 06:25:06 +0000 (06:25 +0000)]
Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This reverts commit a90374988e4eb8c50d91e11f4e61cdbd5debb235 and 5da1671bf82306b7fa8dca48f495896c2b29e909.

A new dependency is introduced here from Support to IR which seems like
a layering violation. It also breaks the MLIR build at the moment.

4 years ago[PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop comments
Kang Zhang [Fri, 10 Apr 2020 06:09:01 +0000 (06:09 +0000)]
[PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop comments

Summary:
The patch D63957 is to avoid empty string when scrubbing loop comments,
it will replace loop comments to a `#`, that's correct.
But if the line has something else not only loop comments, we will get
a extra `#`.
The patch is to remove the extra `#`.

Reviewed By: jsji

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

4 years ago[PowerPC] Update alignment for ReuseLoadInfo in LowerFP_TO_INTForReuse
Kai Luo [Fri, 10 Apr 2020 05:34:05 +0000 (05:34 +0000)]
[PowerPC] Update alignment for ReuseLoadInfo in LowerFP_TO_INTForReuse

In LowerFP_TO_INTForReuse, when emitting `stfiwx`, alignment of 4 is
set for the `MachineMemOperand`, but RLI(ReuseLoadInfo)'s alignment is
not updated for following loads.

It's related to failed alignment check reported in
https://bugs.llvm.org/show_bug.cgi?id=45297

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

4 years agoRename OptimalLayout to OptimizedStructLayout at Chris's request.
John McCall [Fri, 10 Apr 2020 04:13:49 +0000 (00:13 -0400)]
Rename OptimalLayout to OptimizedStructLayout at Chris's request.

4 years agollvm-dwarfdump: Return non-zero on error
David Blaikie [Fri, 10 Apr 2020 03:53:58 +0000 (20:53 -0700)]
llvm-dwarfdump: Return non-zero on error

Makes it easier to test "this doesn't produce an error" (& indeed makes
that the implied default so we don't accidentally write tests that have
silent/sneaky errors as well as the positive behavior we're testing for)

Though the support for applying relocations is patchy enough that a
bunch of tests treat lack of relocation application as more of a warning
than an error - so rather than me trying to figure out how to add
support for a bunch of relocation types, let's degrade that to a warning
to match the usage (& indeed, it's sort of more of a tool warning anyway
- it's not that the DWARF is wrong, just that the tool can't fully cope
with it - and it's not like the tool won't dump the DWARF, it just won't
follow/render certain relocations - I guess in the most general case it
might try to render an unrelocated value & instead render something
bogus... but mostly seems to be about interesting relocations used in
eh_frame (& honestly it might be nice if we were lazier about doing this
relocation resolution anyway - if you're not dumping eh_frame, should we
really be erroring about the relocations in it?))

4 years ago[libc] Change minimum cmake requirement.
Paula Toth [Fri, 10 Apr 2020 03:41:22 +0000 (20:41 -0700)]
[libc] Change minimum cmake requirement.

Summary: As per this thread: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140744.html, changed the minimum requirement to reflect the decision made to upgrade to cmake 3.13.4.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[gn build] Port 4275eb13315
LLVM GN Syncbot [Fri, 10 Apr 2020 03:20:36 +0000 (03:20 +0000)]
[gn build] Port 4275eb13315

4 years ago[PowerPC] Bail out of redundant LI elimination on an implicit kill
Nemanja Ivanovic [Fri, 10 Apr 2020 02:34:30 +0000 (21:34 -0500)]
[PowerPC] Bail out of redundant LI elimination on an implicit kill

The transformation currently does not differentiate between explicit
and implicit kills. However, it is not valid to later simply clear
an implicit kill flag since the kill could be due to a call or return.

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

4 years agoRe-land [Codegen/Statepoint] Allow usage of registers for non gc deopt values.
Serguei Katkov [Thu, 9 Apr 2020 11:40:53 +0000 (18:40 +0700)]
Re-land [Codegen/Statepoint] Allow usage of registers for non gc deopt values.

The change introduces the usage of physical registers for non-gc deopt values.
This require runtime support to know how to take a value from register.
By default usage is off and can be switched on by option.

The change also introduces additional fix-up patch which forces the spilling
of caller saved registers (clobbered after the call) and re-writes statepoint
to use spill slots instead of caller saved registers.

Reviewers: reames, danstrushin
Reviewed By: dantrushin
Subscribers: mgorny, hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D77797

4 years ago[OpenMP] Allow <math.h> to go first in C++-mode in target regions
Johannes Doerfert [Fri, 10 Apr 2020 03:10:16 +0000 (22:10 -0500)]
[OpenMP] Allow <math.h> to go first in C++-mode in target regions

If we are in C++ mode and include <math.h> (not <cmath>) first, we still
need to make sure <cmath> is read first. The problem otherwise is that
we haven't seen the declarations of the math.h functions when the system
math.h includes our cmath overlay. However, our cmath overlay, or better
the underlying overlay, e.g. CUDA, uses the math.h functions. Since we
haven't declared them yet we get errors. CUDA avoids this by eagerly
declaring all math functions (in the __device__ space) but we cannot do
this. Instead we break the dependence by forcing cmath to go first.

Reviewed By: JonChesterfield

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

4 years ago[OpenMP] Put old APIs back and added new _async series for backward compatibility
Shilei Tian [Fri, 10 Apr 2020 02:40:30 +0000 (22:40 -0400)]
[OpenMP] Put old APIs back and added new _async series for backward compatibility

Summary: According to comments on bi-weekly meeting, this patch put back old APIs and added new `_async` series

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, openmp-commits

Tags: #openmp

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

4 years ago[LoopLoadElim] Fix crash by always checking simplify form
Max Kazantsev [Fri, 10 Apr 2020 01:48:29 +0000 (08:48 +0700)]
[LoopLoadElim] Fix crash by always checking simplify form

Loop simplify form should always be checked because logic of
propagateStoredValueToLoadUsers relies on it (in particular, it
requires preheader).

Reviewed By: Fedor Sergeev, Florian Hahn
Differential Revision: https://reviews.llvm.org/D77775

4 years ago[WebAssembly] Use dummy debug info in Emscripten SjLj
Heejin Ahn [Wed, 8 Apr 2020 23:02:25 +0000 (16:02 -0700)]
[WebAssembly] Use dummy debug info in Emscripten SjLj

Summary:
D74269 added debug info to newly created instructions, including calls
to `malloc` and `free`, by taking debug info from existing instructions
around, whose debug info may or may not be empty.

But there are cases debug info is required by the IR verifier: when both
the caller and the callee functions have DISubprograms, meaning we
already have declarations to `malloc` or `free` with a DISubprogram
attached, newly created calls to `malloc` and `free` should have
non-empty debug info. This patch creates a non-empty dummy debug info in
this case to those calls to make the IR verifier pass.

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

Reviewers: dschuff

Subscribers: aprantl, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years agoUpdate empty() call with namespace to clear ambiguity.
Alina Sbirlea [Fri, 10 Apr 2020 01:37:13 +0000 (18:37 -0700)]
Update empty() call with namespace to clear ambiguity.

4 years agoMake BitVector::operator== return false for different-sized vectors.
Brad Moody [Fri, 10 Apr 2020 01:15:49 +0000 (20:15 -0500)]
Make BitVector::operator== return false for different-sized vectors.

This behaviour is in line with SmallBitVector and other vector-like
types.

Reviewed By: dblaikie

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

4 years ago[TLI] Per-function fveclib for math library used for vectorization
Wenlei He [Tue, 7 Apr 2020 06:54:14 +0000 (23:54 -0700)]
[TLI] Per-function fveclib for math library used for vectorization

Summary:
Encode `-fveclib` setting as per-function attribute so it can threaded through to LTO backends. Accordingly per-function TLI now reads
the attributes and select available vector function list based on that. Now we also populate function list for all supported vector
libraries for the shared per-module `TargetLibraryInfoImpl`, so each function can select its available vector list independently but without
duplicating the vector function lists. Inlining between incompatbile vectlib attributed is also prohibited now.

Subscribers: hiraditya, dexonsmith, cfe-commits

Tags: #clang

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

4 years ago[PowerPC][Future] Fix for 6c4b40def77622a5cf62a219ef4af63dc876e144
Stefan Pintilie [Fri, 10 Apr 2020 01:04:13 +0000 (01:04 +0000)]
[PowerPC][Future] Fix for 6c4b40def77622a5cf62a219ef4af63dc876e144

This is a fix for the previous patch 6c4b40def77622a5cf62a219ef4af63dc876e144.
In some cases it may be possible to have the compiler produce st_other=1 without
the compiler using mcpu=future which should not be the case. This patch adds a
guard to make sure that if we are using st_other=1 then we are also compiling
for future CPU.

4 years ago[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.
Alina Sbirlea [Thu, 27 Feb 2020 00:53:12 +0000 (16:53 -0800)]
[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

Summary:
This replaces the ChildrenGetter inside the DominatorTree with
GraphTraits over a GraphDiff object, an object which encapsulated the
view of the previous CFG.
This also simplifies the extentions in clang which use DominatorTree, as
GraphDiff also filters nullptrs.

Reviewers: kuhar, dblaikie, NutshellySima

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang

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

4 years ago[ORC] Require JITDylib to be specified when adding IR and objects in the C API.
Lang Hames [Fri, 10 Apr 2020 00:54:59 +0000 (17:54 -0700)]
[ORC] Require JITDylib to be specified when adding IR and objects in the C API.

4 years ago[gn build] Port 1229245df7c
LLVM GN Syncbot [Fri, 10 Apr 2020 00:51:20 +0000 (00:51 +0000)]
[gn build] Port 1229245df7c

4 years ago[clangd] Set up machinery for gtests of ClangdLSPServer.
Sam McCall [Thu, 9 Apr 2020 00:02:29 +0000 (02:02 +0200)]
[clangd] Set up machinery for gtests of ClangdLSPServer.

Summary:
This is going to be needed to test e.g. diagnostics regeneration on
didSave where files changed on disk. Coordinating such changes is too
hard in lit tests.

Reviewers: kadircet

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[X86] Improve min/max reduction costs.
Craig Topper [Thu, 9 Apr 2020 23:58:28 +0000 (16:58 -0700)]
[X86] Improve min/max reduction costs.

This is similar to what I recently did for getArithmeticReductionCost.

I'm trying to account for the narrowing from 512->256->128 as we go.

I've also added a new helper method getMinMaxCost that tries to
handle the cases where we have native min/max instructions and
fall back to cmp+select when we don't.

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

4 years ago[PowerPC] Don't assert on SELECT_CC with i1 type
Nemanja Ivanovic [Thu, 9 Apr 2020 18:53:02 +0000 (13:53 -0500)]
[PowerPC] Don't assert on SELECT_CC with i1 type

When we try to select a SELECT_CC on Power9, we check if it can be matched to a
SETB instruction. In that function, we assert that the output type is i32/i64.
This is unnecessary as it is perfectly reasonable to have an i1 SELECT_CC.
Change that from an assert to an early exit condition.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=45448

4 years ago[AArch64][GlobalISel] CallLowering: Don't generate new copies each time we need
Amara Emerson [Thu, 9 Apr 2020 21:35:40 +0000 (14:35 -0700)]
[AArch64][GlobalISel] CallLowering: Don't generate new copies each time we need
to store to a stack location for outgoing args.

During call arg lowering we shouldn't be modifying SP so cache the SP copy
vreg for subsequent uses.

Gives a 0.2% geomean code size improvement on CTMark.

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

4 years ago[llvm][Codegen] Make `getVectorTypeBreakdownMVT` work with scalable types.
Francesco Petrogalli [Thu, 9 Apr 2020 23:10:52 +0000 (00:10 +0100)]
[llvm][Codegen] Make `getVectorTypeBreakdownMVT` work with scalable types.

Reviewers: efriedma, andwar, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 23:15:49 +0000 (16:15 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: mcrosier, efriedma, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ORC] Add C API support for adding object files to an LLJIT instance.
Lang Hames [Thu, 9 Apr 2020 23:17:04 +0000 (16:17 -0700)]
[ORC] Add C API support for adding object files to an LLJIT instance.

4 years ago[ORC] Expand the OrcV2 C API bindings.
Lang Hames [Thu, 9 Apr 2020 19:15:13 +0000 (12:15 -0700)]
[ORC] Expand the OrcV2 C API bindings.

Adds basic support for LLJITBuilder and DynamicLibrarySearchGenerator. This
allows C API clients to configure LLJIT to expose process symbols to JIT'd
code. An example of this is added in
llvm/examples/OrcV2CBindingsReflectProcessSymbols.

4 years ago[gn build] Port a79b2fc44bf
LLVM GN Syncbot [Thu, 9 Apr 2020 22:50:22 +0000 (22:50 +0000)]
[gn build] Port a79b2fc44bf

4 years ago[libunwind] Clean up __arm64__
Fangrui Song [Thu, 9 Apr 2020 21:09:43 +0000 (14:09 -0700)]
[libunwind] Clean up __arm64__

`__aarch64__` is defined for the target (since the beginning of arm64 support: clang 3.5).
`__arm64__` is only defined for the Darwin OS on AArch64.

`defined(__aarch64__) || defined(__arm64__)` can be simplied as `defined(__aarch64__)`

Darwin AArch64 uses %% as the assembly separator (see AArch64MCAsmInfo.cpp).
Make the intention explicit in src/assembly.h

With this change, the libunwind code base has no reference of `__arm64__`/`__arm64`.

Reviewed By: #libunwind, ldionne, mstorsjo

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

4 years agoAdd pass to strip debug info from MIR
Daniel Sanders [Wed, 8 Apr 2020 17:27:17 +0000 (10:27 -0700)]
Add pass to strip debug info from MIR

Summary:
Removes:
* All LLVM-IR level debug info using StripDebugInfo()
* All debugify metadata
* 'Debug Info Version' module flag
* All (valid*) DEBUG_VALUE MachineInstrs
* All DebugLocs from MachineInstrs

This is a more complete solution than the previous MIRPrinter
option that just causes it to neglect to print debug-locations.

* The qualifier 'valid' is used here because AArch64 emits
  an invalid one and tests depend on it

Reviewers: vsk, aprantl, bogner

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Reformat 'Fix breakage introduced by llvm::LoadInst api change' (NFC)
Med Ismail Bennani [Thu, 9 Apr 2020 22:36:20 +0000 (00:36 +0200)]
[lldb] Reformat 'Fix breakage introduced by llvm::LoadInst api change' (NFC)

4 years agotweak formatting of input to match the output as suggested by River, NFC.
Chris Lattner [Thu, 9 Apr 2020 22:25:53 +0000 (15:25 -0700)]
tweak formatting of input to match the output as suggested by River, NFC.

4 years ago[Tools] Fixed bug with llvm/utils/chunk-print-before-all.py script.
Kirill Naumov [Fri, 20 Mar 2020 15:26:30 +0000 (15:26 +0000)]
[Tools] Fixed bug with llvm/utils/chunk-print-before-all.py script.

Prior to the fix, the script was not annotating the first line of
chunk-0.ll. Because of that, a compilation with ./bin/opt was failing.

The extra if-statement ensures that the corner case is covered

Reviewed-By: apilipenko
Differential Revision: https://reviews.llvm.org/D76507

4 years agoAllow single-bit integer types to have signs. A signed one bit integer is either...
Chris Lattner [Thu, 9 Apr 2020 21:58:28 +0000 (14:58 -0700)]
Allow single-bit integer types to have signs.  A signed one bit integer is either 0 or -1.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Fix breakeage introduced by llvm::LoadInst api change
Med Ismail Bennani [Thu, 9 Apr 2020 22:10:22 +0000 (00:10 +0200)]
[lldb] Fix breakeage introduced by llvm::LoadInst api change

4 years ago[llvm][NFC] Replace CallSite with CallBase in Inliner
Mircea Trofin [Thu, 9 Apr 2020 18:28:41 +0000 (11:28 -0700)]
[llvm][NFC] Replace CallSite with CallBase in Inliner

Summary:
*Almost* all uses are replaced. Left FIXMEs for the two sites that
require refactoring outside of Inliner, to scope this patch.

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 21:19:08 +0000 (14:19 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: efriedma, sdesmalen, rriddle

Reviewed By: sdesmalen

Subscribers: hiraditya, dantrushin, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Fix recursive instantiation in std::array.
Eric Fiselier [Thu, 9 Apr 2020 21:39:40 +0000 (17:39 -0400)]
[libc++] Fix recursive instantiation in std::array.

The use of the `&& ...` fold expression in std::array's deduction guides
recursively builds a set of binary operator expressions of depth N where
`N` is the number of elements in the initializer.

This is problematic because arrays may be large, and instantiation
depth is limited.

This patch addresses the issue by flattening the SFINAE using
the existing `__all` type trait.

4 years agoscudo: Replace ALIGNED macro with standard alignas specifier.
Peter Collingbourne [Thu, 9 Apr 2020 20:37:27 +0000 (13:37 -0700)]
scudo: Replace ALIGNED macro with standard alignas specifier.

alignas was introduced in C++11 and is already being used throughout LLVM.

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

4 years ago[MS] Mark vbase dtors used when marking dtor used
Reid Kleckner [Tue, 11 Feb 2020 00:16:17 +0000 (16:16 -0800)]
[MS] Mark vbase dtors used when marking dtor used

In the MS C++ ABI, the complete destructor variant for a class with
virtual bases is emitted whereever it is needed, instead of directly
alongside the base destructor variant. The complete destructor calls the
base destructor of the current class and the base destructors of each
virtual base. In order for this to work reliably, translation units that
use the destructor of a class also need to mark destructors of virtual
bases of that class used.

Fixes PR38521

Reviewed By: rsmith

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

4 years ago[NFC] Make Type::isVectorTy call isa<VectorType>
Christopher Tetreault [Thu, 9 Apr 2020 20:52:54 +0000 (13:52 -0700)]
[NFC] Make Type::isVectorTy call isa<VectorType>

Reviewers: sdesmalen, efriedma, dexonsmith

Reviewed By: efriedma

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

4 years ago[SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool-flag
Pratyai Mazumder [Thu, 9 Apr 2020 09:41:58 +0000 (02:41 -0700)]
[SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool-flag

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoFix syntax error
Christopher Tetreault [Thu, 9 Apr 2020 20:46:05 +0000 (13:46 -0700)]
Fix syntax error

4 years ago[opaque pointer types] Remove deprecated Instruction/IRBuilder APIs.
Eli Friedman [Sat, 4 Apr 2020 01:02:15 +0000 (18:02 -0700)]
[opaque pointer types] Remove deprecated Instruction/IRBuilder APIs.

Removes deprecated overloads of LoadInst constructor, CallInst::create,
InvokeInst::Create, IRBuilder::CreateCall, IRBuilder::CreateInvoke.
(Leaving around deprecated IRBuilder::CreateLoad for now.)

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

4 years ago[mlir][Vector] Update lowering of vector ops to llvm intrinsics to use row-major.
Nicolas Vasilache [Thu, 9 Apr 2020 20:36:45 +0000 (16:36 -0400)]
[mlir][Vector] Update lowering of vector ops to llvm intrinsics to use row-major.

Summary:
LLVM matrix intrinsics recently introduced an option to support row-major mode.
This matches the MLIR vector model, this revision switches to row-major.

A corner case related to degenerate sizes was also fixed upstream.
This revision removes the guard against this corner case.

A bug was uncovered on the output vector construction which this revision also fixes.

Lastly, this has been tested on a small size and benchmarked independently: no visible performance regression is observed.

In the future, when matrix intrinsics support per op attribute, we can more aggressively translate to that and avoid inserting MLIR-level transposes.

This has been tested independently to work on small matrices.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 20:13:41 +0000 (13:13 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: rriddle, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix an unused-variable warning in Release mode.
James Y Knight [Thu, 9 Apr 2020 20:34:14 +0000 (16:34 -0400)]
Fix an unused-variable warning in Release mode.

4 years ago[opaque pointers] Fix uses of deprecated CreateCall/CreateInvoke.
Eli Friedman [Sat, 4 Apr 2020 04:27:00 +0000 (21:27 -0700)]
[opaque pointers] Fix uses of deprecated CreateCall/CreateInvoke.

4 years ago[mlir][Vector] Add lowering of 1-D vector transfer_read/write to masked load/store
Nicolas Vasilache [Thu, 9 Apr 2020 20:16:32 +0000 (16:16 -0400)]
[mlir][Vector] Add lowering of 1-D vector transfer_read/write to masked load/store

Summary:
This revision adds support to lower 1-D vector transfers to LLVM.
A mask of the vector length is created that compares the base offset + linear index to the dim of the vector.
In each position where this does not overflow (i.e. offset + vector index < dim), the mask is set to 1.

A notable fact is that the lowering uses llvm.dialect_cast to allow writing code in the simplest form by targeting the simplest mix of vector and LLVM dialects and
letting other conversions kick in.

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

4 years ago[flang] [NFC] Adjust README.md for upstreaming.
David Truby [Thu, 9 Apr 2020 20:12:54 +0000 (21:12 +0100)]
[flang] [NFC] Adjust README.md for upstreaming.

This changes the references and build instructions for Flang so that
they are correct now that F18 has been rechristened Flang and merged
with LLVM.

Reviewed at: https://github.com/flang-compiler/f18/pull/909

4 years ago[mlir][test] NFC - Rename cblas to mlir_test_cblas
Nicolas Vasilache [Thu, 9 Apr 2020 19:29:06 +0000 (15:29 -0400)]
[mlir][test] NFC - Rename cblas to mlir_test_cblas

The "cblas" lib under mlir/test is meant as a simple integration demonstration.
However it is installed and ends up conflicting with external projects who want to
define the real cblas.
Rename to avoid conflicts.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 20:01:05 +0000 (13:01 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: arsenm, efriedma, sdesmalen

Reviewed By: arsenm

Subscribers: wdng, arsenm, jvesely, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to...
ADRA [Thu, 9 Apr 2020 20:02:38 +0000 (13:02 -0700)]
[CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments

Summary:
* accept -x cu to indicate language is CUDA
* transfer CUDA language flag to header-file arguments

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

4 years agoFix lifetime call in landingpad blocking Simplifycfg pass
Zequan Wu [Thu, 9 Apr 2020 18:06:19 +0000 (11:06 -0700)]
Fix lifetime call in landingpad blocking Simplifycfg pass

Fix lifetime call in landingpad blocks simplifycfg from removing the
landingpad.

Reviewed By: rnk

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

4 years ago[lld][WebAssembly] Handle 4gb max memories
Thomas Lively [Fri, 3 Apr 2020 23:18:29 +0000 (16:18 -0700)]
[lld][WebAssembly] Handle 4gb max memories

Summary:
A previous change (53211a) had updated the argument parsing to handle
large max memories, but 4294967296 would still wrap to zero after the
options were parsed. This change updates the configuration to use a
64-bit integer to store the max memory to avoid that overflow.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[lldb/test] Fix typo to disable reproducer's test phase
Med Ismail Bennani [Thu, 9 Apr 2020 19:54:17 +0000 (21:54 +0200)]
[lldb/test] Fix typo to disable reproducer's test phase

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 19:43:18 +0000 (12:43 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: grosbach, efriedma, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, dmgreen, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.
River Riddle [Thu, 9 Apr 2020 19:38:52 +0000 (12:38 -0700)]
[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.

Summary: Some pattern rewriters, like dialect conversion, prohibit the unbounded recursion(or reapplication) of patterns on generated IR. Most patterns are not written with recursive application in mind, so will generally explode the stack if uncaught. This revision adds a hook to RewritePattern, `hasBoundedRewriteRecursion`, to signal that the pattern can safely be applied to the generated IR of a previous application of the same pattern. This allows for establishing a contract between the pattern and rewriter that the pattern knows and can handle the potential recursive application.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 19:19:23 +0000 (12:19 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: sunfish, sdesmalen, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-objdump][NFC] MachODump.cpp interface cleanup
Hubert Tong [Thu, 9 Apr 2020 19:32:09 +0000 (15:32 -0400)]
[llvm-objdump][NFC] MachODump.cpp interface cleanup

Continuing from D77388, this patch moves interface declarations
associated with `MachODump.cpp` into the headers corresponding to the
file that defines the variable. At the same time, these externs are
moved into the `llvm::objdump` namespace. The externs defined in
`MachODump.cpp` that are not referenced outside of it are given internal
linkage.

This patch does not rename the external functions defined by
`MachODump.cpp` that are not clearly named as being specific to Mach-O.

Reviewed By: jhenderson, MaskRay

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

4 years ago[PowerPC][Future] Fix for 75828ef615da
Stefan Pintilie [Thu, 9 Apr 2020 19:31:37 +0000 (19:31 +0000)]
[PowerPC][Future] Fix for 75828ef615da

Used unsigned long where uint64_t should have been used by mistake.
Fixed in this patch.

4 years ago[lldb] Disable failing register tests for reproducers
Med Ismail Bennani [Thu, 9 Apr 2020 19:05:17 +0000 (21:05 +0200)]
[lldb] Disable failing register tests for reproducers

4 years ago[CostModel][X86] Add shuffle costs for some common sub-128bit vectors
Simon Pilgrim [Thu, 9 Apr 2020 18:55:51 +0000 (19:55 +0100)]
[CostModel][X86] Add shuffle costs for some common sub-128bit vectors

v2i8/v4i8/v8i8 + v2i16/v4i16 all show up in vectorizer code and by just using the legalized types (v16i8/v8i16) we're highly exaggerating the actual cost of the shuffle.

4 years ago[nfc] [lldb] Unindent code
Jan Kratochvil [Thu, 9 Apr 2020 18:43:00 +0000 (20:43 +0200)]
[nfc] [lldb] Unindent code

It removes some needless deep indentation and some redundant statements.
It prepares the code for a more clean next patch - DWARF index callbacks
D77327.

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

4 years agoPreserve the owning module information from DWARF in the synthesized AST
Adrian Prantl [Wed, 4 Mar 2020 17:30:12 +0000 (09:30 -0800)]
Preserve the owning module information from DWARF in the synthesized AST

Types that came from a Clang module are nested in DW_TAG_module tags
in DWARF. This patch recreates the Clang module hierarchy in LLDB and
1;95;0csets the owning module information accordingly. My primary motivation
is to facilitate looking up per-module APINotes for individual
declarations, but this likely also has other applications.

This reapplies the previously reverted commit, but without support for
ClassTemplateSpecializations, which I'm going to look into separately.

rdar://problem/59634380

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

4 years ago[lldb/Reproducers] Add a small artificial delay before exiting
Jonas Devlieghere [Thu, 9 Apr 2020 18:01:33 +0000 (11:01 -0700)]
[lldb/Reproducers] Add a small artificial delay before exiting

Add a small artificial delay in replay mode before exiting to ensure
that all asynchronous events have completed. This should reduce the
level of replay flakiness on some of the slower bots.

4 years ago[libc] Collect objects only from visible deps of an object library.
Siva Chandra Reddy [Wed, 1 Apr 2020 23:05:55 +0000 (16:05 -0700)]
[libc] Collect objects only from visible deps of an object library.

A typo in an earlier change allowed this check to be missed.

Reviewers: abrachet

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

4 years ago[flang] Temporarily XFAIL failing test Fir/fir-ops.fir
David Truby [Thu, 9 Apr 2020 17:35:49 +0000 (18:35 +0100)]
[flang] Temporarily XFAIL failing test Fir/fir-ops.fir

4 years ago[clang-tidy] misc-unused-parameters: Don't remove parameter from lambda
Matthias Gehre [Tue, 7 Apr 2020 21:36:53 +0000 (23:36 +0200)]
[clang-tidy] misc-unused-parameters: Don't remove parameter from lambda

Summary:
Previously, the check would fix
```
using fn = void(int);
void f(fn *);
void test() {
  // CHECK-MESSAGES: :[[@LINE+2]]:12: warning: parameter 'I' is unused
  // CHECK-FIXES: {{^}}  f([](int  /*I*/) {
  f([](int I) { return; });
}
```
into
`f([]() { return; });` which breaks compilation. Now the check is disabled from Lambdas.

The AST is not so easy to use. For
```
    auto l = [](int) {  return;  };
    f(l);
```
one gets
```
 `-CallExpr <line:7:5, col:8> 'void'
      |-ImplicitCastExpr <col:5> 'void (*)(fn *)' <FunctionToPointerDecay>
      | `-DeclRefExpr <col:5> 'void (fn *)' lvalue Function 0x55a91a545e28 'f' 'void (fn *)'
      `-ImplicitCastExpr <col:7> 'void (*)(int)' <UserDefinedConversion>
        `-CXXMemberCallExpr <col:7> 'void (*)(int)'
          `-MemberExpr <col:7> '<bound member function type>' .operator void (*)(int) 0x55a91a546850
            `-ImplicitCastExpr <col:7> 'const (lambda at line:6:14)' lvalue <NoOp>
              `-DeclRefExpr <col:7> '(lambda at line:6:14)':'(lambda at line:6:14)' lvalue Var 0x55a91a5461c0 'l' '(lambda at line:6:14)':'(lambda at line:6:14)'
```
There is no direct use of the `operator()(int I)` of the lambda, so the `!Indexer->getOtherRefs(Function).empty()`
does not fire. In the future, we might be able to use the conversion operator `operator void (*)(int)` to mark
the call operator as having an "other ref".

Reviewers: aaron.ballman, alexfh, hokein, njames93

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[RISCV] Add Clang frontend support for Bitmanip extension
Scott Egerton [Thu, 9 Apr 2020 16:51:26 +0000 (17:51 +0100)]
[RISCV] Add Clang frontend support for Bitmanip extension

This adds the __riscv_bitmanip macro and the 'b' target feature to enable it.

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

4 years ago[RISCV] Support experimental/unratified extensions
Simon Cook [Thu, 9 Apr 2020 16:51:16 +0000 (17:51 +0100)]
[RISCV] Support experimental/unratified extensions

This adds support for enabling experimental/unratified RISC-V ISA
extensions in the -march string in the case where an explicit version
number has been declared, and the -menable-experimental-extensions flag
has been provided.

This follows the design as discussed on the mailing lists in the
following RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-January/138364.html

Since the RISC-V toolchain definition currently rejects any extension
with an explicit version number, the parsing logic has been tweaked to
support this, and to allow standard extensions to have their versions
checked in future patches.

The bitmanip 'b' extension has been added as a first use of this support,
it should easily extend to other as yet unratified extensions (such as
the vector 'v' extension).

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

4 years ago[RISCV] Add MC layer support for proposed Bit Manipulation extension (version 0.92)
Paolo Savini [Thu, 9 Apr 2020 16:51:10 +0000 (17:51 +0100)]
[RISCV] Add MC layer support for proposed Bit Manipulation extension (version 0.92)

This adds the instruction encoding and mnenomics for the proposed
RISC-V Bit Manipulation extension (version 0.92). It is implemented with
each category of instruction as its own target feature, with the 'b'
extension feature enabling all options. Since this extension is not yet
ratified, all target features are prefixed with 'experimental-' to note
their status.

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

4 years ago[libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms
Louis Dionne [Wed, 8 Apr 2020 19:26:31 +0000 (15:26 -0400)]
[libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms

These scripts allow creating dylibs that are very close to the dylibs
shipped on Apple platforms.

4 years ago[PPC][AIX] Implement variadic function handling in LowerFormalArguments_AIX
jasonliu [Thu, 9 Apr 2020 15:52:57 +0000 (15:52 +0000)]
[PPC][AIX] Implement variadic function handling in LowerFormalArguments_AIX

Summary:
This patch adds support for handling of variadic functions for AIX.
This includes ensuring that use and consume correct type of
va_list (char *va_list) for AIX.

Authored by: ZarkoCA

Reviewers: cebowleratibm, sfertile, jasonliu

Reviewed by: jasonliu

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

4 years ago[PowerPC][Future] Initial support for PCRel addressing for constant pool loads
Stefan Pintilie [Thu, 9 Apr 2020 16:17:23 +0000 (11:17 -0500)]
[PowerPC][Future] Initial support for PCRel addressing for constant pool loads

Add initial support for PC Relative addressing for constant pool loads.
This includes adding a new relocation for @pcrel and adding a new PowerPC flag
to identify PC relative addressing.

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

4 years ago[VE] Support (m)0 and (m)1 operands
Kazushi (Jam) Marukawa [Thu, 9 Apr 2020 16:08:04 +0000 (18:08 +0200)]
[VE] Support (m)0 and (m)1 operands

Summary:
VE has special operands to represent 0b000...000111...111 (`(m)0`) and
0b111...111000...000 (`(m)1`) bit sequences.  This patch supports those
operands not only in machine instructions but also in DAG lowering.

Reviewed By: simoll

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

4 years ago[X86] Remove redundant VMOVDDUPZ128rmk/VMOVDDUPZ128rmkz isel patterns.
Craig Topper [Thu, 9 Apr 2020 15:33:51 +0000 (08:33 -0700)]
[X86] Remove redundant VMOVDDUPZ128rmk/VMOVDDUPZ128rmkz isel patterns.

These patterns are identical to the pattern for the instruction.

4 years ago[LV] Add VPValue operands to VPBlendRecipe (NFCI)
Gil Rapaport [Mon, 6 Apr 2020 11:02:34 +0000 (14:02 +0300)]
[LV] Add VPValue operands to VPBlendRecipe (NFCI)

InnerLoopVectorizer's code called during VPlan execution still relies on
original IR's def-use relations to decide which vector code to generate,
limiting VPlan transformations ability to modify def-use relations and still
have ILV generate the vector code.
This commit introduces VPValues for VPBlendRecipe to use as the values to
blend. The recipe is generated with VPValues wrapping the phi's incoming values
of the scalar phi. This reduces ingredient def-use usage by ILV as a step
towards full VPlan-based def-use relations.

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

4 years ago[flang] Add dependency on libSemantics to libEvaluate.
David Truby [Thu, 9 Apr 2020 15:39:18 +0000 (16:39 +0100)]
[flang] Add dependency on libSemantics to libEvaluate.

When building flang with LLVM HEAD, the unittests fail to link with ld.bfd or
ld.gold due to a linker ordering issue. Adding libSemantics as a dependency to
libEvaluate seems to fix that issue.

Reviewed at: https://github.com/flang-compiler/f18/pull/1104

4 years ago[SCCP] Add tests with AND/OR branch conditions.
Florian Hahn [Thu, 9 Apr 2020 15:36:51 +0000 (16:36 +0100)]
[SCCP] Add tests with AND/OR branch conditions.

4 years ago[OPENMP]Fix the test to pacify buildbots, NFC.
Alexey Bataev [Thu, 9 Apr 2020 15:28:02 +0000 (11:28 -0400)]
[OPENMP]Fix the test to pacify buildbots, NFC.

4 years ago[llvm][nfc] InstructionCostDetail encapsulation
Mircea Trofin [Wed, 8 Apr 2020 21:54:33 +0000 (14:54 -0700)]
[llvm][nfc] InstructionCostDetail encapsulation

Ensured initialized fields; encapsulad delta calulations and evaluation
of threshold having had changed; assertion for CostThresholdMap
dereference, to indicate design intent.

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

4 years ago[Flang] add flang as a new subproject in cmake
Eric Schweitz [Thu, 9 Apr 2020 15:13:11 +0000 (16:13 +0100)]
[Flang] add flang as a new subproject in cmake

Summary: This patch is some minor prep work for merging the flang(f18) project into the monorepo.  This patch adds "flang" as a supported target for the LLVM_ENABLE_PROJECTS option.

Reviewers: fhahn, tstellar, jdoerfert, beanz, DavidTruby

Reviewed By: DavidTruby

Subscribers: hfinkel, DavidTruby, aartbik, mgorny, llvm-commits

Tags: #flang, #llvm

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

4 years ago[flang] Merge flang-compiler/f18
David Truby [Thu, 9 Apr 2020 15:11:58 +0000 (16:11 +0100)]
[flang] Merge flang-compiler/f18

This is the initial merge of flang-compiler, which is done in this way
principally to preserve the history and git-blame, without generating a large
number of commits on the first-parent history of LLVM.

If you don't care about the flang history during a bisect remember that you can
supply paths to git-bisect, e.g. `git bisect start clang llvm`.

The history of f18 was rewritten to:

* Put the code under /flang/.
* Linearize the history.
* Rewrite commit messages so that issue and PR numbers point to the old repository.

Credit to Peter Waller for writing the flatten and merge script.

Updates: flang-compiler/f18#876 (submission into llvm-project)
Mailing-list: http://lists.llvm.org/pipermail/llvm-dev/2020-January/137989.html ([llvm-dev] Flang landing in the monorepo - next Monday!)
Mailing-list: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137661.html ([llvm-dev] Flang landing in the monorepo)

Co-authored-by: Peter Waller <peter.waller@arm.com>
4 years ago[ELF][test] Improve reproduce tests and enable for Windows
Andrew Ng [Wed, 8 Apr 2020 19:21:16 +0000 (20:21 +0100)]
[ELF][test] Improve reproduce tests and enable for Windows

This patch changes the reproduce tests so that they no longer extract
the "long" paths of the generated reproduce tar archives. This
extraction prevented them from being run on Windows due to potential
issues relating to the Windows path length limit.

This patch also reduces the use of diff in these tests, as this was
raised as a performance concern in review D77659 and deemed unnecessary.

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

4 years ago[flang] Remove flatten and merge upstreaming script.
David Truby [Mon, 6 Apr 2020 13:38:50 +0000 (14:38 +0100)]
[flang] Remove flatten and merge upstreaming script.

Original-commit: flang-compiler/f18@21f3c455e842e0dab4a92db7ed8282f08eac930d

4 years ago[flang] Adjust README.md for upstreaming to LLVM.
David Truby [Mon, 6 Apr 2020 13:38:20 +0000 (14:38 +0100)]
[flang] Adjust README.md for upstreaming to LLVM.

Original-commit: flang-compiler/f18@24d23963b879d6586a7e19b89a905341627fe5b1

4 years ago[LV] FoldTail w/o Primary Induction
Ayal Zaks [Mon, 6 Apr 2020 22:53:59 +0000 (01:53 +0300)]
[LV] FoldTail w/o Primary Induction

Introduce a new VPWidenCanonicalIVRecipe to generate a canonical vector
induction for use in fold-tail-with-masking, if a primary induction is absent.

The canonical scalar IV having start = 0 and step = VF*UF, created during code
-gen to control the vector loop, is widened into a canonical vector IV having
start = {<Part*VF, Part*VF+1, ..., Part*VF+VF-1> for 0 <= Part < UF} and
step = <VF*UF, VF*UF, ..., VF*UF>.

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

4 years ago[analyzer][AnalysisOrderChecker] Display the CallEvent type in preCall/postCall
Kirstóf Umann [Sun, 1 Mar 2020 16:49:44 +0000 (17:49 +0100)]
[analyzer][AnalysisOrderChecker] Display the CallEvent type in preCall/postCall

Exactly what it says on the tin! The included testfile demonstrates why this is
important -- for C++ dynamic memory operators, we don't always recognize custom,
or even standard-specified new/delete operators as CXXAllocatorCall or
CXXDeallocatorCall.

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

4 years ago[OPENMP]Fix capturing of global variables in OpenMP regions.
Alexey Bataev [Wed, 8 Apr 2020 13:49:10 +0000 (09:49 -0400)]
[OPENMP]Fix capturing of global variables in OpenMP regions.

Summary:
The global variable should be captured in the region only if it was
privitized in the region or in any of the outer regions. Otherwise, it
should not be captured.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years ago[InstCombine] remove stale FIXME comment; NFC
Sanjay Patel [Thu, 9 Apr 2020 14:33:27 +0000 (10:33 -0400)]
[InstCombine] remove stale FIXME comment; NFC

4 years ago[PowerPC][NFC] Add more check directives in only cxx_fast_tlscc lit test.
Sean Fertile [Fri, 3 Apr 2020 19:18:15 +0000 (15:18 -0400)]
[PowerPC][NFC] Add more check directives in only cxx_fast_tlscc lit test.

Use utils/update_llc_test_checks.py to add full CHECK directives to the
test for cxx_fast_tls calling convention. The calling convention is
arguably dead on PowerPC since dropping Darwin subtarget support in the PowerPC
backend. This test change helps show the atrocious code generation for
this lit test which was hidden by having few CHECK directives.

4 years ago[analyzer] Display the checker name in the text output
Kirstóf Umann [Fri, 20 Mar 2020 15:45:53 +0000 (16:45 +0100)]
[analyzer] Display the checker name in the text output

Exactly what it says on the tin! There is no reason I think not to have this.

Also, I added test files for checkers that emit warning under the wrong name.

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

4 years ago[RISCV] Implement evaluateBranch
Simon Cook [Thu, 9 Apr 2020 14:11:55 +0000 (15:11 +0100)]
[RISCV] Implement evaluateBranch

This implements the instruction analysis required to print branch
targets as part of llvm-objdump's disassembly.

Note, this only handles those branches which can be analyzed in a single
instruction, a future patch will handle multiple-instruction patterns,
such as AUIPC/LUI+JALR instruction pairs.

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

4 years ago[ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers
Nathan James [Mon, 6 Apr 2020 19:08:21 +0000 (20:08 +0100)]
[ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers

Summary: Requires hasCastKind arguments to have `CK_` prefixed to bring it in line with the documentation and other matchers that take enumerations.

Reviewers: klimek, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[analyzer] NFCi: Refactor CStringChecker: use strongly typed internal API
Balazs Benics [Thu, 9 Apr 2020 14:06:32 +0000 (16:06 +0200)]
[analyzer] NFCi: Refactor CStringChecker: use strongly typed internal API

Summary:
I wanted to extend the diagnostics of the CStringChecker with taintedness.
This requires the CStringChecker to be refactored to support a more flexible
reporting mechanism.

This patch does only refactorings, such:
 - eliminates always false parameters (like WarnAboutSize)
 - reduces the number of parameters
 - makes strong types differentiating *source* and *destination* buffers
   (same with size expressions)
 - binds the argument expression and the index, making diagnostics accurate
   and easy to emit
 - removes a bunch of default parameters to make it more readable
 - remove random const char* warning message parameters, making clear where
   and what is going to be emitted

Note that:
 - CheckBufferAccess now checks *only* one buffer, this removed about 100 LOC
   code duplication
 - not every function was refactored to use the /new/ strongly typed API, since
   the CString related functions are really closely coupled monolithic beasts,
   I will refactor them separately
 - all tests are preserved and passing; only the message changed at some places.
   In my opinion, these messages are holding the same information.

I would also highlight that this refactoring caught a bug in
clang/test/Analysis/string.c:454 where the diagnostic did not reflect reality.
This catch backs my effort on simplifying this monolithic CStringChecker.

Reviewers: NoQ, baloghadamsoftware, Szelethus, rengolin, Charusso

Reviewed By: NoQ

Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin,
mikhail.ramalho, donat.nagy, dkrupp, Charusso, martong, cfe-commits

Tags: #clang

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

4 years ago[OPENMP50] Fix PR45469: Consider variable-category of defaultmap clause as optional.
Alexey Bataev [Wed, 8 Apr 2020 19:19:54 +0000 (15:19 -0400)]
[OPENMP50] Fix PR45469: Consider variable-category of defaultmap clause as optional.

Summary:
According to the standard, variable-category is the optional part of the
defaultmap clause while the compiler always requires it. Turned it into
optional part.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years agoAdd a missing dependency to DebugInfoDWARF unit tests
Pavel Labath [Thu, 9 Apr 2020 13:36:51 +0000 (15:36 +0200)]
Add a missing dependency to DebugInfoDWARF unit tests

BinaryFormat was already being used for various constants, but as of
b761a648 it is alse used for code.

This should fix the shared library build.