platform/upstream/llvm.git
4 years ago[ELF] Improve the condition to create .interp
Fangrui Song [Mon, 3 Jun 2019 05:25:03 +0000 (05:25 +0000)]
[ELF] Improve the condition to create .interp

Similar to rL362355, but with the `!config->shared` guard.

(1) {gcc,clang} -fuse-ld=bfd -pie -fPIE -nostdlib a.c => .interp created
(2) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c => .interp not created
(3) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c a.so => .interp created

The inconsistency of (2) is due to the condition `!Config->SharedFiles.empty()`.
To make lld behave more like ld.bfd, we could change the condition to:

    config->hasDynSymTab && !config->dynamicLinker.empty() && script->needsInterpSection();

However, that would bring another inconsistency as can be observed with:

(4) {gcc,clang} -fuse-ld=bfd -no-pie -nostdlib a.c => .interp not created

4 years ago[X86] Add custom widening for v2f64->v2i32 strict_fp_to_uint with avx512f, but not...
Craig Topper [Thu, 26 Dec 2019 20:26:39 +0000 (12:26 -0800)]
[X86] Add custom widening for v2f64->v2i32 strict_fp_to_uint with avx512f, but not avx512vl.

AVX512F added instruction for vector fp_to_uint conversions. With
AVX512VL we can use a specific instruction that does v2f64->v4i32 with
zeroes in the 2 extra elements. For non-strict nodes without AVX512VL
we relied on type legalization to turn it to v4f64->v4i32 which would
later be widened by op legalization to v8f64->v8i32. But type legalization
doesn't currently widen strict nodes since it doesn't know how to
safely and efficiently pad the extra elements. But for X86 we know
padding with zeroes is safe and efficient so do that ourselves.

4 years agoAllow newlines in AST Matchers in clang-query files
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Allow newlines in AST Matchers in clang-query files

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRevert "[msan] Check qsort input."
Evgenii Stepanov [Thu, 26 Dec 2019 20:27:29 +0000 (12:27 -0800)]
Revert "[msan] Check qsort input."

This change breaks LLVM bootstrap with ASan and MSan.

FAILED: lib/ToolDrivers/llvm-lib/Options.inc
OptParser.td:137:1: error: Option is equivalent to
def INPUT : Option<[], "<input>", KIND_INPUT>;
^
OptParser.td:137:1: error: Other defined here
def INPUT : Option<[], "<input>", KIND_INPUT>;

This reverts commit caa48a6b88aeed8ae80e6ddb1eae8c6a7cbe260b.

4 years agoRevert "Allow newlines in AST Matchers in clang-query files"
Stephen Kelly [Thu, 26 Dec 2019 20:16:23 +0000 (20:16 +0000)]
Revert "Allow newlines in AST Matchers in clang-query files"

This reverts commit 6a3ecf4dc7ec299394e71b3124df2b3a34ed4ac3.

4 years agoAllow newlines in AST Matchers in clang-query files
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Allow newlines in AST Matchers in clang-query files

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoMake lazyload_metadata.ll resilient to the addition of new metadata kinds
David Herzka [Thu, 26 Dec 2019 18:56:07 +0000 (13:56 -0500)]
Make lazyload_metadata.ll resilient to the addition of new metadata kinds

Summary: The specific number of records loaded depends on the number of kinds, but the difference between the lazy and not lazy cases does not.

Reviewers: modocache

Subscribers: llvm-commits, dexonsmith, steven_wu, hiraditya, mehdi_amini

Tags: #llvm

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

4 years ago[DebugInfo][SelectionDAG] Change order while transferring SDDbgValue to another node
Kristina Bessonova [Thu, 5 Dec 2019 20:26:21 +0000 (23:26 +0300)]
[DebugInfo][SelectionDAG] Change order while transferring SDDbgValue to another node

SelectionDAG::transferDbgValues() can 'reattach' SDDbgValue from one to
another node, but doesn't change its source order. If the destination node has
the order greater than the SDDbgValue, there are two possible issues
revealed later:

* If debug info is attached to an instruction that is the first definition
of a register, this ends up with a def-after-use and the debug info
gets 'undef' later.

* If MIR has another definition of a register above the debug info,
the debug info may represent a source variable incorrectly because
it appears (significantly) before an instruction corresponded
to this debug info.

So, the patch changes the order of an SDDbgValue when it is moved
to a node with greater order.

Reviewers: dblaikie, jmorse, aprantl

Reviewed By: aprantl

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ELF] Support input section description .gnu.version* in /DISCARD/
Fangrui Song [Sun, 22 Dec 2019 22:50:14 +0000 (14:50 -0800)]
[ELF] Support input section description .gnu.version* in /DISCARD/

Linux powerpc discards `*(.gnu.version*)` (arch/powerpc/kernel/vmlinux.lds.S)
to suppress --orphan-handling=warn warnings in the -pie output `.tmp_vmlinux1`

The support is simple. Just add isLive() to:

1) Fix an assertion in SectionBase::getPartition() called by VersionTableSection::isNeeded().
2) Suppress DT_VERSYM, DT_VERDEF, DT_VERNEED and DT_VERNEEDNUM, if the relevant section is discarded.

Reviewed By: grimar

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

4 years ago[Attributor] Add helper to change an instruction to `unreachable` inst
Hideto Ueno [Thu, 26 Dec 2019 17:39:37 +0000 (02:39 +0900)]
[Attributor] Add helper to change an instruction to `unreachable` inst

Summary: Calling `changeToUnreachable` in `manifest` from different places might cause really unpredictable problems. As other deleting functions are doing, we need to change these instructions after all `manifest`.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[BPF] Enable relocation location for load/store/shifts
Yonghong Song [Thu, 19 Dec 2019 23:21:53 +0000 (15:21 -0800)]
[BPF] Enable relocation location for load/store/shifts

Previous btf field relocation is always at assignment like
   r1 = 4
which is converted from an ld_imm64 instruction.

This patch did an optimization such that relocation
instruction might be load/store/shift. Specically, the
following insns may also have relocation, except BPF_MOV:
  LDB, LDH, LDW, LDD, STB, STH, STW, STD,
  LDB32, LDH32, LDW32, STB32, STH32, STW32,
  SLL, SRL, SRA

To accomplish this, a few BPF target specific
codegen only instructions are invented. They
are generated at backend BPF SimplifyPatchable phase,
which is at early llc phase when SSA form is available.
The new codegen only instructions will be converted to
real proper instructions at the codegen and BTF emission stage.

Note that, as revealed by a few tests, this optimization might
be actual generating more relocations:
Scenario 1:
  if (...) {
    ... __builtin_preserve_field_info(arg->b2, 0) ...
  } else {
    ... __builtin_preserve_field_info(arg->b2, 0) ...
  }
  Compiler could do CSE to only have one relocation. But if both
  of the above is translated into codegen internal instructions,
  the compiler will not be able to do that.
Scenario 2:
  offset = ... __builtin_preserve_field_info(arg->b2, 0) ...
  ...
  ...  offset ...
  ...  offset ...
  ...  offset ...
  For whatever reason, the compiler might be temporarily do copy
  propagation of the righthand of "offset" assignment like
  ...  __builtin_preserve_field_info(arg->b2, 0) ...
  ...  __builtin_preserve_field_info(arg->b2, 0) ...
  and CSE will be able to deduplicate later.
  But if these intrinsics are converted to BPF pseudo instructions,
  they will not be able to get deduplicated.

I do not expect we have big instruction count difference.
It may actually reduce instruction count since now relocation
is in deeper insn dependency chain.
For example, for test offset-reloc-fieldinfo-2.ll, this patch
generates 7 instead of 6 relocations for non-alu32 mode, but it
actually reduced instruction count from 29 to 26.

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

4 years ago[OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang
Johannes Doerfert [Thu, 26 Dec 2019 00:15:36 +0000 (18:15 -0600)]
[OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang

This removes the OpenMPProcBindClauseKind enum in favor of
llvm::omp::ProcBindKind which lives in OpenMPConstants.h and was
introduced in D70109.

No change in behavior is expected.

Reviewed By: JonChesterfield

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

4 years ago[X86] Merge the SINT_TO_FP/UINT_TO_FP handlers in ReplaceNodeResults since the AVX512...
Craig Topper [Thu, 26 Dec 2019 08:23:31 +0000 (00:23 -0800)]
[X86] Merge the SINT_TO_FP/UINT_TO_FP handlers in ReplaceNodeResults since the AVX512DQ+AVX512VL code is very similar in both. NFC

4 years ago[X86] Add custom lowering for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp for...
Craig Topper [Thu, 26 Dec 2019 08:04:37 +0000 (00:04 -0800)]
[X86] Add custom lowering for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp for avx512dq+avx512vl targets.

With avx512dq+avx512vl we have instruction that implements this and
places zeroes in the upper 64-bits of the destination xmm register.

4 years ago[X86] Add test cases for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp.
Craig Topper [Thu, 26 Dec 2019 07:46:05 +0000 (23:46 -0800)]
[X86] Add test cases for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp.

4 years ago[X86] Add avx512f and avx512dq+vl command lines to the vector strictfp int<->fp tests.
Craig Topper [Thu, 26 Dec 2019 07:34:32 +0000 (23:34 -0800)]
[X86] Add avx512f and avx512dq+vl command lines to the vector strictfp int<->fp tests.

4 years agoPartially revert "Add initial tests for update_{llc_,cc_,}test_checks.py"
Reid Kleckner [Thu, 26 Dec 2019 16:46:29 +0000 (08:46 -0800)]
Partially revert "Add initial tests for update_{llc_,cc_,}test_checks.py"

This reverts part of commit 240aff80e0e59b79779d046b3275904fc0750d59.
It reverts cc802ea67beb66d2f8a935e647c3aedcf7848211.

We currently run LLVM tests in environments where python3 exists on
PATH, but it is broken. I don't think PATH discovery is a strong enough
signal that a working Python 3 installation exists.

If this will be the way forward, IMO we should follow the direction of
debug-info-tests, and use CMake's PYTHON_EXECUTABLE, which in the near
future will be a known-to-work Python 3 executable. If it's not Python
3, then we don't have to run this test.

4 years ago[libcxx] Fix a typo in config.py
Sergej Jaskiewicz [Thu, 26 Dec 2019 09:31:12 +0000 (12:31 +0300)]
[libcxx] Fix a typo in config.py

Reviewers: ldionne, jroelofs, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[lldb][test] Don't include "test_common.h" in the debug macros test
Tatyana Krasnukha [Thu, 26 Dec 2019 15:21:30 +0000 (18:21 +0300)]
[lldb][test] Don't include "test_common.h" in the debug macros test

GCC produces incorrect .debug_macro section when "-include" option is used:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93075.

4 years ago[lldb] Specify unsigned underlying type for an enumeration explicitly
Tatyana Krasnukha [Thu, 26 Dec 2019 12:48:50 +0000 (15:48 +0300)]
[lldb] Specify unsigned underlying type for an enumeration explicitly

The enumeration EntryType is used as a bit field of DebugMacroEntry:
```
  EntryType m_type : 3
```

Since underlying type of enumeration is implementation-dependent, a signed integer is
converted to the 3-bit value by some compilers (MSVC).

That's why a DebugMacroEntry instance that was created with EntryType value > 3 (END_FILE or INDIRECT)
contains incorrect negative value in its m_type data-member.

4 years ago[lldb][NFC] Move lock scope where it should begin
Tatyana Krasnukha [Thu, 26 Dec 2019 12:31:14 +0000 (15:31 +0300)]
[lldb][NFC] Move lock scope where it should begin

4 years ago[lldb][NFC] Add "lldb-vscode" to all_categories
Tatyana Krasnukha [Wed, 11 Dec 2019 14:34:55 +0000 (17:34 +0300)]
[lldb][NFC] Add "lldb-vscode" to all_categories

Required to make the category manually disableable.

4 years ago[lldb][NFC] Simplify if-return
Tatyana Krasnukha [Wed, 11 Dec 2019 14:16:38 +0000 (17:16 +0300)]
[lldb][NFC] Simplify if-return

4 years ago[lldb][tests] Platform triple can be None
Tatyana Krasnukha [Tue, 10 Dec 2019 15:00:50 +0000 (18:00 +0300)]
[lldb][tests] Platform triple can be None

If a remote target is not connected, SBPlatform's GetTriple function returns None.

4 years ago[lldb][tests] Posix function strdup requires macro _POSIX_C_SOURCE
Tatyana Krasnukha [Fri, 29 Nov 2019 11:11:39 +0000 (14:11 +0300)]
[lldb][tests] Posix function strdup requires macro _POSIX_C_SOURCE

4 years ago[lldb][NFC] Use ClangASTContext in AppleObjCRuntime interfaces
Raphael Isemann [Thu, 26 Dec 2019 13:52:43 +0000 (14:52 +0100)]
[lldb][NFC] Use ClangASTContext in AppleObjCRuntime interfaces

This code actually needs a ClangASTContext but instead takes a
clang::ASTContext and then retrieves the original ClangASTContext
via the global map of ClangASTContexts. Let's change it so
that it takes a ClangASTContext which is simpler and faster.

4 years ago[compiler-rt] Disable QSORT interception on watchOS and tvOS.
Florian Hahn [Thu, 26 Dec 2019 09:37:08 +0000 (10:37 +0100)]
[compiler-rt] Disable QSORT interception on watchOS and tvOS.

Building the sanitizers for watchOS currently fails with
    sanitizer_common_interceptors.inc:9656:8: error: thread-local storage is not supported for the current target
    static THREADLOCAL SIZE_T qsort_size;

I've also speculatively disabled QSORT interception for tvOS to unblock
failing builds. I'll ask someone with more sanitizer knowledge to check
after the holidays.

4 years ago[lldb] Remove some calls to GetASTContext
Raphael Isemann [Wed, 25 Dec 2019 22:43:52 +0000 (23:43 +0100)]
[lldb] Remove some calls to GetASTContext

GetASTContext is really expensive to call as it makes use of the global
mapping from ASTContext to ClangASTContext. This replaces all calls where
we already have the ClangASTContext around and don't need to call
GetASTContext again.

4 years ago[clang][test] Minor fixes in testcase absolute-paths-symlinks.c
Karl-Johan Karlsson [Thu, 26 Dec 2019 08:30:08 +0000 (09:30 +0100)]
[clang][test] Minor fixes in testcase absolute-paths-symlinks.c

This is a follow up commit to address post-commit comment in D70527.

4 years agoFix the MLIR Vim syntax file: the keyword group was missing
chelxom [Fri, 20 Dec 2019 15:02:11 +0000 (23:02 +0800)]
Fix the MLIR Vim syntax file: the keyword group was missing

4 years ago[PowerPC] stop folding if result rlwinm mask is wrap while original rlwinm is not.
czhengsz [Thu, 26 Dec 2019 02:52:56 +0000 (21:52 -0500)]
[PowerPC] stop folding if result rlwinm mask is wrap while original rlwinm is not.

%1:g8rc = RLWINM8 %0:g8rc, 0, 16, 9
%2:g8rc = RLWINM8 killed %1:g8rc, 0, 0, 31
->
%2:g8rc = RLWINM8 %0:g8rc, 0, 16, 9

The above folding is wrong. Before transformation, %2:g8rc is 32 bit value. After
transformation, %2:g8rc becomes a 64 bit value.
This patch fixes above issue.

Reviewed by: steven.zhang

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

4 years ago[Bitstream] Delete skipAbbreviatedField which duplicates readAbbreviatedField
Fangrui Song [Thu, 26 Dec 2019 02:40:21 +0000 (18:40 -0800)]
[Bitstream] Delete skipAbbreviatedField which duplicates readAbbreviatedField

4 years ago[NFC][PowerPC] Add a function tryAndWithMask to handle all the cases
QingShan Zhang [Thu, 26 Dec 2019 02:48:30 +0000 (02:48 +0000)]
[NFC][PowerPC] Add a function tryAndWithMask to handle all the cases
that 'and' with constant

More patches will be committed later to exploit more about 'and' with
constant.

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

4 years ago[NFC][LoopFusion] Fix printing of the guard branch.
Whitney Tsang [Thu, 26 Dec 2019 00:03:55 +0000 (00:03 +0000)]
[NFC][LoopFusion] Fix printing of the guard branch.
Reviewer: kbarton, jdoerfert
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D71878

4 years ago[PowerPC] Modify the hasSideEffects of MTLR and MFLR from 1 to 0
Kang Zhang [Thu, 26 Dec 2019 02:12:32 +0000 (02:12 +0000)]
[PowerPC] Modify the hasSideEffects of MTLR and MFLR from 1 to 0

Summary:
If we didn't set the value for hasSideEffects bit in our td file, `llvm-tblgen`
will set it as true for those instructions which has no match pattern.
The instructions `MTLR` and `MFLR` don't set the hasSideEffects flag and don't
have match pattern, so their hasSideEffects flag will be set true by
`llvm-tblgen`.
But in fact, we can use `[LR]` to model the two instructions, so they should not
have SideEffects.

This patch is to modify the hasSideEffects of MTLR and MFLR from 1 to 0.

Reviewed By: jsji

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

4 years agoRevert "Make lazyload_metadata.ll resilient to the addition of new metadata kinds"
David Herzka [Thu, 26 Dec 2019 00:52:17 +0000 (19:52 -0500)]
Revert "Make lazyload_metadata.ll resilient to the addition of new metadata kinds"

This reverts commit 2e6c15d1e7a47f11fab2dd3a40fcff01906923ae.

It causes the test to fail on Windows

4 years ago[X86] Enable STRICT_SINT_TO_FP/STRICT_UINT_TO_FP on X86 backend
Wang, Pengfei [Tue, 24 Dec 2019 01:44:22 +0000 (09:44 +0800)]
[X86] Enable STRICT_SINT_TO_FP/STRICT_UINT_TO_FP on X86 backend

Summary: Enable STRICT_SINT_TO_FP/STRICT_UINT_TO_FP on X86 backend

Reviewers: craig.topper, RKSimon, LiuChen3, uweigand, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits, LuoYuanke

Tags: #llvm

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

4 years agoRevert "test commit"
David Herzka [Thu, 26 Dec 2019 00:11:31 +0000 (19:11 -0500)]
Revert "test commit"

This reverts commit cb6e84fe3682f934bb6c1c6b55c3afee4f684774.

4 years agotest commit
David Herzka [Thu, 26 Dec 2019 00:07:54 +0000 (19:07 -0500)]
test commit

4 years ago[OpenMP][IR-Builder] Introduce "pragma omp parallel" code generation
Johannes Doerfert [Wed, 25 Dec 2019 22:59:38 +0000 (16:59 -0600)]
[OpenMP][IR-Builder] Introduce "pragma omp parallel" code generation

This patch combines the `emitParallel` logic prototyped in D61953 with
the OpenMPIRBuilder (D69785) and introduces `CreateParallel`.

Reviewed By: fghanim

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

4 years agoMake lazyload_metadata.ll resilient to the addition of new metadata kinds
David Herzka [Thu, 19 Dec 2019 23:28:56 +0000 (18:28 -0500)]
Make lazyload_metadata.ll resilient to the addition of new metadata kinds

Summary: The specific number of records loaded depends on the number of kinds, but the difference between the lazy and not lazy cases does not.

Reviewers: modocache

Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[OpenMP][IR-Builder] Introduce the finalization stack
Johannes Doerfert [Wed, 25 Dec 2019 16:33:56 +0000 (10:33 -0600)]
[OpenMP][IR-Builder] Introduce the finalization stack

As a permanent and generic solution to the problem of variable
finalization (destructors, lastprivate, ...), this patch introduces the
finalization stack. The objects on the stack describe (1) the
(structured) regions the OpenMP-IR-Builder is currently constructing,
(2) if these are cancellable, and (3) the callback that will perform the
finalization (=cleanup) when necessary.

As the finalization can be necessary multiple times, at different source
locations, the callback takes the position at which code is currently
generated. This position will also encode the destination of the "region
exit" block *iff* the finalization call was issues for a region
generated by the OpenMPIRBuilder. For regions generated through the old
Clang OpenMP code geneneration, the "region exit" is determined by Clang
inside the finalization call instead (see getOMPCancelDestination).

As a first user, the parallel + cancel barrier interaction is changed.
In contrast to the temporary solution before, the barrier generation in
Clang does not need to be aware of the "CancelDestination" block.
Instead, the finalization callback is and, as described above, later
even that one does not need to be.

D70109 will be updated to use this scheme.

Reviewed By: ABataev

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

4 years ago[X86] Use zero vector to extend to 512-bits for strict_fp_to_uint v2i1->v2f64 on...
Craig Topper [Wed, 25 Dec 2019 18:40:40 +0000 (10:40 -0800)]
[X86] Use zero vector to extend to 512-bits for strict_fp_to_uint v2i1->v2f64 on targets with AVX512F, but not AVX512VL.

In the worst case, this requires a 128-bit move instruction to
implicitly zero the upper bits. In the common case, we should
recognize the producing instruction already zeroed the upper bits.

4 years ago[X86FixupSetCC] Remember the preceding eflags defining instruction while we're scanni...
Craig Topper [Wed, 25 Dec 2019 17:57:44 +0000 (09:57 -0800)]
[X86FixupSetCC] Remember the preceding eflags defining instruction while we're scanning the basic block instead of looking back for it.

Summary:
We're already scanning forward through the basic block. Might as
well just remember eflags defs instead of doing a bounded search
backwards later.

Based on a comment in D71841.

Reviewers: RKSimon, spatel, uweigand

Reviewed By: uweigand

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Use StringRef in ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize
Raphael Isemann [Wed, 25 Dec 2019 17:23:09 +0000 (18:23 +0100)]
[lldb][NFC] Use StringRef in ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize

4 years ago[X86] Merge together some common code in LowerFP_TO_INT now that we have STRICT_CVTTP...
Craig Topper [Wed, 25 Dec 2019 08:12:53 +0000 (00:12 -0800)]
[X86] Merge together some common code in LowerFP_TO_INT now that we have STRICT_CVTTP2SI/STRICT_CVTTP2UI nodes. NFC

4 years ago[llvm-nm] Display STT_GNU_IFUNC as 'i'
Fangrui Song [Sun, 22 Dec 2019 05:53:22 +0000 (21:53 -0800)]
[llvm-nm] Display STT_GNU_IFUNC as 'i'

Reviewed By: grimar

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

4 years ago[compiler-rt] [netbsd] Correct the fallback definition of PT_LWPNEXT
Kamil Rytarowski [Wed, 25 Dec 2019 17:18:12 +0000 (18:18 +0100)]
[compiler-rt] [netbsd] Correct the fallback definition of PT_LWPNEXT

Fixes build on NetBSD 9.0.

4 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler syntax description.
Dmitry Preobrazhensky [Wed, 25 Dec 2019 14:51:53 +0000 (17:51 +0300)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler syntax description.

Summary of changes:
- added description of GFX9 subtargets:
  - gfx900;
  - gfx902;
  - gfx904;
  - gfx906;
  - gfx908;
  - gfx909.

4 years ago[llvm-readobj] - Merge `gnu-symbols.test` to `symbols.test` and cleanup.
Georgii Rymar [Thu, 19 Dec 2019 11:01:23 +0000 (14:01 +0300)]
[llvm-readobj] - Merge `gnu-symbols.test` to `symbols.test` and cleanup.

This cleans up and merges `gnu-symbols.test` to `symbols.test`.
Initially `gnu-symbols.test` tested the following things:
1) How symbols are printed in GNU style.
   It does not make sense to have a separate file for such tests.
2) It tried to test proc-specific symbol indexes. The test was incomplete and
   also we already have `symbol-shndx.test` for that, so this part was removed.
3) It tested `--dyn-symbols` and `--symbols` correlation. All following
   cases were moved to `symbols.test`:
   a) That `--dyn-symbols` does not trigger showing regular symbols..
   b) That `--symbols` triggers `--dyn-symbols` implicitly.
   c) That `--dyn-symbols` and `--symbols` works fine together.

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

4 years ago[llvm-readobj/llvm-readelf][test] - Add testing for EI_OSABI and EI_ABIVERSION fields...
Georgii Rymar [Fri, 20 Dec 2019 11:40:32 +0000 (14:40 +0300)]
[llvm-readobj/llvm-readelf][test] - Add testing for EI_OSABI and EI_ABIVERSION fields of an ELF header.

We had no separate tests for these fields.

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

4 years agoAdd missing strict_fp_to_int
Liu, Chen3 [Wed, 25 Dec 2019 08:10:10 +0000 (16:10 +0800)]
Add missing strict_fp_to_int

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

4 years ago[MLIR][NFC] Insert const_cast to avoid warning
Hideto Ueno [Wed, 25 Dec 2019 05:50:56 +0000 (14:50 +0900)]
[MLIR][NFC] Insert const_cast to avoid warning

Reviewers: rriddle

Reviewed By: rriddle

Subscribers: mehdi_amini

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

4 years ago [Attributor] Reach optimistic fixpoint in AAValueSimplify when the value is constant...
Hideto Ueno [Wed, 25 Dec 2019 05:14:32 +0000 (14:14 +0900)]
 [Attributor] Reach optimistic fixpoint in AAValueSimplify when the value is constant or undef

Summary:
As discussed in D71799, we have found that it is more useful to reach an optimistic fixpoint in AAValueSimpify when the value is constant or undef.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: baziotis, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86FixupSetCC] Use MachineInstr::readRegister/definesRegister to check for EFLAGS...
Craig Topper [Wed, 25 Dec 2019 03:22:55 +0000 (19:22 -0800)]
[X86FixupSetCC] Use MachineInstr::readRegister/definesRegister to check for EFLAGS use/def instead of our own custom operand scan. NFCI

4 years ago[compiler-rt] [netbsd] Define _RTLD_SOURCE to fix build
Kamil Rytarowski [Wed, 25 Dec 2019 03:05:10 +0000 (04:05 +0100)]
[compiler-rt] [netbsd] Define _RTLD_SOURCE to fix build

The TLS base (LWP private pointer) functions are namespaced and
hidden i.e. inside the _RTLD_SOURCE namespace.

4 years ago[Attributor] UB Attribute now handles all instructions that access memory through...
Johannes Doerfert [Wed, 25 Dec 2019 01:25:08 +0000 (19:25 -0600)]
[Attributor] UB Attribute now handles all instructions that access memory through a pointer

Summary:
Follow-up on: https://reviews.llvm.org/D71435
We basically use `checkForAllInstructions` to loop through all the instructions in a function that access memory through a pointer: load, store, atomicrmw, atomiccmpxchg
Note that we can now use the `getPointerOperand()` that gets us the pointer operand for an instruction that belongs to the aforementioned set.

Question: This function returns `nullptr` if the instruction is `volatile`. Why?
Guess:  Because if it is volatile, we don't want to do any transformation to it.

Another subtle point is that I had to add AtomicRMW, AtomicCmpXchg to `initializeInformationCache()`. Following `checkAllInstructions()` path, that
seemed the most reasonable place to add it and correct the fact that these instructions were ignored (they were not in `OpcodeInstMap` etc.). Is that ok?

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert, sstefan1

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[Attributor] Function level undefined behavior attribute
Johannes Doerfert [Wed, 25 Dec 2019 00:48:50 +0000 (18:48 -0600)]
[Attributor] Function level undefined behavior attribute

_Eventually_, this attribute will be assigned to a function if it
contains undefined behavior. As a first small step, I tried to make it
loop through the load instructions in a function (eventually, the plan
is to check if a load instructions causes undefined behavior, because
e.g. dereferences a null pointer - Also eventually, this won't happen in
initialize() but in updateImpl()).

Patch By: Stefanos Baziotis (@baziotis)

Reviewed By: jdoerfert

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

4 years ago[MCJIT] Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"
Fangrui Song [Wed, 25 Dec 2019 01:10:32 +0000 (17:10 -0800)]
[MCJIT] Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"

4 years ago[WinEH] Delete addFnAttr("no-frame-pointer-elim") which seems no longer needed
Fangrui Song [Wed, 25 Dec 2019 00:30:37 +0000 (16:30 -0800)]
[WinEH] Delete addFnAttr("no-frame-pointer-elim") which seems no longer needed

It was added in rL238619.

Reviewed By: rnk

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

4 years ago[Thumb][test] Fix CodeGen/Thumb/PR17309.ll after llvmorg-10-init-16046-ga36ddf0aa9d
Fangrui Song [Wed, 25 Dec 2019 00:57:40 +0000 (16:57 -0800)]
[Thumb][test] Fix CodeGen/Thumb/PR17309.ll  after llvmorg-10-init-16046-ga36ddf0aa9d

All of

"no-frame-pointer-elim-non-leaf"
"no-frame-pointer-elim-non-leaf"="true"
"no-frame-pointer-elim-non-leaf"="false"

mean "frame-pointer"="non-leaf", which is quite counter-intuitive.
llvmorg-10-init-16046-ga36ddf0aa9d accidentally broke it.

This fixes the -DLLVM_ENABLE_EXPENSIVE_CHECKS=On test:

```
*** Bad machine code: Non-flag-setting Thumb1 mov is v6-only ***
- function:    pass_C
- basic block: %bb.0 entry (0x1fc9bf0)
- instruction: $r0 = tMOVr killed $r6, 14, $noreg
```

4 years ago[Support] Fix behavior of StringRef::count with overlapping occurrences, add tests
Johannes Doerfert [Tue, 24 Dec 2019 23:25:37 +0000 (17:25 -0600)]
[Support] Fix behavior of StringRef::count with overlapping occurrences, add tests

Summary:
Fix the behavior of StringRef::count(StringRef) to not count overlapping occurrences, as is stated in the documentation.
Fixes bug https://bugs.llvm.org/show_bug.cgi?id=44072

I added Krzysztof Parzyszek to review this change because a use of this function in HexagonInstrInfo::getInlineAsmLength might depend on the overlapping-behavior. I don't have enough domain knowledge to tell if this change could break anything there.

All other uses of this method in LLVM (besides the unit tests) only use single-character search strings. In those cases, search occurrences can not overlap anyway.

Patch by Benno (@Bensge)

Reviewed By: jdoerfert

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

4 years agoMigrate function attribute "no-frame-pointer-elim"="false" to "frame-pointer"="none...
Fangrui Song [Wed, 25 Dec 2019 00:11:33 +0000 (16:11 -0800)]
Migrate function attribute "no-frame-pointer-elim"="false" to "frame-pointer"="none" as cleanups after D56351

4 years agoMigrate function attribute "no-frame-pointer-elim-non-leaf" to "frame-pointer"="non...
Fangrui Song [Wed, 25 Dec 2019 00:02:47 +0000 (16:02 -0800)]
Migrate function attribute "no-frame-pointer-elim-non-leaf" to "frame-pointer"="non-leaf" as cleanups after D56351

4 years agoMigrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanu...
Fangrui Song [Tue, 24 Dec 2019 23:52:21 +0000 (15:52 -0800)]
Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351

4 years ago[OPENMP]Add extra checks and initialization for clause modifier.
Alexey Bataev [Tue, 24 Dec 2019 21:02:58 +0000 (16:02 -0500)]
[OPENMP]Add extra checks and initialization for clause modifier.

Added initialization of the extra modifier to silence sanitizer. Added
extra checks to avoid such trouble in future.

4 years agoAMDGPU/GlobalISel: Fix mapping and selection of llvm.amdgcn.div.fixup
Matt Arsenault [Fri, 20 Dec 2019 15:52:03 +0000 (21:22 +0530)]
AMDGPU/GlobalISel: Fix mapping and selection of llvm.amdgcn.div.fixup

4 years ago[lldb] Adapt for NetBSD-9.99.30 ptrace(2) API changes
Kamil Rytarowski [Tue, 24 Dec 2019 19:36:23 +0000 (20:36 +0100)]
[lldb] Adapt for NetBSD-9.99.30 ptrace(2) API changes

Switch from PT_LWPINFO to PT_LWPSTATUS/PT_LWPNEXT.

Keep compat support for < 9.99.30.

No functional change intended.

4 years ago[compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30
Kamil Rytarowski [Tue, 24 Dec 2019 19:34:58 +0000 (20:34 +0100)]
[compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30

Enable compat support for now legacy PT_LWPINFO.
Support PT_LWPSTATUS and PT_LWPNEXT.

4 years ago[compiler-rt] Adapt stop-the-world for ptrace changes in NetBSD-9.99.30
Kamil Rytarowski [Tue, 24 Dec 2019 19:33:54 +0000 (20:33 +0100)]
[compiler-rt] Adapt stop-the-world for ptrace changes in NetBSD-9.99.30

Handle PT_LWPNEXT for newer kernels and keep PT_LWPINFO for older ones.

4 years ago[X86] Use 128-bit vector instructions for f32/f64->i64 conversions on 32-bit targets...
Craig Topper [Tue, 24 Dec 2019 19:08:06 +0000 (11:08 -0800)]
[X86] Use 128-bit vector instructions for f32/f64->i64 conversions on 32-bit targets with avx512dq and avx512vl instructions.

On 32-bit targets we can't use the scalar instruction so we
insert the scalar into a vector and use packed conversions.
Previously we used either v4f32->v4i64 or v4f64->v4i64 to avoid
some complexity creating target specific ISD opcodes for
v4f32->v2i64. But this causes extra vzeroupper instructions and
possibly frequency throttling on Intel CPUs.

This patch changes this to create a 128-bit vector and uses a
target specific ISD opcode if needed.

4 years ago[mlir] Fix -Wunneeded-internal-declaration
Fangrui Song [Tue, 24 Dec 2019 18:29:49 +0000 (10:29 -0800)]
[mlir] Fix -Wunneeded-internal-declaration

4 years agotest: ensure that we dead-strip in the linker
Saleem Abdulrasool [Tue, 24 Dec 2019 18:18:13 +0000 (10:18 -0800)]
test: ensure that we dead-strip in the linker

`/OPT:REF` is needed for link to dead strip functions, `/Gy` by itself
is not sufficient.

4 years ago[X86] Add STRICT versions of CVTTP2SI, CVTTP2UI, CMPM, and CMPP.
Craig Topper [Tue, 24 Dec 2019 18:07:04 +0000 (10:07 -0800)]
[X86] Add STRICT versions of CVTTP2SI, CVTTP2UI, CMPM, and CMPP.

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

4 years ago[OPENMP][DOCS]Update status of OpenMP 5.0 features, NFC.
Alexey Bataev [Tue, 24 Dec 2019 17:39:59 +0000 (12:39 -0500)]
[OPENMP][DOCS]Update status of OpenMP 5.0 features, NFC.

4 years ago[OPENMP50]Basic support for conditional lastprivate.
Alexey Bataev [Fri, 20 Dec 2019 16:04:57 +0000 (11:04 -0500)]
[OPENMP50]Basic support for conditional lastprivate.

Added parsing/sema checks for conditional lastprivates.

4 years agoGlobalISel: Update syntax in debug printing
Matt Arsenault [Sat, 21 Dec 2019 20:20:46 +0000 (15:20 -0500)]
GlobalISel: Update syntax in debug printing

Physical register names now start with $, not %

4 years agoGlobalISel: Define equivalent node for G_INTRINSIC_ROUND
Matt Arsenault [Tue, 24 Dec 2019 00:57:28 +0000 (19:57 -0500)]
GlobalISel: Define equivalent node for G_INTRINSIC_ROUND

4 years agoGlobalISel: Fix naming variables "brank" instead of "bank"
Matt Arsenault [Sun, 22 Dec 2019 18:46:40 +0000 (13:46 -0500)]
GlobalISel: Fix naming variables "brank" instead of "bank"

4 years ago[lldb][NFC] Move ClangASTContext::m_scratch_ast_source_up to the appropriate class
Raphael Isemann [Tue, 24 Dec 2019 08:31:45 +0000 (09:31 +0100)]
[lldb][NFC] Move ClangASTContext::m_scratch_ast_source_up to the appropriate class

m_scratch_ast_source_up is only used by ClangASTContextForExpressions so it
should also be declared only in that class. Also make all other members of
ClangASTContext private and move the initialization code for ClangASTContextForExpressions
into the constructor.

4 years agoFix readability-const-return-type identifying the wrong `const` token
Ilya Mirsky [Tue, 24 Dec 2019 15:10:01 +0000 (10:10 -0500)]
Fix readability-const-return-type identifying the wrong `const` token

Replace tidy::utils::lexer::getConstQualifyingToken with a corrected and also
generalized to other qualifiers variant - getQualifyingToken.

Fixes PR44326

4 years agoFix false positive in magic number checker.
Florin Iucha [Tue, 24 Dec 2019 15:03:00 +0000 (10:03 -0500)]
Fix false positive in magic number checker.

cppcoreguidelines-avoid-magic-numbers should not warn about enum class.
Fixes PR40640.

4 years agoAMDGPU/GlobalISel: Legalize some 16-bit round instructions
Matt Arsenault [Tue, 24 Dec 2019 00:42:53 +0000 (19:42 -0500)]
AMDGPU/GlobalISel: Legalize some 16-bit round instructions

4 years agoGlobalISel: Define equivalent node for G_INTRINSIC_TRUNC
Matt Arsenault [Tue, 24 Dec 2019 00:30:53 +0000 (19:30 -0500)]
GlobalISel: Define equivalent node for G_INTRINSIC_TRUNC

4 years agoAMDGPU/GlobalISel: Lower llvm.amdgcn.else
Matt Arsenault [Fri, 20 Dec 2019 18:35:18 +0000 (00:05 +0530)]
AMDGPU/GlobalISel: Lower llvm.amdgcn.else

4 years ago[NFC] Remove some dead code from CGBuiltin.cpp.
Kevin P. Neal [Tue, 24 Dec 2019 14:38:34 +0000 (09:38 -0500)]
[NFC] Remove some dead code from CGBuiltin.cpp.

4 years agoVariableName doc: fix the link to the mozilla doc
Sylvestre Ledru [Tue, 24 Dec 2019 12:38:59 +0000 (13:38 +0100)]
VariableName doc: fix the link to the mozilla doc

4 years agomlir README.md: Fix the syntax
Sylvestre Ledru [Tue, 24 Dec 2019 12:31:07 +0000 (13:31 +0100)]
mlir README.md: Fix the syntax

4 years ago[lldb][NFC] Remove ClangExternalASTSourceCommon
Raphael Isemann [Mon, 23 Dec 2019 19:42:25 +0000 (20:42 +0100)]
[lldb][NFC] Remove ClangExternalASTSourceCommon

ClangExternalASTSourceCommon's purpose is to store a map from
Decl*/Type* to ClangASTMetadata. Usually this data is accessed
via the ClangASTContext interface which then grabs the
current ExternalASTSource of its ASTContext, tries to cast it
to ClangExternalASTSourceCommon and then accesses the metadata
map. If the casting fails the setter does nothing and the getter
returns a nullptr as if there was no known metadata for a type/decl.

This system breaks as soon as any non-LLDB ExternalASTSource is added via
a multiplexer to our existing ExternalASTSource (in which case we suddenly
loose all out metadata as the casting always fails with an ExternalASTSource
that is not inheriting from ClangExternalASTSourceCommon).

This patch moves the metadata map to the ClangASTContext. This gets
rid of all the fragile casting, the requirement that every ExternalASTSource in
LLDB has to inherit from ClangExternalASTSourceCommon and simplifies
the metadata implementation to a simple map lookup. As ClangExternalASTSourceCommon
had no other purpose than storing metadata, this patch deletes this class
and replaces all uses with clang::ExternalASTSource.

No other code changes in this commit beside the AppleObjCDeclVendor which
was the only code that did not use the ClangASTContext interface but directly
accessed the ClangExternalASTSourceCommon.

4 years agodoc: Document that extra-arg/extra-arg-before can be used several times
Sylvestre Ledru [Tue, 24 Dec 2019 12:06:24 +0000 (13:06 +0100)]
doc: Document that extra-arg/extra-arg-before can be used several times

Hopefully, it will help other people

4 years agoclang-doc remove trailing whitespaces
Sylvestre Ledru [Tue, 24 Dec 2019 12:03:45 +0000 (13:03 +0100)]
clang-doc remove trailing whitespaces

4 years agoRevert "[Support] Extend TimeProfiler to support multiple threads"
Russell Gallop [Tue, 24 Dec 2019 11:31:48 +0000 (11:31 +0000)]
Revert "[Support] Extend TimeProfiler to support multiple threads"

and "[Support] Try to fix bot failure after 8ddcd1dc26"

This reverts commits f70f180148 and 8ddcd1dc26 as this was breaking the
MacOS build, which doesn't support thread_local.

4 years ago[clang] [ast] CXXRecordDecl::getVisibleConversionFunctions() could be const
Whisperity [Tue, 24 Dec 2019 10:09:24 +0000 (11:09 +0100)]
[clang] [ast] CXXRecordDecl::getVisibleConversionFunctions() could be const

The function and its called static helpers don't modify the received
CXXRecordDecl arguments at all as the method's result is put into an
output parameter. Thus they can be const which allows for neatly
grabbing the conversion methods in a context where we only have a const
ASTUnit at hand.

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

4 years ago[TypePromotion] Make TypeSize a class member
Sam Parker [Tue, 24 Dec 2019 09:44:41 +0000 (04:44 -0500)]
[TypePromotion] Make TypeSize a class member

Having TypeSize as a static class variable was causing problems
with multi-threading. Several static functions have now been
converted into methods of TypePromotion and a few other members
of TypePromotion and IRPromoter have been added or removed.

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

4 years agoDebugInfo: Correct the form of DW_AT_macro_info in .dwo files (sec_offset, rather...
David Blaikie [Tue, 24 Dec 2019 09:23:21 +0000 (01:23 -0800)]
DebugInfo: Correct the form of DW_AT_macro_info in .dwo files (sec_offset, rather than data4)

4 years agoDebugInfo: Add {} to address -Wdangling-else warning.
David Blaikie [Tue, 24 Dec 2019 09:14:15 +0000 (01:14 -0800)]
DebugInfo: Add {} to address -Wdangling-else warning.

4 years agoAdd the Apache2 with LLVM exceptions license to MLIR
Mehdi Amini [Tue, 24 Dec 2019 08:57:16 +0000 (00:57 -0800)]
Add the Apache2 with LLVM exceptions license to MLIR

It seems that every subproject has a license file instead of having a top-level one.

4 years ago[llvm-readobj] - Remove an excessive helper for printing dynamic tags.
Georgii Rymar [Mon, 23 Dec 2019 11:54:36 +0000 (14:54 +0300)]
[llvm-readobj] - Remove an excessive helper for printing dynamic tags.

This removes the `getTypeString` from readeobj source because it
almost duplicates the existent method: `ELFFile<ELFT>::getDynamicTagAsString`.

Side effect: now it prints "<unknown:>0xHEXVALUE" instead of "(unknown)" for unknown values.
llvm-readelf before this patch printed:

```
0x0000000012345678 (unknown) 0x8765432187654321
0x000000006abcdef0 (unknown) 0x9988776655443322
0x0000000076543210 (unknown) 0x5555666677778888
```

and now it prints:

```
0x0000000012345678 (<unknown:>0x12345678) 0x8765432187654321
0x000000006abcdef0 (<unknown:>0x6abcdef0) 0x9988776655443322
0x0000000076543210 (<unknown:>0x76543210) 0x5555666677778888
```

GNU reaedlf prints different thing:

```
0x0000000012345678 (<unknown>: 12345678) 0x8765432187654321
0x000000006abcdef0 (Operating System specific: 6abcdef0) 0x9988776655443322
0x0000000076543210 (Processor Specific: 76543210) 0x5555666677778888
```

I am not sure we want to follow GNU here. Even if we do, it should be separate
patch probably. The new output looks better and closer to GNU anyways,
and the code is a bit simpler.

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

4 years agoRemove static MLIR doc ; they are already on the website
Mehdi Amini [Tue, 24 Dec 2019 08:53:10 +0000 (00:53 -0800)]
Remove static MLIR doc ; they are already on the website

4 years ago[docs] fix typo in Lexicon.rst
Alex Zinenko [Mon, 23 Dec 2019 17:20:25 +0000 (18:20 +0100)]
[docs] fix typo in Lexicon.rst

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