platform/upstream/llvm.git
3 years ago[analyzer] Simplify the process of producing notes for stores
Valeriy Savchenko [Thu, 10 Jun 2021 17:18:40 +0000 (20:18 +0300)]
[analyzer] Simplify the process of producing notes for stores

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

3 years ago[analyzer] Extract InlinedFunctionCallHandler
Valeriy Savchenko [Wed, 9 Jun 2021 12:44:10 +0000 (15:44 +0300)]
[analyzer] Extract InlinedFunctionCallHandler

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

3 years ago[analyzer] Extract InterestingLValueHandler
Valeriy Savchenko [Tue, 8 Jun 2021 17:56:10 +0000 (20:56 +0300)]
[analyzer] Extract InterestingLValueHandler

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

3 years ago[analyzer] Extract ArrayIndexHandler
Valeriy Savchenko [Tue, 8 Jun 2021 17:29:57 +0000 (20:29 +0300)]
[analyzer] Extract ArrayIndexHandler

One interesting problem was discovered here.  When we do interrupt
Tracker's track flow, we want to interrupt only it and not all the
other flows recursively.

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

3 years ago[analyzer] Extract NilReceiverHandler
Valeriy Savchenko [Tue, 8 Jun 2021 15:43:16 +0000 (18:43 +0300)]
[analyzer] Extract NilReceiverHandler

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

3 years ago[analyzer] Extract ControlDependencyHandler
Valeriy Savchenko [Fri, 4 Jun 2021 08:59:27 +0000 (11:59 +0300)]
[analyzer] Extract ControlDependencyHandler

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

3 years ago[analyzer] Refactor StoreSiteFinder and extract DefaultStoreHandler
Valeriy Savchenko [Thu, 10 Jun 2021 12:44:49 +0000 (15:44 +0300)]
[analyzer] Refactor StoreSiteFinder and extract DefaultStoreHandler

After this patch, custom StoreHandlers will also work as expected.

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

3 years ago[clang-format] distinguish function type casts after 21c18d5a04316891110cecc2bf37ce51...
Krasimir Georgiev [Tue, 15 Jun 2021 08:28:25 +0000 (10:28 +0200)]
[clang-format] distinguish function type casts after 21c18d5a04316891110cecc2bf37ce51533decba

https://github.com/llvm/llvm-project/commit/21c18d5a04316891110cecc2bf37ce51533decba
improved the detection of multiplication in function call argument lists,
but unintentionally regressed the handling of function type casts (there
were no tests covering those).
This patch improves the detection of function type casts and adds a few tests.

Reviewed By: HazardyKnusperkeks

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

3 years ago[mlir][linalg] Fold linalg.pad_tensor if src type == result type
Matthias Springer [Tue, 15 Jun 2021 08:16:32 +0000 (17:16 +0900)]
[mlir][linalg] Fold linalg.pad_tensor if src type == result type

Fold PadTensorOp to source if source type and result type have static shape and are equal.

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

3 years ago[IR] Remove forward declaration of GraphTraits from Type.h
Jay Foad [Fri, 11 Jun 2021 14:22:14 +0000 (15:22 +0100)]
[IR] Remove forward declaration of GraphTraits from Type.h

This has been unnecessary since r352353 removed GraphTraits
specializations for Type, except that a couple of other headers were
accidentally relying on this declaration.

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

3 years ago[builtins] Allow compiling the builtins without libc headers
Alex Richardson [Tue, 15 Jun 2021 08:08:59 +0000 (09:08 +0100)]
[builtins] Allow compiling the builtins without libc headers

When compiled with -ffreestanding, we should not assume that headers
declaring functions such as abort() are available. While the compiler may
still emit calls to those functions [1], we should not require the headers
to build compiler-rt since that can result in a cyclic dependency graph:
The compiler-rt functions might be required to build libc.so, but the libc
headers such as stdlib.h might only be available once libc has been built.

[1] From https://gcc.gnu.org/onlinedocs/gcc/Standards.html:
GCC requires the freestanding environment provide memcpy, memmove,
memset and memcmp. Finally, if __builtin_trap is used, and the target
does not implement the trap pattern, then GCC emits a call to abort.

Reviewed By: phosek

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

3 years agoRevert "[libc] Add a set of elementary operations"
Guillaume Chatelet [Tue, 15 Jun 2021 08:01:59 +0000 (08:01 +0000)]
Revert "[libc] Add a set of elementary operations"

This reverts commit 454d92ac3b3b13f5c8b3f57e03b2d93f0cf60738.

3 years ago[libc] Add a set of elementary operations
Guillaume Chatelet [Tue, 15 Jun 2021 07:57:13 +0000 (07:57 +0000)]
[libc] Add a set of elementary operations

Resubmission of D100646 now making sure that we handle cases were `__builtin_memcpy_inline` is not available.

Original commit message:
Each of these elementary operations can be assembled to support higher order constructs (Overlapping access, Loop, Aligned Loop).
The patch does not compile yet as it depends on other ones (D100571, D100631) but it allows to get the conversation started.

A self-contained version of this code is available at https://godbolt.org/z/e1x6xdaxM

3 years agoSupport buffers in LinalgFoldUnitExtentDims
Tres Popp [Wed, 2 Jun 2021 11:29:43 +0000 (13:29 +0200)]
Support buffers in LinalgFoldUnitExtentDims

This doesn't add any canonicalizations, but executes the same
simplification on bufferSemantic linalg.generic ops by using
linalg::ReshapeOp instead of linalg::TensorReshapeOp.

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

3 years ago[gn build] Port d0a5d8611935
LLVM GN Syncbot [Tue, 15 Jun 2021 05:56:32 +0000 (05:56 +0000)]
[gn build] Port d0a5d8611935

3 years ago[Debug-Info][CodeView] Fix GUID string generation for MSVC generated objects.
CarlosAlbertoEnciso [Tue, 15 Jun 2021 05:52:50 +0000 (06:52 +0100)]
[Debug-Info][CodeView] Fix GUID string generation for MSVC generated objects.

This patch is to address https://bugs.llvm.org/show_bug.cgi?id=50459.
  YAML:455:28: error: GUID strings are 38 characters long

The valid format for a GUID is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
where X is a hex digit (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).
The length of the individual components must be: 8, 4, 4, 4, 12.

For some cases, the converted string generated by obj2yaml, does not
comply with those lengths. yaml2obj checks that the GUID string must
be 38 characters including the dashes and braces.

Reviewed By: amccarth

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

3 years ago[ORC-RT] Fix void function handling in the WrapperFunction utility.
Lang Hames [Tue, 15 Jun 2021 01:56:37 +0000 (11:56 +1000)]
[ORC-RT] Fix void function handling in the WrapperFunction utility.

Handlers returning void previously caused compile errors. Fix that by
substituting SPSEmpty placeholder values.

3 years agoRevert "[NFC] This is a test commit to check commit access."
CarlosAlbertoEnciso [Tue, 15 Jun 2021 05:23:27 +0000 (06:23 +0100)]
Revert "[NFC] This is a test commit to check commit access."

This reverts commit b4d40e19def8c2e1a77ae30b5ac16751d1c461f7.

3 years ago[AMDGPU][Libomptarget] Drop dead code related to g_atl_machine
Pushpinder Singh [Fri, 11 Jun 2021 12:31:48 +0000 (12:31 +0000)]
[AMDGPU][Libomptarget] Drop dead code related to g_atl_machine

This patch includes some changes which deletes the code accessing
g_atl_machine global. Some accesses related to memory_pools are
still remaining.

Reviewed By: JonChesterfield

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

3 years ago[NFC] This is a test commit to check commit access.
Carlos Alberto Enciso [Mon, 14 Jun 2021 18:43:25 +0000 (19:43 +0100)]
[NFC] This is a test commit to check commit access.

Add full stop at the end of comment.

3 years ago[X86] Use EVT::getVectorVT instead of changeVectorElementType in reduceVMULWidth.
Craig Topper [Tue, 15 Jun 2021 05:01:45 +0000 (22:01 -0700)]
[X86] Use EVT::getVectorVT instead of changeVectorElementType in reduceVMULWidth.

Changing vector element type doesn't work for v6i32->v6i16 now
that v6i32 is an MVT and v6i16 is not.

I would like to fix this in changeVectorElementType, but you
need a LLVMContext to call getVectorVT which we can't get from
an MVT.

Fixes PR50709.

3 years ago[NFC][hwasan] Fix "implicitly declaring library function"
Vitaly Buka [Tue, 15 Jun 2021 04:58:59 +0000 (21:58 -0700)]
[NFC][hwasan] Fix "implicitly declaring library function"

3 years ago[lld][MachO] Fix UB after D103006
Vitaly Buka [Tue, 15 Jun 2021 04:15:54 +0000 (21:15 -0700)]
[lld][MachO] Fix UB after D103006

ubsan detected:
lld/MachO/SyntheticSections.cpp:636:15: runtime error: null pointer
passed as argument 2, which is declared to never be null

3 years agoDo not merge LocalInstantiationScope for template specialization
Yaxun (Sam) Liu [Tue, 8 Jun 2021 20:32:03 +0000 (16:32 -0400)]
Do not merge LocalInstantiationScope for template specialization

A lambda in a function template may be recursively instantiated. The recursive
lambda will cause a lambda function instantiated multiple times, one inside another.
The inner LocalInstantiationScope should not be marked as MergeWithParentScope
since it already has references to locals properly substituted, otherwise it causes
assertion due to the check for duplicate locals in merged LocalInstantiationScope.

Reviewed by: Richard Smith

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

3 years ago[libc++][ci] Enable modules in the Runtimes build
Louis Dionne [Mon, 14 Jun 2021 18:36:13 +0000 (14:36 -0400)]
[libc++][ci] Enable modules in the Runtimes build

The runtimes build has assertions enabled, which is necessary to catch
some of the modules-related issues we've been seeing recently. This
patch enables testing with modules in the runtimes build so as to cover
those cases.

In the future, a better solution would be to systematically use versions
of Clang that have assertions enabled. However, the Clangs we release
currently don't have assertions enabled by default, which causes a
challenge for the CI (we could try to build our own Clang from ToT with
assertions in the CI, but that poses some problems).

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

3 years ago[lld][MachO] Add support for LC_DATA_IN_CODE
Alexander Shaposhnikov [Tue, 15 Jun 2021 02:21:43 +0000 (19:21 -0700)]
[lld][MachO] Add support for LC_DATA_IN_CODE

Add first bits for emitting LC_DATA_IN_CODE.

Test plan: make check-lld-macho

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

3 years ago[PowerPC] Export 16 byte load-store instructions
Kai Luo [Tue, 15 Jun 2021 01:55:37 +0000 (01:55 +0000)]
[PowerPC] Export 16 byte load-store instructions

Export `lq`, `stq`, `lqarx` and `stqcx.` in preparation for implementing 16-byte lock free atomic operations on AIX.
Add a new register class `g8prc` for these instructions, since these instructions require even-odd register pair.

Reviewed By: nemanjai, jsji, #powerpc

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

3 years ago[NFC][sanitizer] clang-format some code
Vitaly Buka [Tue, 15 Jun 2021 00:46:48 +0000 (17:46 -0700)]
[NFC][sanitizer] clang-format some code

3 years ago[mlir:OpFormatGen] Add Support for `$_ctxt` in the transformer.
Sean Silva [Tue, 15 Jun 2021 00:28:01 +0000 (17:28 -0700)]
[mlir:OpFormatGen] Add Support for `$_ctxt` in the transformer.

This is useful for "build tuple" type ops. In my case, in npcomp, I have
an op:

```
// Result type is `!torch.tuple<!torch.tensor, !torch.tensor>`.
torch.prim.TupleConstruct %0, %1 : !torch.tensor, !torch.tensor
```

and the context is required for the `Torch::TupleType::get` call (for
the case of an empty tuple).

The handling of these FmtContext's in the code is pretty ad-hoc -- I didn't
attempt to rationalize it and just made a targeted fix. As someone
unfamiliar with the code I had a hard time seeing how to more broadly fix
the situation.

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

3 years ago[compiler-rt][hwasan] Add newline between record_addr lines on frame record dumps
Leonard Chan [Mon, 7 Jun 2021 22:12:44 +0000 (15:12 -0700)]
[compiler-rt][hwasan] Add newline between record_addr lines on frame record dumps

If SymbolizePC failes, it's possible for the newline to not be emitted.

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

3 years agoRemove redundant environment variable XLA_FLAGS.
Jacob Hegna [Mon, 14 Jun 2021 23:21:39 +0000 (23:21 +0000)]
Remove redundant environment variable XLA_FLAGS.

If the flag is not set, the script saved_model_aot_compile.py in tensorflow will
default it to the correct value. However, in TF 2.5, the way the value is set in
TensorFlowCompile.cmake file triggers a build error.

Reviewed By: mtrofin

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

3 years agoAllow signposts to take advantage of deferred string substitution
Adrian Prantl [Fri, 11 Jun 2021 22:18:25 +0000 (15:18 -0700)]
Allow signposts to take advantage of deferred string substitution

One nice feature of the os_signpost API is that format string
substitutions happen in the consumer, not the logging
application. LLVM's current Signpost class doesn't take advantage of
this though and instead always uses a static "Begin/End %s" format
string.

This patch uses variadic macros to allow the API to be used as
intended. Unfortunately, the primary use-case I had in mind (the
LLDB_SCOPED_TIMER() macro) does not get much better from this, because
__PRETTY_FUNCTION__ is *not* a macro, but a static string, so
signposts created by LLDB_SCOPED_TIMER() still use a static "%s"
format string. At least LLDB_SCOPED_TIMERF() works as intended.

This reapplies the previously reverted patch with additional include
order fixes for non-modular builds of LLDB.

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

3 years ago[SVE][LSR] Teach LSR to enable simple scaled-index addressing mode generation for...
Huihui Zhang [Mon, 14 Jun 2021 23:21:24 +0000 (16:21 -0700)]
[SVE][LSR] Teach LSR to enable simple scaled-index addressing mode generation for SVE.

Currently, Loop strengh reduce is not handling loops with scalable stride very well.

Take loop vectorized with scalable vector type <vscale x 8 x i16> for instance,
(refer to test/CodeGen/AArch64/sve-lsr-scaled-index-addressing-mode.ll added).

Memory accesses are incremented by "16*vscale", while induction variable is incremented
by "8*vscale". The scaling factor "2" needs to be extracted to build candidate formula
i.e., "reg(%in) + 2*reg({0,+,(8 * %vscale)}". So that addrec register reg({0,+,(8*vscale)})
can be reused among Address and ICmpZero LSRUses to enable optimal solution selection.

This patch allow LSR getExactSDiv to recognize special cases like "C1*X*Y /s C2*X*Y",
and pull out "C1 /s C2" as scaling factor whenever possible. Without this change, LSR
is missing candidate formula with proper scaled factor to leverage target scaled-index
addressing mode.

Note: This patch doesn't fully fix AArch64 isLegalAddressingMode for scalable
vector. But allow simple valid scale to pass through.

Reviewed By: sdesmalen

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

3 years agoRevert "Allow signposts to take advantage of deferred string substitution"
Adrian Prantl [Mon, 14 Jun 2021 23:04:43 +0000 (16:04 -0700)]
Revert "Allow signposts to take advantage of deferred string substitution"

This reverts commit 03841edde7eee21d1d450041ab9a113a7e1be869.

Unfortunately this still breaks the LLDB standalone bot.

3 years ago[Hexagon] Add HVX and control register names to Hexagon target
Krzysztof Parzyszek [Mon, 14 Jun 2021 22:12:35 +0000 (17:12 -0500)]
[Hexagon] Add HVX and control register names to Hexagon target

3 years ago[libc] Add hardware implementations of x86_64 sqrt functions.
Siva Chandra Reddy [Mon, 14 Jun 2021 21:24:57 +0000 (21:24 +0000)]
[libc] Add hardware implementations of x86_64 sqrt functions.

3 years ago[HWASan] Enable globals support for LAM.
Matt Morehouse [Mon, 14 Jun 2021 21:18:19 +0000 (14:18 -0700)]
[HWASan] Enable globals support for LAM.

Reviewed By: vitalybuka

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

3 years agoAllow signposts to take advantage of deferred string substitution
Adrian Prantl [Fri, 11 Jun 2021 22:18:25 +0000 (15:18 -0700)]
Allow signposts to take advantage of deferred string substitution

One nice feature of the os_signpost API is that format string
substitutions happen in the consumer, not the logging
application. LLVM's current Signpost class doesn't take advantage of
this though and instead always uses a static "Begin/End %s" format
string.

This patch uses variadic macros to allow the API to be used as
intended. Unfortunately, the primary use-case I had in mind (the
LLDB_SCOPED_TIMER() macro) does not get much better from this, because
__PRETTY_FUNCTION__ is *not* a macro, but a static string, so
signposts created by LLDB_SCOPED_TIMER() still use a static "%s"
format string. At least LLDB_SCOPED_TIMERF() works as intended.

This reapplies the previsously reverted patch with additional MachO.h
macro #undefs.

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

3 years ago[dfsan] Add stack-trace printing functions to dfsan interface
George Balatsouras [Sat, 12 Jun 2021 00:54:19 +0000 (17:54 -0700)]
[dfsan] Add stack-trace printing functions to dfsan interface

Reviewed By: stephan.yichao.zhao

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

3 years ago[TLI] SimplifyDemandedVectorElts(): handle SCALAR_TO_VECTOR(EXTRACT_VECTOR_ELT(?...
Roman Lebedev [Mon, 14 Jun 2021 20:52:53 +0000 (23:52 +0300)]
[TLI] SimplifyDemandedVectorElts(): handle SCALAR_TO_VECTOR(EXTRACT_VECTOR_ELT(?, 0))

Iff we have `SCALAR_TO_VECTOR` (and we demand it's only defined 0'th element),
and said scalar was produced by `EXTRACT_VECTOR_ELT` from the 0'th element
of some vector, then we can just continue traversal into said source vector.

This comes up in X86 vector uniform shift lowering.

Reviewed By: RKSimon

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

3 years agoAdding some of the documents for C11.
Aaron Ballman [Mon, 14 Jun 2021 20:42:56 +0000 (16:42 -0400)]
Adding some of the documents for C11.

This is not the complete set of language-related documents for C11, but
is about 75% complete.

3 years ago[mlir][Linalg] Make printer/parser have the same behavior.
Hanhan Wang [Mon, 14 Jun 2021 20:38:21 +0000 (13:38 -0700)]
[mlir][Linalg] Make printer/parser have the same behavior.

The parser of generic op did not recognize the output from mlir-opt when there
are multiple outputs. One would wrap the result types with braces, and one would
not. The patch makes the behavior the same.

Reviewed By: mravishankar

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

3 years ago[AMDGPU] Limit runs of fixLdsBranchVmemWARHazard
Piotr Sobczak [Mon, 14 Jun 2021 10:17:35 +0000 (12:17 +0200)]
[AMDGPU] Limit runs of fixLdsBranchVmemWARHazard

The code in fixLdsBranchVmemWARHazard looks for patterns of a vmem/lds
access followed by a branch, followed by an lds/vmem access.

The handling of the hazard requires an arbitrary number of instructions
to process. In the worst case where a function has a vmem access, but no lds
accesses, all instructions are examined only to conclude that the hazard
cannot occur.

Add the pre-processing stage which detects if there is both lds and vmem
present in the function and only then does the more costly search.

This patch significantly improves compilation time in the cases the hazard
cannot happen. In one pathological case I looked at IsHazardInst is needlesly
called 88.6 milions times.

The numbers could also be improved by introducing a map around the
inner calls to ::getWaitStatesSince in fixLdsBranchVmemWARHazard, but
nothing will beat not running fixLdsBranchVmemWARHazard at all in the cases
detected by shouldRunLdsBranchVmemWARHazardFixup().

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

3 years ago[libc++abi] NFC: avoid a -Wunused-parameter warning
Xing Xue [Mon, 14 Jun 2021 20:04:02 +0000 (16:04 -0400)]
[libc++abi] NFC: avoid a -Wunused-parameter warning

Summary:
A -Wunused-parameter warning was introduced by patch rG7f0244afa828 [libc++abi] NFC: adding a new parameter base to functions for calculating… (authored by xingxue). The unused parameter base will be used in a follow-on patch D101298. This patch is to avoid the warning before D101298 is landed.

Reviewers: ldionne, sfertile, compnerd, libc++abi

Reviewed by: ldionne

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

3 years ago[libc++] Clean up scripts to setup CI on macOS
Louis Dionne [Mon, 14 Jun 2021 19:55:36 +0000 (15:55 -0400)]
[libc++] Clean up scripts to setup CI on macOS

3 years ago[OPENMP][C++20]Add support for CXXRewrittenBinaryOperator in ranged for loops.
Alexey Bataev [Mon, 14 Jun 2021 13:03:42 +0000 (06:03 -0700)]
[OPENMP][C++20]Add support for CXXRewrittenBinaryOperator in ranged for loops.

Added support for CXXRewrittenBinaryOperator as a condition in ranged
for loops. This is a new kind of expression, need to extend support for
  C++20 constructs.
It fixes PR49970: range-based for compilation fails for libstdc++ vector
with -std=c++20.

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

3 years ago[PassManager] Save compile time by not running the verifier unnecessarily. NFC
Chris Lattner [Mon, 14 Jun 2021 17:31:00 +0000 (10:31 -0700)]
[PassManager] Save compile time by not running the verifier unnecessarily. NFC

This changes the pass manager to not rerun the verifier when a pass says it
didn't change anything or after an OpToOpPassAdaptor, since neither of those
cases need verification (and if the pass lied, then there will be much larger
semantic problems than will be caught by the verifier).

This maintains behavior in EXPENSIVE_CHECKS mode.

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

3 years agoMove some code under NDEBUG from D103135
Arthur Eubanks [Mon, 14 Jun 2021 18:39:12 +0000 (11:39 -0700)]
Move some code under NDEBUG from D103135

3 years ago[mlir:Linalg] Populate LinalgOp patterns on LinalgDialect as opposed to each op
River Riddle [Mon, 14 Jun 2021 18:09:43 +0000 (11:09 -0700)]
[mlir:Linalg] Populate LinalgOp patterns on LinalgDialect as opposed to each op

Interface patterns are unique in that they get added to every operation that also implements that interface, given that they aren't tied to individual operations. When the same interface pattern gets added to multiple operations (such as the current behavior with Linalg), an reference to each of these patterns is added to every op (meaning that an operation will now have N references to effectively the same pattern). This revision fixes this problematic behavior in Linalg, and can bring upwards of a 25% reduction in compile time in Linalg based workloads.

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

3 years agoRemove accidentally added debugging code from D103135
Arthur Eubanks [Mon, 14 Jun 2021 18:09:41 +0000 (11:09 -0700)]
Remove accidentally added debugging code from D103135

3 years agoX86: pass swift_async context in R14 on Win64
Saleem Abdulrasool [Mon, 14 Jun 2021 01:22:59 +0000 (18:22 -0700)]
X86: pass swift_async context in R14 on Win64

Pass swift_async context in a callee-saved register rather than as a
regular parameter.  This is similar to the Swift `self` and `error`
parameters.

3 years ago[docs][OpaquePtr] Shuffle around the transition plan section
Arthur Eubanks [Fri, 11 Jun 2021 20:34:42 +0000 (13:34 -0700)]
[docs][OpaquePtr] Shuffle around the transition plan section

Emphasize that this is basically an attempt to remove
``PointerType::getElementType`` and ``Type::getPointerElementType()``.

Add a couple more subtasks.

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

3 years ago[NFC] Remove unused variable
Vitaly Buka [Mon, 14 Jun 2021 17:56:40 +0000 (10:56 -0700)]
[NFC] Remove unused variable

To fix 'set but not used' warning on sanitizer-x86_64-linux-android bot.

3 years ago[OpaquePtr] Remove existing support for forward compatibility
Arthur Eubanks [Wed, 26 May 2021 03:04:00 +0000 (20:04 -0700)]
[OpaquePtr] Remove existing support for forward compatibility

It assumes that PointerType will keep having an optional pointee type,
but we'd like to remove the pointee type in PointerType at some point.

I feel like the current implementation could be simplified anyway,
although perhaps I'm underestimating the amount of work needed
throughout BitcodeReader.

We will still need a side table to keep track of pointee types. This
will be reimplemented at some point.

This is essentially a revert of a4771e9d (which doesn't look like it was
reviewed anyway).

Reviewed By: dblaikie

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

3 years ago[lld-macho] Fix "shift exponent too large" UBSAN error
Jez Ng [Mon, 14 Jun 2021 03:20:30 +0000 (23:20 -0400)]
[lld-macho] Fix "shift exponent too large" UBSAN error

UBSAN seems to have added this check somewhere along the way...

This might also fix the PPC buildbot, which is failing on the same test

3 years ago[lld-macho] Reword comment for clarity
Jez Ng [Sat, 12 Jun 2021 00:30:12 +0000 (20:30 -0400)]
[lld-macho] Reword comment for clarity

3 years ago[OpenMP] Fix C-only clang assert on parsing use_allocator clause of target directive
Alexey Bataev [Mon, 14 Jun 2021 17:04:59 +0000 (10:04 -0700)]
[OpenMP] Fix C-only clang assert on parsing use_allocator clause of target directive

The parser code assumes building with C++ compiler and asserts when using clang (not clang++) on C file. I made the code dependent on input language. This shows up for amdgpu target.

Reviewed By: ABataev

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

3 years ago[CSSPGO] Aggregation by the last K context frames for cold profiles
wlei [Fri, 11 Jun 2021 07:35:45 +0000 (00:35 -0700)]
[CSSPGO] Aggregation by the last K context frames for cold profiles

This change provides the option to merge and aggregate cold context by the last k frames instead of context-less name. By default K = 1 means the context-less one.

This is for better perf tuning. The more selective merging and trimming will rely on llvm-profgen's preinliner.

Reviewed By: wenlei, hoy

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

3 years ago[Clang] Test case for -Wunused-but-set-variable, warn for volatile.
Michael Benfield [Mon, 14 Jun 2021 17:15:55 +0000 (10:15 -0700)]
[Clang] Test case for -Wunused-but-set-variable, warn for volatile.

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

3 years ago[RISCV] Transform unaligned RVV vector loads/stores to aligned ones
Fraser Cormack [Wed, 9 Jun 2021 14:17:21 +0000 (15:17 +0100)]
[RISCV] Transform unaligned RVV vector loads/stores to aligned ones

This patch adds support for loading and storing unaligned vectors via an
equivalently-sized i8 vector type, which has support in the RVV
specification for byte-aligned access.

This offers a more optimal path for handling of unaligned fixed-length
vector accesses, which are currently scalarized. It also prevents
crashing when `LegalizeDAG` sees an unaligned scalable-vector load/store
operation.

Future work could be to investigate loading/storing via the largest
vector element type for the given alignment, in case that would be more
optimal on hardware. For instance, a 4-byte-aligned nxv2i64 vector load
could loaded as nxv4i32 instead of as nxv16i8.

Reviewed By: craig.topper

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

3 years ago[flang] Move buffer runtime test to GTest
Asher Mancinelli [Mon, 14 Jun 2021 16:16:46 +0000 (09:16 -0700)]
[flang] Move buffer runtime test to GTest

Move buffer unit test from Runtime directory to RuntimeGtest
directory and use GTest. Test coverage is only maintained.

Differential Revision: https://reviews.llvm.org/D102335
Reviewed By: awarzynski, klausler

3 years ago[Verifier] Parallelize verification and dom checking. NFC.
Chris Lattner [Mon, 14 Jun 2021 04:42:06 +0000 (21:42 -0700)]
[Verifier] Parallelize verification and dom checking.  NFC.

This changes the outer verification loop to not recurse into
IsolatedFromAbove operations - instead return them up to a place
where a parallel for loop can process them all in parallel.  This
also changes Dominance checking to happen on IsolatedFromAbove
chunks of the region tree, which makes it easy to fold operation
and dominance verification into a single simple parallel regime.

This speeds up firtool in CIRCT from ~40s to 31s on a large
testcase in -verify-each mode (the default).  The .fir parser and
module passes in particular benefit from this - FModule passes
(roughly analogous to function passes) were already running the
verifier in parallel as part of the pass manager.  This allows
the whole-module passes to verify their enclosed functions /
FModules in parallel.

-verify-each mode is still faster (26.3s on the same testcase),
but we do expect the verifier to take *some* time.

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

3 years ago[InstCombine] add DeMorgan folds for logical ops in select form
Sanjay Patel [Mon, 14 Jun 2021 16:10:48 +0000 (12:10 -0400)]
[InstCombine] add DeMorgan folds for logical ops in select form

We canonicalized to these select patterns (poison-safe logic)
with D101191, so we need to reduce 'not' ops when possible
as we would with 'and'/'or' instructions.

This is shown in a secondary example in:
https://llvm.org/PR50389

https://alive2.llvm.org/ce/z/BvsESh

3 years ago[InstCombine] add tests for logical and/or with not ops; NFC
Sanjay Patel [Mon, 14 Jun 2021 14:47:36 +0000 (10:47 -0400)]
[InstCombine] add tests for logical and/or with not ops; NFC

3 years ago[LoopDeletion] Add test with irreducible control flow in loop.
Florian Hahn [Mon, 14 Jun 2021 16:15:32 +0000 (17:15 +0100)]
[LoopDeletion] Add test with irreducible control flow in loop.

Currently the irreducible cycles in the loops are ignored. The
irreducible cycle may loop infinitely in
irreducible_subloop_no_mustprogress, which is allowed and the loop
should not be removed.

Discussed in D103382.

3 years ago[mlir] Mark gpu dialect illegal in gpu-to-llvm conversion
Christian Sigg [Mon, 14 Jun 2021 07:14:30 +0000 (09:14 +0200)]
[mlir] Mark gpu dialect illegal in gpu-to-llvm conversion

Reviewed By: herhut, bondhugula

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

3 years ago[VectorCombine] Limit scalarization to non-poison indices for now.
Florian Hahn [Mon, 14 Jun 2021 15:38:27 +0000 (16:38 +0100)]
[VectorCombine] Limit scalarization to non-poison indices for now.

As Eli mentioned post-commit in D103378, the result of the freeze may
still be out-of-range according to Alive2. So for now, just limit the
transform to indices that are non-poison.

3 years agoSelectionDAG: repair the Windows build
Saleem Abdulrasool [Mon, 14 Jun 2021 15:23:51 +0000 (08:23 -0700)]
SelectionDAG: repair the Windows build

6e5628354e22f3ca40b04295bac540843b8e6482 regressed the Windows build as
the return type no longer matched in both branches for the return value
type deduction.  This uses a bit more compiler magic to deal with that.

3 years ago[AIX][XCOFF] emit vector info of traceback table.
zhijian [Mon, 14 Jun 2021 15:15:22 +0000 (11:15 -0400)]
[AIX][XCOFF] emit vector info of traceback table.

Summary:

emit vector info of traceback table.

Reviewers: Jason Liu,Hubert Tong
Differential Revision: https://reviews.llvm.org/D93659

3 years ago[ADT] Use unnamed argument for unused arg in StringMapEntryStorage.
Florian Hahn [Mon, 14 Jun 2021 14:27:22 +0000 (15:27 +0100)]
[ADT] Use unnamed argument for unused arg in StringMapEntryStorage.

This silences an 'unsused argument' warning.

Similar to c2006f857d80f54b90ed7d911d3e7acf4f46001b.

3 years ago[AArch64] Improve SAD pattern
Jingu Kang [Thu, 10 Jun 2021 15:02:57 +0000 (16:02 +0100)]
[AArch64] Improve SAD pattern

Given a vecreduce_add node, detect the below pattern and convert it to the node
sequence with UABDL, [S|U]ADB and UADDLP.

i32 vecreduce_add(
 v16i32 abs(
   v16i32 sub(
    v16i32 [sign|zero]_extend(v16i8 a), v16i32 [sign|zero]_extend(v16i8 b))))
=================>
i32 vecreduce_add(
  v4i32 UADDLP(
    v8i16 add(
      v8i16 zext(
        v8i8 [S|U]ABD low8:v16i8 a, low8:v16i8 b
      v8i16 zext(
        v8i8 [S|U]ABD high8:v16i8 a, high8:v16i8 b

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

3 years agoRevert "[clang] NRVO: Improvements and handling of more cases."
Hans Wennborg [Mon, 14 Jun 2021 14:39:32 +0000 (16:39 +0200)]
Revert "[clang] NRVO: Improvements and handling of more cases."

This change caused build errors related to move-only __block variables,
see discussion on https://reviews.llvm.org/D99696

> This expands NRVO propagation for more cases:
>
> Parse analysis improvement:
> * Lambdas and Blocks with dependent return type can have their variables
>   marked as NRVO Candidates.
>
> Variable instantiation improvements:
> * Fixes crash when instantiating NRVO variables in Blocks.
> * Functions, Lambdas, and Blocks which have auto return type have their
>   variables' NRVO status propagated. For Blocks with non-auto return type,
>   as a limitation, this propagation does not consider the actual return
>   type.
>
> This also implements exclusion of VarDecls which are references to
> dependent types.
>
> Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
>
> Reviewed By: Quuxplusone
>
> Differential Revision: https://reviews.llvm.org/D99696

This also reverts the follow-on change which was hard to tease apart
form the one above:

> "[clang] Implement P2266 Simpler implicit move"
>
> This Implements [[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html|P2266 Simpler implicit move]].
>
> Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
>
> Reviewed By: Quuxplusone
>
> Differential Revision: https://reviews.llvm.org/D99005

This reverts commits 1e50c3d785f4563873ab1ce86559f2a1285b5678 and
bf20631782183cd19e0bb7219e908c2bbb01a75f.

3 years ago[gn build] Port c820b494d6e1
LLVM GN Syncbot [Mon, 14 Jun 2021 14:41:33 +0000 (14:41 +0000)]
[gn build] Port c820b494d6e1

3 years ago[libcxx][ranges] Implement views::all.
zoecarver [Thu, 6 May 2021 22:31:45 +0000 (15:31 -0700)]
[libcxx][ranges] Implement views::all.

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

3 years ago[lldb][docs] Add the missing rst anchors to the Python enum docs
Raphael Isemann [Mon, 14 Jun 2021 14:31:28 +0000 (16:31 +0200)]
[lldb][docs] Add the missing rst anchors to the Python enum docs

3 years ago[lldb][docs] Fix section name for InputReaderGranularity
Raphael Isemann [Mon, 14 Jun 2021 14:21:27 +0000 (16:21 +0200)]
[lldb][docs] Fix section name for InputReaderGranularity

3 years ago[libc++] [test] No longer rely on std::hash<T>::argument_type.
Arthur O'Dwyer [Sat, 12 Jun 2021 01:05:17 +0000 (21:05 -0400)]
[libc++] [test] No longer rely on std::hash<T>::argument_type.

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

3 years agoAdd AutomaticAllocationScope to memref.alloca_scope
Denys Shabalin [Mon, 14 Jun 2021 14:07:40 +0000 (16:07 +0200)]
Add AutomaticAllocationScope to memref.alloca_scope

This change adds `AutomaticAllocationScope` to the
memref.alloca_scope op. Additionally, it also clarifies
that alloca_scope is is conceptually a passthrough operation.

Reviewed By: ftynse, bondhugula

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

3 years ago[flang] Fix compilation problem with rename of "MemRefDataFlow"
Peter Steinfeld [Mon, 14 Jun 2021 13:21:37 +0000 (06:21 -0700)]
[flang] Fix compilation problem with rename of "MemRefDataFlow"

Revision https://reviews.llvm.org/D104190 renamed MemRefDataFlow -> AffineScalarReplacement.  After this rename, mlir failed to build.  With this change, all of clang, mlir, and flang build and test correctly.

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

3 years agoReland "[lldb] Set return status to failed when adding a command error"
David Spickett [Mon, 14 Jun 2021 12:11:58 +0000 (13:11 +0100)]
Reland "[lldb] Set return status to failed when adding a command error"

This reverts commit ac031c8db2ce454a9b08f23192ce698e8bde4447.

SB API usage has been corrected.

3 years ago[NFC][DAGCombine] Extract getFirstIndexOf() lambda back into a function
Roman Lebedev [Mon, 14 Jun 2021 13:25:59 +0000 (16:25 +0300)]
[NFC][DAGCombine] Extract getFirstIndexOf() lambda back into a function

Not all supported compilers like such lambdas, at least one buildbot is unhappy.

3 years ago[DAGCombine] reduceBuildVecToShuffle(): sort input vectors by decreasing size
Roman Lebedev [Mon, 14 Jun 2021 12:59:03 +0000 (15:59 +0300)]
[DAGCombine] reduceBuildVecToShuffle(): sort input vectors by decreasing size

The sorting, obviously, must be stable, else we will have random assembly fluctuations.

Apparently there was no test coverage that would benefit from that,
so i've added one test.

The sorting consists of two parts - just sort the input vectors,
and recompute the shuffle mask -> input vector mapping.
I don't believe we need to do anything else.

Reviewed By: RKSimon

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

3 years ago[clang][deps] NFC: Stop using moved-from object
Jan Svoboda [Mon, 14 Jun 2021 13:08:02 +0000 (15:08 +0200)]
[clang][deps] NFC: Stop using moved-from object

The dependency scanning worker uses `std::move` to "reset" `DependencyOutputOptions` in the `CompilerInstance` that performs the implicit build. It's probably preferable to replace the object with value-initialized instance, rather than depending on the behavior of a moved-from object.

Reviewed By: dexonsmith

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

3 years ago[clang][deps] NFC: Handle `DependencyOutputOptions` only once
Jan Svoboda [Mon, 14 Jun 2021 13:06:13 +0000 (15:06 +0200)]
[clang][deps] NFC: Handle `DependencyOutputOptions` only once

There's no need to pass `DependencyOutputOptions` to each call of `handleFileDependency`, since the options don't ever change.

This patch adds new `handleDependencyOutputOpts` method to the `DependencyConsumer` interface and the dependency scanner uses it to report the options only once.

Reviewed By: dexonsmith

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

3 years agoIntrinsic::getName: require a Module argument
Jeroen Dobbelaere [Mon, 14 Jun 2021 12:52:29 +0000 (14:52 +0200)]
Intrinsic::getName: require a Module argument

Ensure that we provide a `Module` when checking if a rename of an intrinsic is necessary.

This fixes the issue that was detected by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32288
(as mentioned by @fhahn), after committing D91250.

Note that the `LLVMIntrinsicCopyOverloadedName` is being deprecated in favor of `LLVMIntrinsicCopyOverloadedName2`.

Reviewed By: nikic

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

3 years ago[libc++] NFC: More refactoring in the prev/next/advance tests per review comments
Louis Dionne [Mon, 14 Jun 2021 12:41:56 +0000 (08:41 -0400)]
[libc++] NFC: More refactoring in the prev/next/advance tests per review comments

3 years ago[clang][deps] NFC: Fix an XFAIL test on Windows
Jan Svoboda [Fri, 11 Jun 2021 11:52:38 +0000 (13:52 +0200)]
[clang][deps] NFC: Fix an XFAIL test on Windows

The `sed` command ensures Windows-specific path separators (single and double backslashes) are replaced by forward slashes in the output file. FileCheck can continue using forward slashes in paths this way.

3 years ago[MLIR][NFC] Rename MemRefDataFlow -> AffineScalarReplacement
Uday Bondhugula [Sat, 12 Jun 2021 23:19:20 +0000 (04:49 +0530)]
[MLIR][NFC] Rename MemRefDataFlow -> AffineScalarReplacement

NFC. Rename MemRefDataFlow -> AffineScalarReplacement and move to
AffineTransforms library. Pass command line rename: -memref-dataflow-opt
-> affine-scalrep. Update outdated pass documentation.

Rationale:
https://llvm.discourse.group/t/move-and-rename-memref-dataflow-opt-lib-transforms-lib-affine-dialect-transforms/3640

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

3 years ago[libc++] Refactor the tests for std::prev, next and advance
Louis Dionne [Thu, 27 May 2021 18:15:11 +0000 (14:15 -0400)]
[libc++] Refactor the tests for std::prev, next and advance

This started as an attempt to fix a GCC 11 warning of misplaced parentheses.
I then noticed that trying to fix the parentheses warning actually triggered
errors in the tests, showing that we were incorrectly assuming that the
implementation of ranges::advance was using operator+= or operator-=.

This commit fixes that issue and makes the tests easier to follow by
localizing the assertions it makes.

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

3 years agoRevert "[lldb] Set return status to failed when adding a command error" (and fixups)
David Spickett [Mon, 14 Jun 2021 12:08:40 +0000 (12:08 +0000)]
Revert "[lldb] Set return status to failed when adding a command error" (and fixups)

This reverts commit f583029da3d6dbabe82f48b160227eb0120abd33,
0f94d68a2e15d50796439f20bcb508b95931d2ae and
a2363c0cf9b6a9a81c76ac652da667f73845d38b.

Due to test failures from incorrect SB API usage.

3 years ago[clang][deps] Prevent unintended modifications of the original TU command-line
Jan Svoboda [Mon, 14 Jun 2021 10:24:54 +0000 (12:24 +0200)]
[clang][deps] Prevent unintended modifications of the original TU command-line

One of the goals of the dependency scanner is to generate command-lines that can be used to explicitly build modular dependencies of a translation unit. The only modifications to these command-lines should be for the purposes of explicit modular build.

However, the current version of dependency scanner leaks its implementation details into the command-lines.

The first problem is that the `clang-scan-deps` tool adjusts the original textual command-line (adding `-Eonly -M -MT <target> -sys-header-deps -Wno-error -o /dev/null `, removing `--serialize-diagnostics`) in order to set up the `DependencyScanning` library. This has been addressed in D103461, D104012, D104030, D104031, D104033. With these patches, the `DependencyScanning` library receives the unmodified `CompilerInvocation`, sets it up and uses it for the implicit modular build.

Finally, to prevent leaking the implementation details to the resulting command-lines, this patch generates them from the **original** unmodified `CompilerInvocation` rather than from the one that drives the implicit build.

Reviewed By: dexonsmith

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

3 years ago[clang][deps] NFC: Check the correct context hashes in tests
Jan Svoboda [Thu, 10 Jun 2021 12:13:25 +0000 (14:13 +0200)]
[clang][deps] NFC: Check the correct context hashes in tests

The `clang-scan-deps` tests for the full output format were written under the assumption that most TUs/modules have the same context hash. This is no longer true, since we're changing the original compilation options. This patch updates the tests, which no longer conflate multiple context hashes into a single FileCheck variable.

3 years ago[lldb][docs] Document SBType
Raphael Isemann [Mon, 14 Jun 2021 11:03:02 +0000 (13:03 +0200)]
[lldb][docs] Document SBType

This documents the behaviour of the different SBType functions with notes for
the language-specific behaviour for C/C++/Objective-C. All of this reflects the
current behaviour of LLDB (even though that also means some functions behave
kinda weird but at least they are now documented to be weird)

Reviewed By: #lldb, mib

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

3 years ago[clang][deps] Fix failing modules.cpp test
Jan Svoboda [Mon, 14 Jun 2021 10:55:32 +0000 (12:55 +0200)]
[clang][deps] Fix failing modules.cpp test

Commit d8bab69ead22a10dc4cdb2e36f6ea6fdfe774e2e updated the ClangScanDeps/modules.cpp test. The new `{{.*}}` regex is supposed to only match `modules_cdb_input.o`, `a.o` or `b.o`. However, due to non-determinism, this can sometimes also match `modules_cdb_input2.o`, causing match failure on the next line. This commit changes the regex to only match one of the three valid cases.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/109/builds/16675

3 years ago[VPlan] Add additional tests for region merging.
Florian Hahn [Sun, 13 Jun 2021 15:29:18 +0000 (16:29 +0100)]
[VPlan] Add additional tests for region merging.

Add additional tests suggested in D100260.

Also drop the unneeded `indvars.` prefix from induction phi name.

3 years ago[clang][deps] Move enabling system header deps from `clang-scan-deps` to `DependencyS...
Jan Svoboda [Mon, 14 Jun 2021 10:12:23 +0000 (12:12 +0200)]
[clang][deps] Move enabling system header deps from `clang-scan-deps` to `DependencyScanning` library

This patch moves enabling system header deps from `clang-scan-deps` into the `DependencyScanning` library. This will make it easier to preserve semantics of the original TU command-line for modular dependencies (see D104036).

Reviewed By: arphaman

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

3 years ago[clang][deps] Move injection of `-Wno-error` from `clang-scan-deps` to `DependencySca...
Jan Svoboda [Mon, 14 Jun 2021 10:09:54 +0000 (12:09 +0200)]
[clang][deps] Move injection of `-Wno-error` from `clang-scan-deps` to `DependencyScanning` library

This moves another piece of logic specific to `clang-scan-deps` into the `DependencyScanning` library. This makes it easier to check how the original command-line looked like in the library and will enable the library to stop inventing `-Wno-error` for modular dependencies (see D104036).

Reviewed By: arphaman

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

3 years ago[clang][deps] Move invocation adjustments from `clang-scan-deps` to `DependencyScanni...
Jan Svoboda [Mon, 14 Jun 2021 10:06:08 +0000 (12:06 +0200)]
[clang][deps] Move invocation adjustments from `clang-scan-deps` to `DependencyScanning` library

The `clang-scan-deps` tool has some logic that parses and modifies the original Clang command-line. The goal is to setup `DependencyOutputOptions` by injecting `-M -MT <target>` and prevent the creation of output files.

This patch moves the logic into the `DependencyScanning` library, and uses the parsed `CompilerInvocation` instead of the raw command-line. The code simpler and can be used from the C++ API as well.

The `-o /dev/null` arguments are not necessary, since the `DependencyScanning` library only runs a preprocessing action, so there's no way it'll produce an actual object file.

Related: The `-M` argument implies `-w`, which would appear on the command-line of modular dependencies even though it was not on the original TU command line (see D104036).

Some related tests were updated.

Reviewed By: arphaman

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

3 years ago[clang][deps] Move stripping of diagnostic serialization from `clang-scan-deps` to...
Jan Svoboda [Mon, 14 Jun 2021 10:02:19 +0000 (12:02 +0200)]
[clang][deps] Move stripping of diagnostic serialization from `clang-scan-deps` to `DependencyScanning` library

To prevent the creation of diagnostics file, `clang-scan-deps` strips the corresponding command-line argument. This behavior is useful even when using the C++ `DependencyScanner` library.

This patch transforms stripping of command-line in `clang-scan-deps` into stripping of `CompilerInvocation` in `DependencyScanning`.

AFAIK, the `clang-cl` driver doesn't even accept `--serialize-diagnostics`, so I've removed the test. (It would fail with an unknown command-line argument otherwise.)

Note: Since we're generating command-lines for modular dependencies from `CompilerInvocation`, the `--serialize-diagnostics` will be dropped. This was already happening in `clang-scan-deps` before this patch, but it will now happen also when using `DependencyScanning` library directly. This is resolved in D104036.

Reviewed By: dexonsmith, arphaman

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

3 years ago[Analyzer][solver] Simplify existing eq classes and constraints when a new constraint...
Gabor Marton [Fri, 28 May 2021 13:18:28 +0000 (15:18 +0200)]
[Analyzer][solver] Simplify existing eq classes and constraints when a new constraint is added

Update `setConstraint` to simplify existing equivalence classes when a
new constraint is added. In this patch we iterate over all existing
equivalence classes and constraints and try to simplfy them with
simplifySVal. This solves problematic cases where we have two symbols in
the tree, e.g.:
```
int test_rhs_further_constrained(int x, int y) {
  if (x + y != 0)
    return 0;
  if (y != 0)
    return 0;
  clang_analyzer_eval(x + y == 0); // expected-warning{{TRUE}}
  clang_analyzer_eval(y == 0);     // expected-warning{{TRUE}}
  return 0;
}
```

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