platform/upstream/llvm.git
3 years ago[lldb-vscode] attempt to fix flakiness
Walter Erquinigo [Fri, 18 Jun 2021 17:10:57 +0000 (10:10 -0700)]
[lldb-vscode] attempt to fix flakiness

There are many tests failing intermittently for lldb-vscode after
https://reviews.llvm.org/rGaa4685c0fb3aab5acb90be5fd3eb5ba8bf1e3211. I'm
unsure if this actually the culprit, so I'm softly removing that feature
to see if that fixes the issue.

3 years ago[lld/mac] Support -data_in_code_info, -function_starts flags
Nico Weber [Fri, 18 Jun 2021 15:47:49 +0000 (11:47 -0400)]
[lld/mac] Support -data_in_code_info, -function_starts flags

These are on by default, but there's also an explicit flag for them.

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

3 years agoRename option -icf MODE to --icf=MODE
Greg McGary [Fri, 18 Jun 2021 16:38:50 +0000 (09:38 -0700)]
Rename option -icf MODE to --icf=MODE

The `icf` command-line option is not present in ld64, so it should use the LLD option syntax, which begins with double dashes and separates primary option from any suboption with the equal sign.

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

3 years ago[AArch64] Add TableGen patterns to generate uaddlv
Jingu Kang [Mon, 14 Jun 2021 15:42:00 +0000 (16:42 +0100)]
[AArch64] Add TableGen patterns to generate uaddlv

uaddv(uaddlp(x)) ==> uaddlv(x)
addp(uaddlp(x))  ==> uaddlv(x)

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

3 years ago[NFC][libomptarget] Build elf_common with PIC.
Vyacheslav Zakharin [Fri, 18 Jun 2021 15:54:10 +0000 (08:54 -0700)]
[NFC][libomptarget] Build elf_common with PIC.

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

3 years ago[NFC][libomptarget] Fixed -DLLVM_ENABLE_RUNTIMES="openmp" build.
Vyacheslav Zakharin [Fri, 18 Jun 2021 14:17:23 +0000 (07:17 -0700)]
[NFC][libomptarget] Fixed -DLLVM_ENABLE_RUNTIMES="openmp" build.

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

3 years agoFix build failure on 32 bit Arm
Muhammad Omair Javaid [Fri, 18 Jun 2021 15:19:38 +0000 (15:19 +0000)]
Fix build failure on 32 bit Arm

This patch fixes build failure caused by commit
f27e4548fc42876f66dac260ca3b6df0d5fd5fd6 on 32 bit arm.

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

3 years agoRISCV: simplify a test case for RISCV (NFCI)
Saleem Abdulrasool [Fri, 18 Jun 2021 15:19:16 +0000 (08:19 -0700)]
RISCV: simplify a test case for RISCV (NFCI)

The output of the object file is unimportant and entirely discarded.
Simply redirect the output to `/dev/null` or `NUL` as the case may be.
Additionally, the space between the labels is unimportant.  There is no
need to add space between the labels.  Two labels at the same address
are sufficient to generate the difference expression and should still
test the same behaviour.

3 years ago[HWASan] Run LAM tests with -hwasan-generate-tags-with-calls.
Matt Morehouse [Fri, 18 Jun 2021 15:10:41 +0000 (08:10 -0700)]
[HWASan] Run LAM tests with -hwasan-generate-tags-with-calls.

The default callback instrumentation in x86 LAM mode uses ASLR bits
to randomly choose a tag, and thus has a 1/64 chance of choosing a
stack tag of 0, causing stack tests to fail intermittently.  By using
__hwasan_generate_tag to pick tags, we guarantee non-zero tags and
eliminate the test flakiness.

aarch64 doesn't seem to have this problem using thread-local addresses
to pick tags, so perhaps we can remove this workaround once we implement
a similar mechanism for LAM.

Reviewed By: eugenis

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

3 years ago[clang] Implement P2266 Simpler implicit move
Matheus Izvekov [Fri, 19 Mar 2021 02:32:06 +0000 (03:32 +0100)]
[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

3 years ago[mlir] Add notes about using external interface application.
Sean Silva [Thu, 17 Jun 2021 21:33:59 +0000 (14:33 -0700)]
[mlir] Add notes about using external interface application.

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

3 years ago[DAG] SelectionDAG::computeKnownBits - use APInt::insertBits to merge subvector known...
Simon Pilgrim [Fri, 18 Jun 2021 13:58:47 +0000 (14:58 +0100)]
[DAG] SelectionDAG::computeKnownBits - use APInt::insertBits to merge subvector knownbits. NFCI.

As noticed on D104472 we can use APInt::insertBits which will avoid a lot of temporary APInt creations

3 years ago[analyzer] Handle NTTP invocation in CallContext.getCalleeDecl()
Tomasz Kamiński [Fri, 18 Jun 2021 11:20:17 +0000 (14:20 +0300)]
[analyzer] Handle NTTP invocation in CallContext.getCalleeDecl()

This fixes a crash in MallocChecker for the situation when operator new (delete) is invoked via NTTP  and makes the behavior of CallContext.getCalleeDecl(Expr) identical to CallEvent.getDecl().

Reviewed By: vsavchenko

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

3 years ago[libclang] Fix error handler in translateSourceLocation.
Simon Tatham [Fri, 18 Jun 2021 12:43:13 +0000 (13:43 +0100)]
[libclang] Fix error handler in translateSourceLocation.

Given an invalid SourceLocation, translateSourceLocation will call
clang_getNullLocation, and then do nothing with the result. But
clang_getNullLocation has no side effects: it just constructs and
returns a null CXSourceLocation value.

Surely the intention was to //return// that null CXSourceLocation to
the caller, instead of throwing it away and pressing on anyway.

Reviewed By: miyuki

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

3 years ago[ORC][C-bindings] Re-order object transform function arguments.
Lang Hames [Fri, 18 Jun 2021 12:12:39 +0000 (22:12 +1000)]
[ORC][C-bindings] Re-order object transform function arguments.

ObjInOut is an in-out parameter not a return value argument, so by convention
it should come after the context value (Ctx).

3 years ago[ORC] Use uint8_t rather than char for RPC wrapper-function calls.
Lang Hames [Fri, 18 Jun 2021 11:42:43 +0000 (21:42 +1000)]
[ORC] Use uint8_t rather than char for RPC wrapper-function calls.

This partially reverts 838490de7ed, which broke some Solaris bots. Apparently
Solaris defines int8_t as char rather than signed char, which made the
SerializationTypeName<char> specialization a redefinition.

This partial revert isolates use of uint8_t buffers to ORC-RPC handling of
wrapper functions only. The TargetProcessControl::runWrapper method will
continue to use char buffers.

3 years ago[clang] Exclude function pointers on DefaultedComparisonAnalyzer
Matheus Izvekov [Mon, 7 Jun 2021 23:38:13 +0000 (01:38 +0200)]
[clang] Exclude function pointers on DefaultedComparisonAnalyzer

This implements a more comprehensive fix than was done at D95409.
Instead of excluding just function pointer subobjects, we also
exclude any user-defined function pointer conversion operators.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith

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

3 years ago[ORC] Add support for dumping objects to the C API.
Lang Hames [Fri, 18 Jun 2021 09:48:20 +0000 (19:48 +1000)]
[ORC] Add support for dumping objects to the C API.

Provides ObjectTransformLayer APIs, a getter to access the
ObjectTransformLayer member of LLJIT, and the DumpObjects utility
to make construction of a dump-to-disk transform easy.

An example showing how the new APIs can be used has been added in
llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects.

3 years agoRevert D104028 "[llvm][Inliner] Add an optional PriorityInlineOrder"
Liqiang Tao [Fri, 18 Jun 2021 10:52:00 +0000 (18:52 +0800)]
Revert D104028 "[llvm][Inliner] Add an optional PriorityInlineOrder"

3 years ago[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteratio...
Max Kazantsev [Fri, 18 Jun 2021 10:30:36 +0000 (17:30 +0700)]
[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration (try 3)

This patch handles one particular case of one-iteration loops for which SCEV
cannot straightforwardly prove BECount = 1. The idea of the optimization is to
symbolically execute conditional branches on the 1st iteration, moving in topoligical
order, and only visiting blocks that may be reached on the first iteration. If we find out
that we never reach header via the latch, then the backedge can be broken.

This implementation uses InstSimplify. SCEV version was rejected due to high
compile time impact.

Differential Revision: https://reviews.llvm.org/D102615
Reviewed By: nikic

3 years ago[MLIR] Introduce scf.execute_region op
Uday Bondhugula [Fri, 18 Jun 2021 05:31:46 +0000 (11:01 +0530)]
[MLIR] Introduce scf.execute_region op

Introduce the execute_region op that is able to hold a region which it
executes exactly once. The op encapsulates a CFG within itself while
isolating it from the surrounding control flow. Proposal discussed here:
https://llvm.discourse.group/t/introduce-std-inlined-call-op-proposal/282

execute_region enables one to inline a function without lowering out all
other higher level control flow constructs (affine.for/if, scf.for/if)
to the flat list of blocks / CFG form. It thus allows the benefit of
transforms on higher level control flow ops available in the presence of
the inlined calls. The inlined calls continue to benefit from
propagation of SSA values across their top boundary. Functions won’t
have to remain outlined until later than desired.  Abstractions like
affine execute_regions, lambdas with implicit captures could be lowered
to this without first lowering out structured loops/ifs or outlining.
But two potential early use cases are of: (1) an early inliner (which
can inline functions by introducing execute_region ops), (2) lowering of
an affine.execute_region, which cleanly maps to an scf.execute_region
when going from the affine dialect to the scf dialect.

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

3 years ago[Attributor] Fix UB behavior on uninitalized bool variables.
Haojian Wu [Fri, 18 Jun 2021 09:48:33 +0000 (11:48 +0200)]
[Attributor] Fix UB behavior on uninitalized bool variables.

Found by ASAN.

3 years ago[AMDGPU] Update generated checks. NFC.
Jay Foad [Fri, 18 Jun 2021 09:48:56 +0000 (10:48 +0100)]
[AMDGPU] Update generated checks. NFC.

3 years ago[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)
Daniil Seredkin [Wed, 2 Jun 2021 04:55:38 +0000 (11:55 +0700)]
[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)

InstCombine didn't perform (sext bool X) * (sext bool X) --> zext (and X, X) which can result in just (zext X). The patch adds regression tests to check this transformation and adds a check for equality of mul's operands for that case.

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

3 years ago[Test] Add XFAIL unit test for PR50765
Max Kazantsev [Fri, 18 Jun 2021 09:25:09 +0000 (16:25 +0700)]
[Test] Add XFAIL unit test for PR50765

3 years ago[flang] Rewrite test for CPU_TIME
Diana Picus [Fri, 18 Jun 2021 09:04:01 +0000 (09:04 +0000)]
[flang] Rewrite test for CPU_TIME

Don't rely on volatile writes to keep the CPU busy - it seems MSVC
optimizes them out, so we don't get different values for 'start' and
'end' on Windows. Rewrite the test to loop until we get a different
value for 'end'.

Fix suggested by Michael Kruse in
https://reviews.llvm.org/rG57e85622bbdb2eb18cc03df2ea457019c58f6912#inline-6002

Committing to fix the Windows buildbot, post-commit comments welcome!

3 years ago[llvm][Inliner] Add an optional PriorityInlineOrder
Liqiang Tao [Fri, 18 Jun 2021 08:55:18 +0000 (16:55 +0800)]
[llvm][Inliner] Add an optional PriorityInlineOrder

This patch adds an optional PriorityInlineOrder, which uses the heap to order inlining.
The callsite which size is smaller would have a higher priority.

Reviewed By: mtrofin

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

3 years ago[NFC] Assert non-zero factor before division
Max Kazantsev [Fri, 18 Jun 2021 08:49:56 +0000 (15:49 +0700)]
[NFC] Assert non-zero factor before division

This is to ensure that zero denominator leads to controlled
assertion failure rather than UB.

3 years ago[mlir][linalg] Fix PadTensorOp constructor
Matthias Springer [Fri, 18 Jun 2021 08:34:30 +0000 (17:34 +0900)]
[mlir][linalg] Fix PadTensorOp constructor

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

3 years ago[Polly][Isl] Refactoring IslAstInfo::getBuild() and IslAstInfo::IslAstUserPayload...
patacca [Fri, 18 Jun 2021 07:53:01 +0000 (09:53 +0200)]
[Polly][Isl] Refactoring IslAstInfo::getBuild() and IslAstInfo::IslAstUserPayload::Build to use isl++. NFC

Polly uses algorithms from the Integer Set Library (isl), which is a library written in C and which is incompatible with the rest of the LLVM as it is written in C++.

Changes made:
 - Refactoring the method `IslAstInfo::getBuild()`
 - `IslAstInfo::IslAstUserPayload.Build` now uses C++ types instead of C types
 - Removing destructor of `IslAstInfo::IslAstUserPayload`

Reviewed By: Meinersbur

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

3 years ago[Attributor] Don't print the call-graph in a hard-coded file.
Haojian Wu [Fri, 18 Jun 2021 07:18:03 +0000 (09:18 +0200)]
[Attributor] Don't print the call-graph in a hard-coded file.

This looks like not a practical pattern in our codebase (it could fail
in some sandbox environement).

Instead we print it via standard output, and it is controled by the
-attributor-print-call-graph, this follows a similiar pattern of attributor-print-dep.

3 years ago[libc][Obvious] Add the new header file PlatformDefs.h to the fputil target.
Siva Chandra Reddy [Fri, 18 Jun 2021 07:23:15 +0000 (07:23 +0000)]
[libc][Obvious] Add the new header file PlatformDefs.h to the fputil  target.

3 years ago[Demangle][Rust] Parse dot suffix
Tomasz Miąsko [Fri, 18 Jun 2021 07:27:50 +0000 (09:27 +0200)]
[Demangle][Rust] Parse dot suffix

Allow mangled names to include an arbitrary dot suffix, akin to vendor
specific suffix in Itanium mangling.

Primary motivation is a support for symbols renamed during ThinLTO
import / promotion (ThinLTO is the default configuration for optimized
builds in rustc).

Reviewed By: dblaikie

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

3 years agoRevert "[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)"
Daniil Seredkin [Fri, 18 Jun 2021 07:19:52 +0000 (14:19 +0700)]
Revert "[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)"

This reverts commit 31053338c97b36ffb582f9c04a74cec69cce3e70.

3 years ago[libc] Add few macro definitions to make it easy to accommodate Windows.
Siva Chandra Reddy [Fri, 18 Jun 2021 06:59:55 +0000 (06:59 +0000)]
[libc] Add few macro definitions to make it easy to accommodate Windows.

The new macro definitions have been used to add Windows specific
specializations.

3 years ago[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)
Daniil Seredkin [Wed, 2 Jun 2021 04:55:38 +0000 (11:55 +0700)]
[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)

InstCombine didn't perform (sext bool X) * (sext bool X) --> zext (and X, X) which can result in just (zext X). The patch adds regression tests to check this transformation and adds a check for equality of mul's operands for that case.

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

3 years ago[polly][GPGPU] Fixup related to overloading exponent type in llvm.powi
Bjorn Pettersson [Fri, 18 Jun 2021 06:58:44 +0000 (08:58 +0200)]
[polly][GPGPU] Fixup related to overloading exponent type in llvm.powi

Commit 4c7f820b2b206bb changed the llvm.powi intrinsic to support
different 'int' sizes for the exponent. That happened to break
the IntrinsicToLibdeviceFunc mapping in PPCGCodeGeneration, which
obviously should have been updated as part of commit 4c7f820b2b
(https://reviews.llvm.org/D99439).

The shortcoming was found by buildbots that use
   -DPOLLY_ENABLE_GPGPU_CODEGEN=ON

This patch should fixup the problem.

3 years agoRevert D103717 "[InstrProfiling] Make __profd_ unconditionally private for ELF"
Fangrui Song [Fri, 18 Jun 2021 06:38:17 +0000 (23:38 -0700)]
Revert D103717 "[InstrProfiling] Make __profd_ unconditionally private for ELF"

This reverts commit 76d0747e0807307780ba84cbd7e5c80b20c26bd7.

If a group has `__llvm_prf_vals` due to static value profiler counters
(`NS!=0`), we cannot make `__llvm_prf_data` private, because a prevailing text
section may reference `__llvm_prf_data` and will cause a `relocation refers to a
discarded section` linker error.

Note: while a `__profc_` group is non-prevailing, it may be referenced by a
prevailing text section due to inlining.

```
group section [   66] `.group' [__profc__ZN5clang20EmitClangDeclContextERN4llvm12RecordKeeperERNS0_11raw_ostreamE] contains 4 sections:
   [Index]    Name
   [   67]   __llvm_prf_cnts
   [   68]   __llvm_prf_vals
   [   69]   __llvm_prf_data
   [   70]   .rela__llvm_prf_data
```

3 years ago[Attributor][FIX] Arguments of unknown functions can be undef
Johannes Doerfert [Sun, 16 May 2021 05:12:08 +0000 (00:12 -0500)]
[Attributor][FIX] Arguments of unknown functions can be undef

This should fix PR50683. The wrong assumption was that we
could always know what the callee is when we replace a call site
argument with undef. We wanted to know that to remove the `noundef`
that might be attached to the argument. Since no callee means we
did the propagation on the caller site, there is no need to remove
an attribute. It is only needed if we replace all uses and therefore
pass `undef` instead of the value that was passed in otherwise.

3 years ago[Attributor] Allow to skip the initial update for a new AA
Johannes Doerfert [Fri, 18 Jun 2021 00:01:22 +0000 (19:01 -0500)]
[Attributor] Allow to skip the initial update for a new AA

Users might want to run initialize for a set of AAs without an
intermediate update step. Running update eagerly is not a requirement
anyway so we make it optional.

3 years ago[Attributor] Use a centralized value simplification interface
Johannes Doerfert [Thu, 17 Jun 2021 18:04:26 +0000 (13:04 -0500)]
[Attributor] Use a centralized value simplification interface

To allow outside AAs that simplify values we need to ensure all value
simplification goes through the Attributor, not AAValueSimplify (or any
of the other AAs we have already like AAPotentialValues). This patch
also introduces an interface for the outside AAs to register
simplification callbacks for an IRPosition. To make this work as
expected we have to pass IRPositions instead of Values in
AAValueSimplify, which makes sense by itself.

3 years ago[Attributor] Introduce a helper do deal with constant type mismatches
Johannes Doerfert [Mon, 10 May 2021 01:02:18 +0000 (20:02 -0500)]
[Attributor] Introduce a helper do deal with constant type mismatches

If we simplify values we sometimes end up with type mismatches. If the
value is a constant we can often cast it though to still allow
propagation. The logic is now put into a helper and it replaces some
ad hoc things we did before.

This also introduces the AA namespace for abstract attribute related
functions and types.

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

3 years ago[Attributor] Make sure Heap2Stack works properly on a GPU target
Johannes Doerfert [Thu, 17 Jun 2021 16:11:16 +0000 (11:11 -0500)]
[Attributor] Make sure Heap2Stack works properly on a GPU target

If the target stack is not accessible between different running
"threads" we have to make sure not to create allocas for mallocs
that might be used by multiple "threads". The "use check" is
sufficient to prevent this but if we apply the "free check" we have
to make sure the pointer is not communicated to others before
the free is reached.

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

3 years ago[OpenMP][NFC] Expose AAExecutionDomain and rename its getter
Johannes Doerfert [Wed, 12 May 2021 03:13:40 +0000 (22:13 -0500)]
[OpenMP][NFC] Expose AAExecutionDomain and rename its getter

The initial use for AAExecutionDomain was to determine if a single
thread executes a block. While this is sometimes informative most
of the time, and for other reasons, we actually want to know if it
is the "initial thread". Thus, the thread that started execution on
the current device. The deduction needs to be adjusted in a follow
up as the methods we use right not are looking for the OpenMP thread
id which is resets whenever a thread enters a parallel region. What
we basically want is to look for `llvm.nvvm.read.ptx.sreg.ntid.x` and
equivalent functions.

3 years ago[Attributor][NFC] Add test from PR49606
Johannes Doerfert [Thu, 10 Jun 2021 22:21:15 +0000 (17:21 -0500)]
[Attributor][NFC] Add test from PR49606

It is not clear to me how we fixed this, I reverted a few candidates but
I couldn't make the test fail. Still worth having it in our regression
suite.

3 years ago[Attributor][NFC] Precommit a set of test cases for load simplification
Johannes Doerfert [Tue, 8 Jun 2021 00:11:41 +0000 (19:11 -0500)]
[Attributor][NFC] Precommit a set of test cases for load simplification

3 years ago[Attributor][NFC] AAReachability is currently stateless, don't invalidate it
Johannes Doerfert [Thu, 6 May 2021 21:42:01 +0000 (16:42 -0500)]
[Attributor][NFC] AAReachability is currently stateless, don't invalidate it

We invalidated AAReachabilityImpl directly which is not helpful and
confusing as we still used it regardless. We now avoid invalidating it
(not needed anyway) and add checks for the state. This has by itself no
actual effect but prepares for later extensions.

3 years ago[dfsan] Replace dfs$ prefix with .dfsan suffix
George Balatsouras [Thu, 17 Jun 2021 21:55:05 +0000 (14:55 -0700)]
[dfsan] Replace dfs$ prefix with .dfsan suffix

The current naming scheme adds the `dfs$` prefix to all
DFSan-instrumented functions.  This breaks mangling and prevents stack
trace printers and other tools from automatically demangling function
names.

This new naming scheme is mangling-compatible, with the `.dfsan`
suffix being a vendor-specific suffix:
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-structure

With this fix, demangling utils would work out-of-the-box.

Reviewed By: stephan.yichao.zhao

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

3 years ago[RISCV] Don't enable Interleaved Access Vectorization
Luke [Wed, 16 Jun 2021 14:38:24 +0000 (22:38 +0800)]
[RISCV] Don't enable Interleaved Access Vectorization

The patch https://reviews.llvm.org/D101469 is intended to enable loop unrolling,
not interleaved access vectorization. The method bool enableInterleavedAccessVectorization()
should not be implemented.

3 years ago[InstCombine][NFC] Added tests for mul with zext/sext operands
Daniil Seredkin [Fri, 18 Jun 2021 04:03:36 +0000 (11:03 +0700)]
[InstCombine][NFC] Added tests for mul with zext/sext operands

Baseline tests for D104193

3 years ago[objdump][ARM] Fix evaluating the target address of a Thumb BLX(i)
Igor Kudrin [Fri, 18 Jun 2021 03:40:55 +0000 (10:40 +0700)]
[objdump][ARM] Fix evaluating the target address of a Thumb BLX(i)

The instruction can be 16-bit aligned while targeting 32-bit aligned
code. To calculate the target address correctly, the address of the
instruction has to be adjusted.

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

3 years ago[AMDGPU] Remove duplicate setOperationAction for v4i16/v4f16 (NFC)
Carl Ritson [Fri, 18 Jun 2021 03:22:03 +0000 (12:22 +0900)]
[AMDGPU] Remove duplicate setOperationAction for v4i16/v4f16 (NFC)

3 years ago[WebAssembly] Rename event to tag
Heejin Ahn [Tue, 15 Jun 2021 08:49:43 +0000 (01:49 -0700)]
[WebAssembly] Rename event to tag

We recently decided to change 'event' to 'tag', and 'event section' to
'tag section', out of the rationale that the section contains a
generalized tag that references a type, which may be used for something
other than exceptions, and the name 'event' can be confusing in the web
context.

See
- https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130
- https://github.com/WebAssembly/exception-handling/pull/161

Reviewed By: tlively

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

3 years agoBring our handling of -Wframe-larger-than more in line with GCC.
Richard Smith [Fri, 18 Jun 2021 03:26:15 +0000 (20:26 -0700)]
Bring our handling of -Wframe-larger-than more in line with GCC.

Support -Wno-frame-larger-than (with no =) and make it properly
interoperate with -Wframe-larger-than. Reject -Wframe-larger-than with
no argument.

We continue to support Clang's old spelling, -Wframe-larger-than=, for
compatibility with existing users of that facility.

In passing, stop the driver from accepting and ignoring
-fwarn-stack-size and make it a cc1-only flag as intended.

3 years ago[Coroutine] Properly deal with byval and noalias parameters
Xun Li [Fri, 18 Jun 2021 02:06:10 +0000 (19:06 -0700)]
[Coroutine] Properly deal with byval and noalias parameters

This patch is to address https://bugs.llvm.org/show_bug.cgi?id=48857.
Previous attempts can be found in D104007 and D101980.
A lot of discussions can be found in those two patches.
To summarize the bug:
When Clang emits IR for coroutines, the first thing it does is to make a copy of every argument to the local stack, so that uses of the arguments in the function will all refer to the local copies instead of the arguments directly.
However, in some cases we find that arguments are still directly used:
When Clang emits IR for a function that has pass-by-value arguments, sometimes it emits an argument with byval attribute. A byval attribute is considered to be local to the function (just like alloca) and hence it can be easily determined that it does not alias other values. If in the IR there exists a memcpy from a byval argument to a local alloca, and then from that local alloca to another alloca, MemCpyOpt will optimize out the first memcpy because byval argument's content will not change. This causes issues because after a coroutine suspension, the byval argument may die outside of the function, and latter uses will lead to memory use-after-free.
This is only a problem for arguments with either byval attribute or noalias attribute, because only these two kinds are considered local. Arguments without these two attributes will be considered to alias coro_suspend and hence we won't have this problem. So we need to be able to deal with these two attributes in coroutines properly.
For noalias arguments, since coro_suspend may potentially change the value of any argument outside of the function, we simply shouldn't mark any argument in a coroutiune as noalias. This can be taken care of in CoroEarly pass.
For byval arguments, if such an argument needs to live across suspensions, we will have to copy their value content to the frame, not just the pointer.

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

3 years ago[M68k][NFC] Fix indentation in M68kInstrArithmetic.td
Jim Lin [Fri, 18 Jun 2021 01:49:03 +0000 (09:49 +0800)]
[M68k][NFC] Fix indentation in M68kInstrArithmetic.td

Merely fix indentation

Reviewed By: myhsu

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

3 years agoFrontend: Respect -fno-temp-file when creating a PCH
Zachary Henkel [Fri, 18 Jun 2021 01:02:36 +0000 (18:02 -0700)]
Frontend: Respect -fno-temp-file when creating a PCH

When creating a PCH file the use of a temp file will be dictated by the
presence or absence of the -fno-temp-file flag. Creating a module file
will always use a temp file via the new ForceUseTemporary flag.

This fixes bug 50033.

3 years ago[FIX][Attributor] Fix broken build due to missing virtual deconstructors.
Kuter Dinel [Fri, 18 Jun 2021 04:30:31 +0000 (07:30 +0300)]
[FIX][Attributor] Fix broken build due to missing virtual deconstructors.

The lack some virtual deconstructors where causing some builds bots to fail.
This patch fixes that.

Problematic commit:
https://reviews.llvm.org/rGeaf1b6810ce0f40008b2b1d902750eafa3e198d3

Build bot:
https://lab.llvm.org/buildbot/#/builders/18/builds/1741

3 years ago[clang][AST] Make `getLocalOrImportedSubmoduleID` work with const `Module*`. NFC.
Volodymyr Sapsai [Wed, 16 Jun 2021 01:36:46 +0000 (18:36 -0700)]
[clang][AST] Make `getLocalOrImportedSubmoduleID` work with const `Module*`. NFC.

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

3 years ago[lld][WebAssembly] Fix crash calling weakly undefined function in PIC code
Sam Clegg [Thu, 17 Jun 2021 23:41:01 +0000 (16:41 -0700)]
[lld][WebAssembly] Fix crash calling weakly undefined function in PIC code

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

3 years ago[trace][intel-pt] Create basic SB API
Walter Erquinigo [Tue, 1 Jun 2021 22:34:06 +0000 (15:34 -0700)]
[trace][intel-pt] Create basic SB API

This adds a basic SB API for creating and stopping traces.
Note: This doesn't add any APIs for inspecting individual instructions. That'd be a more complicated change and it might be better to enhande the dump functionality to output the data in binary format. I'll leave that for a later diff.

This also enhances the existing tests so that they test the same flow using both the command interface and the SB API.

I also did some cleanup of legacy code.

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

3 years ago[lldb-vscode] remove failed test
Walter Erquinigo [Thu, 17 Jun 2021 22:07:36 +0000 (15:07 -0700)]
[lldb-vscode] remove failed test

Found in http://green.lab.llvm.org/green/job/lldb-cmake/32891/testReport/lldb-api/tools_lldb-vscode_launch/TestVSCode_launch_py/

the lldb-vscode changed and that test makes no sense anymore

3 years ago[NFC][SimpleLoopUnswitch] unswitchTrivialBranch(): add debug output explaining unswit...
Roman Lebedev [Thu, 17 Jun 2021 20:28:03 +0000 (23:28 +0300)]
[NFC][SimpleLoopUnswitch] unswitchTrivialBranch(): add debug output explaining unswitching failure

It's not prohibitively verbose, and allows easier understanding
why certain unswitching ultimately wasn't performed.

3 years ago[Attributor] Derive AACallEdges attribute
Kuter Dinel [Thu, 10 Jun 2021 20:24:13 +0000 (23:24 +0300)]
[Attributor] Derive AACallEdges attribute

This attribute computes the optimistic live call edges using the attributor
liveness information. This attribute will be used for deriving a
inter-procedural function reachability attribute.

Reviewed By: jdoerfert

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

3 years agoRevert "[DFSan] Cleanup code for platforms other than Linux x86_64."
Andrew Browne [Thu, 17 Jun 2021 21:18:45 +0000 (14:18 -0700)]
Revert "[DFSan] Cleanup code for platforms other than Linux x86_64."

This reverts commit 8441b993bdba29437b296bad6a37464669eef35e.

Buildbot failures.

3 years ago[InstrProfiling] Make __profd_ unconditionally private for ELF
Fangrui Song [Thu, 17 Jun 2021 21:16:54 +0000 (14:16 -0700)]
[InstrProfiling] Make __profd_ unconditionally private for ELF

For ELF, since all counters/data are in a section group (either `comdat any` or
`comdat noduplicates`), and the signature for `comdat any` is `__profc_`, the
D1003372 optimization prerequisite (linker GC cannot discard data variables
while the text section is retained) is always satisified, we can make __profd_
unconditionally private.

Reviewed By: davidxl, rnk

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

3 years ago[PartiallyInlineLibCalls] Disable sqrt expansion for strictfp.
Craig Topper [Thu, 17 Jun 2021 18:31:56 +0000 (11:31 -0700)]
[PartiallyInlineLibCalls] Disable sqrt expansion for strictfp.

This pass emits a floating point compare and a conditional branch,
but if strictfp is enabled we don't emit a constrained compare
intrinsic.

The backend also won't expand the readonly sqrt call this pass inserts
to a sqrt instruction under strictfp. So we end up with 2 libcalls as
seen here. https://godbolt.org/z/oax5zMEWd

Fix these things by disabling the pass.

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

3 years ago[DFSan] Cleanup code for platforms other than Linux x86_64.
Andrew Browne [Thu, 17 Jun 2021 19:12:27 +0000 (12:12 -0700)]
[DFSan] Cleanup code for platforms other than Linux x86_64.

These other platforms are unsupported and untested.
They could be re-added later based on MSan code.

Reviewed By: gbalats, stephan.yichao.zhao

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

3 years ago[ScalarEvolution] Fix pointer/int type handling converting select/phi to min/max.
Eli Friedman [Wed, 16 Jun 2021 07:00:13 +0000 (00:00 -0700)]
[ScalarEvolution] Fix pointer/int type handling converting select/phi to min/max.

The old version of this code would blindly perform arithmetic without
paying attention to whether the types involved were pointers or
integers.  This could lead to weird expressions like negating a pointer.

Explicitly handle simple cases involving pointers, like "x < y ? x : y".
In all other cases, coerce the operands of the comparison to integer
types.  This avoids the weird cases, while handling most of the
interesting cases.

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

3 years agoRISCV: clean up target expression handling
Saleem Abdulrasool [Thu, 17 Jun 2021 17:09:22 +0000 (17:09 +0000)]
RISCV: clean up target expression handling

The target specific expression handling was slightly regressed by
bbea64250f65480d787e1c5ff45c4de3ec2dcda8.  This restores the proper
sub-expression evaluation to allow for constant folding within the
expression.  We explicitly discard the layout and assembler when
evaluating the expression to avoid any symbolic computation and instead
using the `evaluateAsRelocatable` to canonicalise and constant fold
only.

We can also simplify the expression handling - none of the target
variants support symbolic difference.  This simplifies the logic for
that and adds additional tests to ensure that we do not accidentally
regress here in the future.

Reviewed By: maskray

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

3 years ago[libc++] Make sure std::allocator<void> is always trivial
Louis Dionne [Wed, 16 Jun 2021 16:35:00 +0000 (12:35 -0400)]
[libc++] Make sure std::allocator<void> is always trivial

When we removed the allocator<void> specialization, the triviality of
std::allocator<void> changed because the primary template had a
non-trivial default constructor and the specialization didn't
(so std::allocator<void> went from trivial to non-trivial).

This commit fixes that oversight by giving a trivial constructor to
the primary template when instantiated on cv-void.

This was reported in https://llvm.org/PR50299.

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

3 years ago[GISel] Eliminate redundant bitmasking
Jon Roelofs [Fri, 28 May 2021 18:41:20 +0000 (11:41 -0700)]
[GISel] Eliminate redundant bitmasking

This was a GISel vs SDAG regression that showed up at -Os on arm64 in:
SingleSource/Benchmarks/Adobe-C++/simple_types_constant_folding.test

https://llvm.godbolt.org/z/aecjodsjG

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

3 years ago[AArch64][GISel] and+or+shl => bfi
Jon Roelofs [Thu, 27 May 2021 22:11:55 +0000 (15:11 -0700)]
[AArch64][GISel] and+or+shl => bfi

This fixes a GISEL vs SDAG regression that showed up at -Os in 256.bzip2

In `_getAndMoveToFrontDecode`:

gisel:
```
and w9, w0, #0xff
orr w9, w9, w8, lsl #8
```

sdag:
```
bfi w0, w8, #8, #24
```

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

3 years agoRevert "[NFC] Remove checking pointee type for byval/preallocated type"
Jorge Gorbe Moya [Thu, 17 Jun 2021 19:17:07 +0000 (12:17 -0700)]
Revert "[NFC] Remove checking pointee type for byval/preallocated type"

This reverts commit 738abfdbea21acd2597d83ad3390daf5696b6d07.

3 years ago[lldb-vscode] only report long running progress events
Walter Erquinigo [Fri, 30 Apr 2021 04:27:12 +0000 (21:27 -0700)]
[lldb-vscode] only report long running progress events

When the number of shared libs is massive, there could be hundreds of
thousands of short lived progress events sent to the IDE, which makes it
irresponsive while it's processing all this data. As these small jobs
take less than a second to process, the user doesn't even see them,
because the IDE only display the progress of long operations. So it's
better not to send these events.

I'm fixing that by sending only the events that are taking longer than 5
seconds to process.
In a specific run, I got the number of events from ~500k to 100, because
there was only 1 big lib to parse.

I've tried this on several small and massive targets, and it seems to
work fine.

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

3 years ago[LoopUnroll] Fold all exits based on known trip count/multiple
Nikita Popov [Sun, 13 Jun 2021 14:55:17 +0000 (16:55 +0200)]
[LoopUnroll] Fold all exits based on known trip count/multiple

Fold all exits based on known trip count/multiple information from
SCEV. Previously only the latch exit or the single exit were folded.

This doesn't yet eliminate ULO.TripCount and ULO.TripMultiple
entirely: They're still used to a) decide whether runtime unrolling
should be performed and b) for ORE remarks. However, the core
unrolling logic is independent of them now.

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

3 years ago[MCA] [RegisterFile] Allow for skipping Defs with RegID of 0 (rather than assert...
Patrick Holland [Wed, 16 Jun 2021 22:53:00 +0000 (15:53 -0700)]
[MCA] [RegisterFile] Allow for skipping Defs with RegID of 0 (rather than assert(RegID) like we do before this patch).

This patch will allow developers to remove unwanted instruction Defs (most likely from within a target specific InstrPostProcess) by setting that Def's RegisterID to 0.
Differential Revision: https://reviews.llvm.org/D104433

3 years ago[lld][WebAssembly] Add new `--import-undefined` option
Sam Clegg [Thu, 27 May 2021 21:27:10 +0000 (14:27 -0700)]
[lld][WebAssembly] Add new `--import-undefined` option

This change revisits https://reviews.llvm.org/D79248 which originally
added support for the --unresolved-symbols flag.

At the time I thought it would make sense to add a third option to this
flag called `import-functions` but it turns out (as was suspects by on
the reviewers IIRC) that this option can be authoganal.

Instead I've added a new option called `--import-undefined` that only
operates on symbols that can be imported (for example, function symbols
can always be imported as opposed to data symbols we can only be
imported when compiling with PIC).

This option gives us the full expresivitiy that emscripten needs to be
able allow reporting of undefined data symbols as well as the option to
disable that.

This change does remove the `--unresolved-symbols=import-functions`
option, which is been in the codebase now for about a year but I would
be extremely surprised if anyone was using it.

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

3 years ago[lld-macho] Rework mergeFlag to behave closer to what ld64 does.
Vy Nguyen [Wed, 9 Jun 2021 16:12:10 +0000 (12:12 -0400)]
[lld-macho] Rework mergeFlag to behave closer to what ld64 does.

Details:
I've been getting a few weird errors similar to the following from our internal tests:

```
ld64.lld.darwinnew: error: Cannot merge section __eh_frame (type=0x0) into __eh_frame (type=0xB): inconsistent types
ld64.lld.darwinnew: error: Cannot merge section __eh_frame (flags=0x0) into __eh_frame (flags=0x6800000B): strict flags differ
ld64.lld.darwinnew: error: Cannot merge section __eh_frame (type=0x0) into __eh_frame (type=0xB): inconsistent types
ld64.lld.darwinnew: error: Cannot merge section __eh_frame (flags=0x0) into __eh_frame (flags=0x6800000B): strict flags differ
```

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

3 years ago[llvm-symbolizer][docs] Update example for --verbose in the guide
Andrew Ng [Fri, 11 Jun 2021 15:58:00 +0000 (16:58 +0100)]
[llvm-symbolizer][docs] Update example for --verbose in the guide

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

3 years ago[X86] AMD Zen 3: don't confuse shift and shuffle, NFC
Roman Lebedev [Thu, 17 Jun 2021 18:04:52 +0000 (21:04 +0300)]
[X86] AMD Zen 3: don't confuse shift and shuffle, NFC

These proc res groups occupy the exact same pipes,
so this doesn't affect the modelling,
but it's confusing nontheless.

3 years ago[NFC] LoopVectorizationCostModel::getMaximizedVFForTarget(): clarify debug msg
Roman Lebedev [Thu, 17 Jun 2021 17:53:48 +0000 (20:53 +0300)]
[NFC] LoopVectorizationCostModel::getMaximizedVFForTarget(): clarify debug msg

This really isn't talking about vectors in general,
but only about either fixed or scalable vectors,
and it's pretty confusing to see it state
that there aren't any vectors :)

3 years ago[AIX] Remove --as-needed passing into aix linker
jasonliu [Thu, 17 Jun 2021 17:14:49 +0000 (17:14 +0000)]
[AIX] Remove --as-needed passing into aix linker

Summary:
AIX does not support --as-needed linker options. Remove that option from
aix linker when -lunwind is needed.
For unwinder library, nothing special is needed because by default aix
linker has the as-needed effect for library that's an archive (which is
the case for libunwind on AIX).

Reviewed By: daltenty

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

3 years ago[gn build] Port f27e4548fc42
LLVM GN Syncbot [Thu, 17 Jun 2021 17:09:43 +0000 (17:09 +0000)]
[gn build] Port f27e4548fc42

3 years ago[lld-macho] Implement ICF
Greg McGary [Wed, 19 May 2021 16:58:17 +0000 (09:58 -0700)]
[lld-macho] Implement ICF

ICF = Identical C(ode|OMDAT) Folding

This is the LLD ELF/COFF algorithm, adapted for MachO. So far, only `-icf all` is supported. In order to support `-icf safe`, we will need to port address-significance tables (`.addrsig` directives) to MachO, which will come in later diffs.

`check-{llvm,clang,lld}` have 0 regressions for `lld -icf all` vs. baseline ld64.

We only run ICF on `__TEXT,__text` for reasons explained in the block comment in `ConcatOutputSection.cpp`.

Here is the perf impact for linking `chromium_framekwork` on a Mac Pro (16-core Xeon W) for the non-ICF case vs. pre-ICF:
```
    N           Min           Max        Median           Avg        Stddev
x  20          4.27          4.44          4.34         4.349   0.043029977
+  20          4.37          4.46         4.405        4.4115   0.025188761
Difference at 95.0% confidence
        0.0625 +/- 0.0225658
        1.43711% +/- 0.518873%
        (Student's t, pooled s = 0.0352566)
```

Reviewed By: #lld-macho, int3

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

3 years ago[clang] Fix a race condition in the build of clangInterpreter
Stella Stamenova [Thu, 17 Jun 2021 17:03:33 +0000 (10:03 -0700)]
[clang] Fix a race condition in the build of clangInterpreter

The library depends on Attributes.inc, so it has to depend on the intrinsics_gen target

Reviewed By: v.g.vassilev

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

3 years ago[mlir][sparse] Add Matricized Tensor Times Khatri-Rao Product (MTTKRP) integration...
Gus Smith [Wed, 16 Jun 2021 21:07:15 +0000 (21:07 +0000)]
[mlir][sparse] Add Matricized Tensor Times Khatri-Rao Product (MTTKRP) integration test

See this documentation from taco:
http://tensor-compiler.org/docs/data_analytics/index.html

Reviewed By: aartbik

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

3 years ago[libcxx][module-map] 🎨 updates module map to account for ranges headers
Christopher Di Bella [Wed, 16 Jun 2021 19:12:51 +0000 (19:12 +0000)]
[libcxx][module-map] 🎨 updates module map to account for ranges headers

Corresponding module map update for D104414, split out for rollback
reasons.

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

3 years ago[libcxx][iwyu] 🎨 adds more headers to IWYU
Christopher Di Bella [Wed, 16 Jun 2021 19:02:23 +0000 (19:02 +0000)]
[libcxx][iwyu] 🎨 adds more headers to IWYU

A few slipped through the cracks because D104175 and D104170 didn't
concern themselves with newer commits.

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

3 years agotest: clean up some of the RISCV tests (NFC)
Saleem Abdulrasool [Thu, 17 Jun 2021 16:48:51 +0000 (16:48 +0000)]
test: clean up some of the RISCV tests (NFC)

This addresses some post-commit comments from jrtc27 to make the tests
easier to process.

3 years agofix an -Wunused-variable warning in release built, NFC
Haojian Wu [Thu, 17 Jun 2021 16:48:12 +0000 (18:48 +0200)]
fix an -Wunused-variable warning in release built, NFC

3 years ago[InstSimplify] add tests for computeKnownBits of shift-with-bitcast op; NFC
Sanjay Patel [Thu, 17 Jun 2021 15:57:44 +0000 (11:57 -0400)]
[InstSimplify] add tests for computeKnownBits of shift-with-bitcast op; NFC

3 years ago[InstCombine][x86] add tests for complex vector shift value tracking; NFC
Sanjay Patel [Wed, 16 Jun 2021 19:30:55 +0000 (15:30 -0400)]
[InstCombine][x86] add tests for complex vector shift value tracking; NFC

https://llvm.org/PR50123

3 years ago[compiler-rt][hwasan]: undefine new/delete operators with alignment on Android.
Yabin Cui [Thu, 17 Jun 2021 16:25:58 +0000 (09:25 -0700)]
[compiler-rt][hwasan]: undefine new/delete operators with alignment on Android.

This is to fix build on Android. And we don't want to intercept more new/delete operators on Android.

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

3 years agoRevert "Remove obsolete call to AsyncSignalSafeLazyInitiFakeStack."
Kevin Athey [Thu, 17 Jun 2021 16:26:13 +0000 (09:26 -0700)]
Revert "Remove obsolete call to AsyncSignalSafeLazyInitiFakeStack."

This reverts commit 07481b37961f5b9a670c924367d2ead2e3c32b86.

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

3 years agoRISCV: adjust handling of relocation emission for RISCV
Saleem Abdulrasool [Wed, 26 May 2021 15:41:11 +0000 (15:41 +0000)]
RISCV: adjust handling of relocation emission for RISCV

This re-architects the RISCV relocation handling to bring the
implementation closer in line with the implementation in binutils.  We
would previously aggressively resolve the relocation.  With this
restructuring, we always will emit a paired relocation for any symbolic
difference of the type of S±T[±C] where S and T are labels and C is a
constant.

GAS has a special target hook controlled by `RELOC_EXPANSION_POSSIBLE`
which indicates that a fixup may be expanded into multiple relocations.
This is used by the RISCV backend to always emit a paired relocation -
either ADD[WIDTH] + SUB[WIDTH] for text relocations or SET[WIDTH] +
SUB[WIDTH] for a debug info relocation.  Irrespective of whether linker
relaxation support is enabled, symbolic difference is always emitted as
a paired relocation.

This change also sinks the target specific behaviour down into the
target specific area rather than exposing it to the shared relocation
handling.  In the process, we also sink the "special" handling for debug
information down into the RISCV target.  Although this improves the path
for the other targets, this is not necessarily entirely ideal either.
The changes in the debug info emission could be done through another
type of hook as this functionality would be required by any other target
which wishes to do linker relaxation.  However, as there are no other
targets in LLVM which currently do this, this is a reasonable thing to
do until such time as the code needs to be shared.

Improve the handling of the relocation (and add a reduced test case from
the Linux kernel) to ensure that we handle complex expressions for
symbolic difference.  This ensures that we correct relocate symbols with
the adddends normalized and associated with the addition portion of the
paired relocation.

This change also addresses some review comments from Alex Bradbury about
the relocations meant for use in the DWARF CFA being named incorrectly
(using ADD6 instead of SET6) in the original change which introduced the
relocation type.

This resolves the issues with the symbolic difference emission
sufficiently to enable building the Linux kernel with clang+IAS+lld
(without linker relaxation).

Resolves PR50153, PR50156!
Fixes: ClangBuiltLinux/linux#1023, ClangBuiltLinux/linux#1143

Reviewed By: nickdesaulniers, maskray

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

3 years agoReapply "[DebugInfo] Prevent non-determinism when updating DIArgList users of a value"
Stephen Tozer [Thu, 17 Jun 2021 14:21:10 +0000 (15:21 +0100)]
Reapply "[DebugInfo] Prevent non-determinism when updating DIArgList users of a value"

Reapply the commit which previously caused build failures due to the
mismatched template arguments between the return type and the returned
SmallVector.

This reverts commit e8991caea8690ec2d17b0b7e1c29bf0da6609076.

3 years ago[lld-macho] Avoid force-loading the same archive twice
Jez Ng [Thu, 17 Jun 2021 15:12:52 +0000 (11:12 -0400)]
[lld-macho] Avoid force-loading the same archive twice

We need to dedup archive loads (similar to what we do for dylib
loads).

I noticed this issue after building some Swift stuff that used
`-force_load_swift_libs`, as it caused some Swift archives to be loaded
many times.

Reviewed By: #lld-macho, thakis, MaskRay

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

3 years ago[clangd] Explicitly fail if the file passed to --check is not valid.
Haojian Wu [Thu, 17 Jun 2021 12:33:24 +0000 (14:33 +0200)]
[clangd] Explicitly fail if the file passed to --check is not valid.

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

3 years ago[FPEnv][InstSimplify] Precommit tests for D103169.
Kevin P. Neal [Thu, 17 Jun 2021 14:30:21 +0000 (10:30 -0400)]
[FPEnv][InstSimplify] Precommit tests for D103169.

In D103169 I'm adding to InstSimplify support for NaN to constrained
intrinsics that have a regular FP IR instruction counterpart. Precommit
the tests for clarity when that ticket lands.