platform/upstream/llvm.git
4 years ago[MachineDebugify] Insert synthetic DBG_VALUE instructions
Vedant Kumar [Mon, 13 Apr 2020 23:15:37 +0000 (16:15 -0700)]
[MachineDebugify] Insert synthetic DBG_VALUE instructions

Summary:
Teach MachineDebugify how to insert DBG_VALUE instructions.  This can
help find bugs causing CodeGen differences when debug info is present.
DBG_VALUE instructions are only emitted when -debugify-level is set to
locations+variables.

There is essentially no attempt made to match up DBG_VALUE register
operands with the local variables they ought to correspond to. I'm not
sure how to improve the situation. In some cases (MachineMemOperand?)
it's possible to find the IR instruction a MachineInstr corresponds to,
but in general this seems to call for "undoing" the work done by ISel.

Reviewers: dsanders, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Target] Avoid race between Communication::Disconnect calls.
Jonas Devlieghere [Wed, 22 Apr 2020 23:51:56 +0000 (16:51 -0700)]
[lldb/Target] Avoid race between Communication::Disconnect calls.

Avoid a race between the Disconnect call in `Communication::ReadThread`
and the one in `Process::ShouldBroadcastEvent` by reordering the calls
to Disconnect and StopReadThread in `Process::ShouldBroadcastEvent`.

In D77295 Pavel suggested that that might explain the broken pipe I was
seeing. Indeed, changing the order resolved the issue.

4 years agoRevert "get rid of PythonInteger::GetInteger()"
Muhammad Omair Javaid [Wed, 22 Apr 2020 23:35:30 +0000 (04:35 +0500)]
Revert "get rid of PythonInteger::GetInteger()"

This reverts commit 7375212172951d2fc283c81d03c1a8588c3280c6.

This causes multiple test failures on LLDB AArch64 Linux buildbot.
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/3695

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

4 years agoAdd a policy to enable computing SchedDFSResult.
Mark Lacey [Mon, 30 Mar 2020 19:52:14 +0000 (12:52 -0700)]
Add a policy to enable computing SchedDFSResult.

Summary:
Make GenericScheduler compute SchedDFSResult on initialization if
the policy is set. This makes it possible to create classes
that extend GenericScheduler and rely on the results of SchedDFSResult,
e.g. to perform subtree scheduling.

NFC unless the policy is set.

Subscribers: MatzeB, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years ago[ValueTracking] Let analyses assume a value cannot be partially poison
Juneyoung Lee [Wed, 22 Apr 2020 23:08:16 +0000 (08:08 +0900)]
[ValueTracking] Let analyses assume a value cannot be partially poison

Summary:
This is RFC for fixes in poison-related functions of ValueTracking.
These functions assume that a value can be poison bitwisely, but the semantics
of bitwise poison is not clear at the moment.
Allowing a value to have bitwise poison adds complexity to reasoning about
correctness of optimizations.

This patch makes the analysis functions simply assume that a value is
either fully poison or not, which has been used to understand the correctness
of a few previous optimizations.
The bitwise poison semantics seems to be only used by these functions as well.

In terms of implementation, using value-wise poison concept makes existing
functions do more precise analysis, which is what this patch contains.

Reviewers: spatel, lebedev.ri, jdoerfert, reames, nikic, nlopes, regehr

Reviewed By: nikic

Subscribers: fhahn, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-objcopy][MachO] Add missing license header
Alexander Shaposhnikov [Wed, 22 Apr 2020 23:05:07 +0000 (16:05 -0700)]
[llvm-objcopy][MachO] Add missing license header

Add missing license header to Object.cpp.
NFC.

4 years agoRevert "RFC: [ValueTracking] Let analyses assume a value cannot be partially poison"
Juneyoung Lee [Wed, 22 Apr 2020 23:06:53 +0000 (08:06 +0900)]
Revert "RFC: [ValueTracking] Let analyses assume a value cannot be partially poison"

This reverts commit 80faa8c3af856df93faf909f21cdcc397bed068f.

4 years agoRFC: [ValueTracking] Let analyses assume a value cannot be partially poison
Juneyoung Lee [Mon, 20 Apr 2020 15:35:45 +0000 (00:35 +0900)]
RFC: [ValueTracking] Let analyses assume a value cannot be partially poison

Summary:
This is RFC for fixes in poison-related functions of ValueTracking.
These functions assume that a value can be poison bitwisely, but the semantics
of bitwise poison is not clear at the moment.
Allowing a value to have bitwise poison adds complexity to reasoning about
correctness of optimizations.

This patch makes the analysis functions simply assume that a value is
either fully poison or not, which has been used to understand the correctness
of a few previous optimizations.
The bitwise poison semantics seems to be only used by these functions as well.

In terms of implementation, using value-wise poison concept makes existing
functions do more precise analysis, which is what this patch contains.

Reviewers: spatel, lebedev.ri, jdoerfert, reames, nikic, nlopes, regehr

Reviewed By: nikic

Subscribers: fhahn, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-objcopy][MachO] Fix n_sect field
Alexander Shaposhnikov [Wed, 22 Apr 2020 22:37:17 +0000 (15:37 -0700)]
[llvm-objcopy][MachO] Fix n_sect field

This tiny change is a follow-up to the previous commit f34fdbcf996a
where the update of n_sect was missing.

Test plan: make check-all

4 years ago[CMAKE] Provide default location for llvm-lit for out-of-tree users.
Stephen Neuendorffer [Mon, 30 Mar 2020 22:32:01 +0000 (15:32 -0700)]
[CMAKE] Provide default location for llvm-lit for out-of-tree users.

Several external build users contain some heuristics for finding llvm-lit.
There are several cases we need to worry about:
- External builds against a build tree (with LLVM_BUILD_UTILS)
- External builds against an install tree (with LLMV_BUILD_UTIL
  and LLVM_INSTALL_UTILS)
- External builds against some location which doesn't have an
  llvm-lit, but llvm-lit is available through some other means, such
  as an available source tree, or a packager provided llvm-lit.

For the third case, LLVM_EXTERNAL_LIT suffices, but in other cases
there's no standard way to find llvm-lit.  It seems like each user
cooks their own heuristics:

- clang tries to look in the LLVM source tree, and failing that falls
  back to looking for a packaged llvm-lit.
- libcxx tries to look in the LLVM source tree, which might come from
  llvm-config or be explicitly specified.

This patch is a first stop to solving this by providing a default location
for llvm-lit using LLVM_DEFAULT_EXTERNAL_LIT.  The expectation is that
future patches can clean up users like clang and libcxx to rely
on this mechanism for out-of-tree builds.

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

4 years ago[TimeProfiler] Emit clock synchronization point
Sergej Jaskiewicz [Thu, 16 Apr 2020 14:37:25 +0000 (17:37 +0300)]
[TimeProfiler] Emit clock synchronization point

Time profiler emits relative timestamps for events (the number of
microseconds passed since the start of the current process).

This patch allows combining events from different processes while
preserving their relative timing by emitting a new attribute
"beginningOfTime". This attribute contains the system time that
corresponds to the zero timestamp of the time profiler.

This has at least two use cases:

- Build systems can use this to merge time traces from multiple compiler
  invocations and generate statistics for the whole build. Tools like
  ClangBuildAnalyzer could also leverage this feature.

- Compilers that use LLVM as their backend by invoking llc/opt in
  a child process. If such a compiler supports generating time traces
  of its own events, it could merge those events with LLVM-specific
  events received from llc/opt, and produce a more complete time trace.

A proof-of-concept script that merges multiple logs that
contain a synchronization point into one log:
https://github.com/broadwaylamb/merge_trace_events

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

4 years ago[libc++] Make sure we assume merged typeinfo names on Apple
Louis Dionne [Wed, 22 Apr 2020 21:16:47 +0000 (17:16 -0400)]
[libc++] Make sure we assume merged typeinfo names on Apple

The introduction of LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT changed
the default from =1 (assuming merged typeinfos) to =0 (not assuming
merged typeinfos) on all platforms where at least one other __config_site
macro is defined.

This commit explicitly enables the assumption of merged typeinfo names
on Apple platform to restore the previous behavior, at least until the
underlying issue has been fixed.

4 years ago[llvm-objcopy][MachO] Make --remove-section clean up dead symbols
Alexander Shaposhnikov [Wed, 22 Apr 2020 21:26:28 +0000 (14:26 -0700)]
[llvm-objcopy][MachO] Make --remove-section clean up dead symbols

Make --remove-section clean up dead symbols, return an Error if it can't be safely done.

Test plan: make check-all

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

4 years ago[MachineOutliner] Teach outliner to set live-ins
Eli Friedman [Wed, 22 Apr 2020 00:40:41 +0000 (17:40 -0700)]
[MachineOutliner] Teach outliner to set live-ins

Preserving liveness can be useful even late in the pipeline, if we're
doing substantial optimization work afterwards. (See, for example,
D76065.) Teach MachineOutliner how to correctly set live-ins on the
basic block in outlined functions.

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

4 years ago[JITLink] Fix edge removal iterator invalidation.
Lang Hames [Wed, 22 Apr 2020 17:18:44 +0000 (10:18 -0700)]
[JITLink] Fix edge removal iterator invalidation.

This patch changes Block::removeEdge to return a valid iterator to the new next
element, and uses this to update the edge removal algorithm in
LinkGraph::splitBlock.

4 years ago[JITLink] Read MachO Header CPU field only in jitLink_MachO.
Lang Hames [Tue, 21 Apr 2020 23:50:19 +0000 (16:50 -0700)]
[JITLink] Read MachO Header CPU field only in jitLink_MachO.

It's the only field we need in this function.

4 years ago[TimeProfiler] Emit real process ID and thread names
Sergej Jaskiewicz [Thu, 16 Apr 2020 13:31:00 +0000 (16:31 +0300)]
[TimeProfiler] Emit real process ID and thread names

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

4 years ago[SCCP] Drop unnecessary early exit for ExtractValueInst.
Florian Hahn [Wed, 22 Apr 2020 21:00:51 +0000 (22:00 +0100)]
[SCCP] Drop unnecessary early exit for ExtractValueInst.

visitExtractValueInst uses mergeInValue, so it already can handle
constant ranges. Initially the early exit was using isOverdefined to
keep things as NFC during the initial move to ValueLatticeElement.
As the function already supports constant ranges, it can just use
ValueState[&I].isOverdefined.

Reviewers: efriedma, mssimpso, davide

Reviewed By: efriedma

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

4 years ago[SveEmitter] Add builtins for svwhilerw/svwhilewr
Sander de Smalen [Wed, 22 Apr 2020 20:49:18 +0000 (21:49 +0100)]
[SveEmitter] Add builtins for svwhilerw/svwhilewr

This also adds the IsOverloadWhileRW flag which tells CGBuiltin to use
the result predicate type and the first pointer type as the
overloaded types for the LLVM IR intrinsic.

Reviewers: SjoerdMeijer, efriedma

Reviewed By: efriedma

Tags: #clang

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

4 years ago[SveEmitter] Add builtins for svwhile
Sander de Smalen [Wed, 22 Apr 2020 15:45:52 +0000 (16:45 +0100)]
[SveEmitter] Add builtins for svwhile

This also adds the IsOverloadWhile flag which tells CGBuiltin to use
both the default type (predicate) and the type of the second operand
(scalar) as the overloaded types for the LLMV IR intrinsic.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years agoPR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers
Aaron Puchert [Wed, 22 Apr 2020 18:05:36 +0000 (20:05 +0200)]
PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers

Summary:
We extend the behavior for local functions and methods of local classes
to lambdas in variable initializers. The initializer is not a separate
scope, but we treat it as such.

We also remove the (faulty) instantiation of default arguments in
TreeTransform::TransformLambdaExpr, because it doesn't do proper
initialization, and if it did, we would do it twice (and thus also emit
eventual errors twice).

Reviewed By: rsmith

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

4 years ago[libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc...
Louis Dionne [Wed, 22 Apr 2020 20:17:58 +0000 (16:17 -0400)]
[libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc++abi

Instead of the ad-hoc #define _LIBCXX_DYNAMIC_FALLBACK, provide an option
to enable the setting when building libc++abi. Also use the occasion to
rename the option to something slightly more descriptive.

Note that in the future, it would be great to simply remove this option
altogether. However, in the meantime, it seems better to have it be an
official option than something ad-hoc.

4 years ago[PowerPC][Future] Initial support for PCRel addressing to get block address
Victor Huang [Wed, 22 Apr 2020 20:01:29 +0000 (15:01 -0500)]
[PowerPC][Future] Initial support for PCRel addressing to get block address

Add initial support for PCRelative addressing to get block address
instead of using TOC.

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

4 years ago[docs] Fix :option: links
Jon Roelofs [Wed, 22 Apr 2020 19:59:57 +0000 (13:59 -0600)]
[docs] Fix :option: links

4 years ago[libc++abi] NFC: Use "" instead of <> to include __cxxabi_config.h
Louis Dionne [Wed, 22 Apr 2020 19:52:26 +0000 (15:52 -0400)]
[libc++abi] NFC: Use "" instead of <> to include __cxxabi_config.h

This is more consistent with how __cxxabi_config.h is included in other
files in libcxxabi/src.

4 years ago[builtins] Add void prototype to unprototyped functions
Ayke van Laethem [Wed, 22 Apr 2020 14:41:23 +0000 (16:41 +0200)]
[builtins] Add void prototype to unprototyped functions

This patch replaces () prototypes with (void) prototypes.

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

4 years ago[ELF] For relative paths in INPUT() and GROUP(), search the directory of the current...
Fangrui Song [Thu, 9 Apr 2020 04:45:21 +0000 (21:45 -0700)]
[ELF] For relative paths in INPUT() and GROUP(), search the directory of the current linker script before searching other paths

For a relative path in INPUT() or GROUP(), this patch changes the search order by adding the directory of the current linker script.
The new search order (consistent with GNU ld >= 2.35 regarding the new test `test/ELF/input-relative.s`):

1. the directory of the current linker script (GNU ld from Binutils 2.35 onwards; https://sourceware.org/bugzilla/show_bug.cgi?id=25806)
2. the current working directory
3. library paths (-L)

This behavior makes it convenient to replace a .so or .a with a linker script with additional input. For example, glibc

```
% cat /usr/lib/x86_64-linux-gnu/libm.a
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /usr/lib/x86_64-linux-gnu/libm-2.29.a /usr/lib/x86_64-linux-gnu/libmvec.a )
```

could be simplified as `GROUP(libm-2.29.a libmvec.a)`.

Another example is to make libc++.a a linker script:
```
INPUT(libc++.a.1 libc++abi.a)
```

Note, -l is not affected.

Reviewed By: psmith

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

4 years ago[libc++] Don't try to include <Block.h> when not available
Louis Dionne [Wed, 22 Apr 2020 19:22:03 +0000 (15:22 -0400)]
[libc++] Don't try to include <Block.h> when not available

4 years ago[CallSite removal][ValueTracking] Use CallBase instead of ImmutableCallSite for getIn...
Craig Topper [Wed, 22 Apr 2020 17:48:09 +0000 (10:48 -0700)]
[CallSite removal][ValueTracking] Use CallBase instead of ImmutableCallSite for getIntrinsicForCallSite. NFC

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

4 years ago[clang] Make sure argument expansion locations are correct in presence of predefined...
Kadir Cetinkaya [Wed, 22 Apr 2020 14:37:27 +0000 (16:37 +0200)]
[clang] Make sure argument expansion locations are correct in presence of predefined buffer

Summary:
Macro argument expansion logic relies on skipping file IDs that created
as a result of an include. Unfortunately it fails to do that for
predefined buffer since it doesn't have a valid insertion location.

As a result of that any file ID created for an include inside the
predefined buffers breaks the traversal logic in
SourceManager::computeMacroArgsCache.

To fix this issue we first record number of created FIDs for predefined
buffer, and then skip them explicitly in source manager.

Another solution would be to just give predefined buffers a valid source
location, but it is unclear where that should be..

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[clangd] Fix a crash for accessing a null template decl returned by findExplicitRefer...
Haojian Wu [Wed, 22 Apr 2020 11:33:02 +0000 (13:33 +0200)]
[clangd] Fix a crash for accessing a null template decl returned by findExplicitReferences.

Summary: Fixes https://github.com/clangd/clangd/issues/347.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[llvm][MIRVRegNamer] Avoid collisions across jump table indices.
Puyan Lotfi [Sun, 12 Apr 2020 05:09:08 +0000 (22:09 -0700)]
[llvm][MIRVRegNamer] Avoid collisions across jump table indices.

Hash Jump Table Indices uniquely within a basic block for MIR
Canonicalizer / MIR VReg Renamer passes.

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

4 years ago[libc++] Add support for blocks in std::function
Louis Dionne [Wed, 22 Apr 2020 17:58:17 +0000 (13:58 -0400)]
[libc++] Add support for blocks in std::function

rdar://14390808

4 years ago[docs] Document lit's --timeout=N flag
Jon Roelofs [Wed, 22 Apr 2020 18:56:22 +0000 (12:56 -0600)]
[docs] Document lit's --timeout=N flag

4 years ago[ObjectYAML][MachO] Add support for relocations
Alexander Shaposhnikov [Wed, 22 Apr 2020 18:50:55 +0000 (11:50 -0700)]
[ObjectYAML][MachO] Add support for relocations

Add support for relocations for MachO to ObjectYAML / yaml2obj / obj2yaml.

Test plan: make check-all

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

4 years agoRename warning identifiers from cxx2a to cxx20; NFC.
Aaron Ballman [Wed, 22 Apr 2020 18:28:15 +0000 (14:28 -0400)]
Rename warning identifiers from cxx2a to cxx20; NFC.

4 years ago[libc++] Update the cache for building libc++/libc++abi on Apple
Louis Dionne [Wed, 22 Apr 2020 17:54:36 +0000 (13:54 -0400)]
[libc++] Update the cache for building libc++/libc++abi on Apple

4 years ago[clangd] go-to-def on names in comments etc that are used nearby.
Sam McCall [Mon, 2 Mar 2020 21:45:25 +0000 (22:45 +0100)]
[clangd] go-to-def on names in comments etc that are used nearby.

Summary:
This is intended as a companion to (and is inspired by) D72874 which attempts to
resolve these cases using the index.
The intent is we'd try this strategy after the AST-based approach but before the
index-based (I think local usages would be more reliable than index matches).

Reviewers: nridge

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

Tags: #clang

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

4 years agoscudo: Change the macro used to check whether we're targeting the platform.
Peter Collingbourne [Tue, 21 Apr 2020 22:30:50 +0000 (15:30 -0700)]
scudo: Change the macro used to check whether we're targeting the platform.

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

4 years ago[Lanai] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 15:36:02 +0000 (16:36 +0100)]
[Lanai] Remove unused forward declarations. NFC.

4 years ago[Hexagon] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 15:35:19 +0000 (16:35 +0100)]
[Hexagon] Remove unused forward declarations. NFC.

4 years ago[AVR] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 14:53:06 +0000 (15:53 +0100)]
[AVR] Remove unused forward declarations. NFC.

4 years agoBPFMCTargetDesc.h - remove unused raw_ostream forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 14:52:19 +0000 (15:52 +0100)]
BPFMCTargetDesc.h - remove unused raw_ostream forward declaration. NFC.

4 years ago[Docs] Fixed formatting in release notes, NFC
Mikhail Maltsev [Wed, 22 Apr 2020 17:25:22 +0000 (18:25 +0100)]
[Docs] Fixed formatting in release notes, NFC

4 years ago[ARM] Replace arm vendor with none. NFC
David Green [Wed, 22 Apr 2020 15:33:11 +0000 (16:33 +0100)]
[ARM] Replace arm vendor with none. NFC

4 years ago[PowerPC][Future] Remove redundant r2 save and restore for indirect call
Victor Huang [Wed, 22 Apr 2020 15:55:34 +0000 (10:55 -0500)]
[PowerPC][Future] Remove redundant r2 save and restore for indirect call

Currently an indirect call produces the following sequence on PCRelative mode:

extern void function( );
extern void (*ptrfunc) ( );

void g() {
    ptrfunc=function;
}

void f() {
    (*ptrfunc) ( );
}

Producing

paddi 3, 0, .LC0@PCREL, 1
ld 3, 0(3)
std 2, 24(1)
ld 12, 0(3)
mtctr 12
bctrl
ld 2, 24(1)

Though the caller does not use or preserve r2, it is still saved and restored
across a function call. This patch is added to remove these redundant save and
restores for indirect calls.

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

4 years agoUpdate go bindings for 2dea3f129878e929e5d1f00b91a622eb1ec8be4e
Benjamin Kramer [Wed, 22 Apr 2020 17:02:01 +0000 (19:02 +0200)]
Update go bindings for 2dea3f129878e929e5d1f00b91a622eb1ec8be4e

4 years ago[Hexagon] Silence warning
Benjamin Kramer [Wed, 22 Apr 2020 16:57:08 +0000 (18:57 +0200)]
[Hexagon] Silence warning

llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp:296:11: warning: enumeration value 'ScalableVectorTyID' not handled in switch [-Wswitch]
  switch (Ty->getTypeID()) {
          ^

4 years ago[mlir][vulkan-runner] Add support for integer types.
Denis Khalikov [Mon, 20 Apr 2020 20:31:24 +0000 (23:31 +0300)]
[mlir][vulkan-runner] Add support for integer types.

Summary:
Add support for memrefs with element type as integer type
and simple test.

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

4 years ago[lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool
Jonas Devlieghere [Wed, 22 Apr 2020 15:48:31 +0000 (08:48 -0700)]
[lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool

Remove LLDB's TaskPool and replace its uses with LLVM's ThreadPool.

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

4 years ago[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush
Johannes Doerfert [Wed, 22 Apr 2020 15:17:32 +0000 (10:17 -0500)]
[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush

This was reported as PR45635, committed first as
72a9e7c926f4e32f209e528ec407fe526da5587e, reverted by
188f5cde9635a29a3f20ee2a73abd02890a752c7, and now recommitted with the
test change.

4 years ago[SVE] Add new VectorType subclasses
Christopher Tetreault [Wed, 22 Apr 2020 15:02:02 +0000 (08:02 -0700)]
[SVE] Add new VectorType subclasses

Summary:
Introduce new types for fixed width and scalable vectors.

Does not remove getNumElements yet so as to not break code during transition
period.

Reviewers: deadalnix, efriedma, sdesmalen, craig.topper, huntergr

Reviewed By: sdesmalen

Subscribers: jholewinski, arsenm, jvesely, nhaehnle, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, kerbowa, Joonsoo, grosul1, frgossen, lldb-commits, tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm, #lldb

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

4 years ago[ARM][MC][Thumb] Recommit: Revert relocation for some pc-relative fixups.
Mark Murray [Mon, 20 Apr 2020 15:21:46 +0000 (16:21 +0100)]
[ARM][MC][Thumb] Recommit: Revert relocation for some pc-relative fixups.

Summary:
This commit recommits the reversion of https://reviews.llvm.org/D75039.

Concensus appears to be in favour of assembly-time resolution of
these ADR and LDR relocations, in line with GNU. The previous
backout broke many lld tests, now fixed by Peter Smith in
61bccda9d9d920c72f49025f11e8601daeb096ec.

Reviewers: psmith

Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC][Future] Initial support for PCRel addressing for jump tables.
Victor Huang [Wed, 22 Apr 2020 15:45:01 +0000 (10:45 -0500)]
[PowerPC][Future] Initial support for PCRel addressing for jump tables.

Add initial support for PC Relative addressing to get jump table base
address instead of using TOC.

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

4 years ago[SveEmitter] Add IsOverloadNone flag and builtins for svpfalse and svcnt[bhwd]_pat
Sander de Smalen [Wed, 22 Apr 2020 14:00:01 +0000 (15:00 +0100)]
[SveEmitter] Add IsOverloadNone flag and builtins for svpfalse and svcnt[bhwd]_pat

Add the IsOverloadNone flag to tell CGBuiltin that it does not have
an overloaded type. This is used for e.g. svpfalse which does
not take any arguments and always returns a svbool_t.

This patch also adds builtins for svcntb_pat, svcnth_pat, svcntw_pat
and svcntd_pat, as those don't require custom codegen.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[llvm][NFC][CallSite] Remove CallSite from a few trivial locations
Mircea Trofin [Wed, 22 Apr 2020 04:56:04 +0000 (21:56 -0700)]
[llvm][NFC][CallSite] Remove CallSite from a few trivial locations

Summary: Implementation details and internal (to module) APIs.

Reviewers: craig.topper, dblaikie

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush"
Johannes Doerfert [Wed, 22 Apr 2020 15:36:23 +0000 (10:36 -0500)]
Revert "[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush"

Forgot to include test changes :(

This reverts commit 72a9e7c926f4e32f209e528ec407fe526da5587e.

4 years agoclang-format: Introduce stricter AlignOperands flag
Francois Ferrand [Mon, 22 May 2017 09:23:08 +0000 (11:23 +0200)]
clang-format: Introduce stricter AlignOperands flag

Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, there is an option to actually align the operands, so
that the operator gets right-aligned with the equal sign or return
operator:

  int aaaaa = bbbbbb
            + cccccc;
  return aaaaaaa
      && bbbbbbb;

This not happen in parentheses, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper

Subscribers: cfe-commits, klimek

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

4 years agoclang-format: support aligned nested conditionals formatting
Francois Ferrand [Fri, 15 Jun 2018 12:22:23 +0000 (14:22 +0200)]
clang-format: support aligned nested conditionals formatting

When multiple ternary operators are chained, e.g. like an if/else-if/
else-if/.../else sequence, clang-format will keep aligning the colon
with the question mark, which increases the indent for each
conditionals:

  int a = condition1 ? result1
                     : condition2 ? result2
                                  : condition3 ? result3
                                               : result4;

This patch detects the situation (e.g. conditionals used in false branch
of another conditional), to avoid indenting in that case:

  int a = condition1   ? result1
          : condition2 ? result2
          : condition3 ? result3
                       : result4;

When BreakBeforeTernaryOperators is false, this will format like this:

  int a = condition1 ? result1 :
          condition2 ? result2 :
          conditino3 ? result3 :
                       result4;

4 years ago[ARM] Release notes for the Custom Datapath Extension (CDE)
Mikhail Maltsev [Wed, 22 Apr 2020 15:34:19 +0000 (16:34 +0100)]
[ARM] Release notes for the Custom Datapath Extension (CDE)

Summary:
This change mentions CDE assembly in the LLVM release notes and CDE
intrinsics in both Clang and LLVM release notes.

Reviewers: kristof.beyls, simon_tatham

Reviewed By: kristof.beyls

Subscribers: danielkiss, cfe-commits

Tags: #clang

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

4 years ago[TSAN] Add optional support for distinguishing volatiles
Dmitry Vyukov [Wed, 22 Apr 2020 14:01:33 +0000 (16:01 +0200)]
[TSAN] Add optional support for distinguishing volatiles

Add support to optionally emit different instrumentation for accesses to
volatile variables. While the default TSAN runtime likely will never
require this feature, other runtimes for different environments that
have subtly different memory models or assumptions may require
distinguishing volatiles.

One such environment are OS kernels, where volatile is still used in
various places for various reasons, and often declare volatile to be
"safe enough" even in multi-threaded contexts. One such example is the
Linux kernel, which implements various synchronization primitives using
volatile (READ_ONCE(), WRITE_ONCE()). Here the Kernel Concurrency
Sanitizer (KCSAN) [1], is a runtime that uses TSAN instrumentation but
otherwise implements a very different approach to race detection from
TSAN.

While in the Linux kernel it is generally discouraged to use volatiles
explicitly, the topic will likely come up again, and we will eventually
need to distinguish volatile accesses [2]. The other use-case is
ignoring data races on specially marked variables in the kernel, for
example bit-flags (here we may hide 'volatile' behind a different name
such as 'no_data_race').

[1] https://github.com/google/ktsan/wiki/KCSAN
[2] https://lkml.kernel.org/r/CANpmjNOfXNE-Zh3MNP=-gmnhvKbsfUfTtWkyg_=VqTxS4nnptQ@mail.gmail.com

Author: melver (Marco Elver)
Reviewed-in: https://reviews.llvm.org/D78554

4 years ago[mlir][vulkan-runner] Fix testsuite.
Denis Khalikov [Wed, 22 Apr 2020 14:39:39 +0000 (17:39 +0300)]
[mlir][vulkan-runner] Fix testsuite.

Summary: Fix testsuite after D78542.

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

4 years ago[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush
Johannes Doerfert [Wed, 22 Apr 2020 15:17:32 +0000 (10:17 -0500)]
[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush

This was reported as PR45635.

4 years agoFix -Wunused-variable error.
Haojian Wu [Wed, 22 Apr 2020 15:17:41 +0000 (17:17 +0200)]
Fix -Wunused-variable error.

4 years ago[nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE
Jan Kratochvil [Wed, 22 Apr 2020 14:46:29 +0000 (16:46 +0200)]
[nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

Pavel Labath wrote in D73206:
The internal representation of DebugNames and Apple indexes is fixed by
the relevant (pseudo-)standards, so we can't really change it. The
question is how to efficiently (and cleanly) convert from the internal
representation to some common thing. The conversion from AppleIndex to
DIERef is trivial (which is not surprising as it was the first and the
overall design was optimized for that). With debug_names, the situation
gets more tricky. The internal representation of debug_names uses
CU-relative DIE offsets, but DIERef wants an absolute offset. That means
the index has to do more work to produce the common representation. And
it needs to do that for all results, even though a lot of the index
users are really interested only in a single entry. With the switch to
user_id_t, _all_ indexes would have to do some extra work to encode it,
only for their users to have to immediately decode it back. Having
a iterator/callback based api would allow us to minimize the impact of
that, as it would only need to happen for the entries that are really
used. And /I think/ we could make it interface returns DWARFDies
directly, and each index converts to that using the most direct approach
available.

Jan Kratochvil:
It also makes all the callers shorter as they no longer need to fetch
DWARFDIE from DIERef (and handling if not found by ReportInvalidDIERef)
but the callers are already served DWARFDIE which they need.
In some cases the DWARFDIE had to be fetched both by callee (DWARFIndex
implementation) and caller.

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

4 years ago[CMake] Add a warning message to prepare the upcoming upgrade to CMake 3.13.4
Louis Dionne [Wed, 8 Apr 2020 16:26:59 +0000 (12:26 -0400)]
[CMake] Add a warning message to prepare the upcoming upgrade to CMake 3.13.4

As discussed in http://lists.llvm.org/pipermail/llvm-dev/2020-March/140349.html,
the minimum version of CMake required to build LLVM will be upgraded to
3.13.4 right after we create the release branch for LLVM 11.0.0.

As part of this effort, this commit adds a warning to give a heads up
to folks regarding the upcoming upgrade. This should allow users to
upgrade their CMake in advance so that the upgrade can sail right
through when the time comes.

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

4 years ago[NFC][InstCombine] Tests for negation of sign-/zero- extensions
Roman Lebedev [Wed, 22 Apr 2020 14:30:58 +0000 (17:30 +0300)]
[NFC][InstCombine] Tests for negation of sign-/zero- extensions

* sext of non-positive can be negated.
* zext of non-negative can be negated.

4 years ago[BPF] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:45:07 +0000 (14:45 +0100)]
[BPF] Remove unused forward declarations. NFC.

4 years agoBranchFolding.h - remove unused raw_ostream forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:38:04 +0000 (14:38 +0100)]
BranchFolding.h - remove unused raw_ostream forward declaration. NFC.

4 years agoRecordStreamer.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:36:44 +0000 (14:36 +0100)]
RecordStreamer.h - cleanup includes and forward declarations. NFC.
Reduce MCSymbol.h include to forward declaration.
Remove unused GlobalValue foward declaration.

4 years agoRuntimeDyldImpl.h - remove unused Twine forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:16:40 +0000 (14:16 +0100)]
RuntimeDyldImpl.h - remove unused Twine forward declaration. NFC.

4 years ago[NFC] Fix unused result of dyn_cast<VectorType> in non-assert build
Sander de Smalen [Wed, 22 Apr 2020 13:42:44 +0000 (14:42 +0100)]
[NFC] Fix unused result of dyn_cast<VectorType> in non-assert build

4 years ago[llvm-objdump][XCOFF] Print more symbol info in relocation
jasonliu [Tue, 21 Apr 2020 21:52:08 +0000 (21:52 +0000)]
[llvm-objdump][XCOFF] Print more symbol info in relocation

Summary:
Print more symbol info in relocation printing when
--symbol-description is specified.

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

4 years ago[ARM] Don't shrink STM if it would cause an unknown base register store
John Brawn [Wed, 22 Apr 2020 11:07:15 +0000 (12:07 +0100)]
[ARM] Don't shrink STM if it would cause an unknown base register store

If a 16-bit thumb STM with writeback stores the base register but it isn't the
first register in the list, then an unknown value is stored. The load/store
optimizer knows this and generates a 32-bit STM without writeback instead, but
thumb2 size reduction converts it into a 16-bit STM. Fix this by having thumb2
size reduction notice such STMs and leave them as they are.

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

4 years ago[SveEmitter] Add support for _n form builtins
Sander de Smalen [Wed, 22 Apr 2020 12:58:35 +0000 (13:58 +0100)]
[SveEmitter] Add support for _n form builtins

The ACLE has builtins that take a scalar value that is to be expanded
into a vector by the operation. While the ISA may have an instruction
that takes an immediate or a scalar to represent this, the LLVM IR
intrinsic may not, so Clang will have to splat the scalar value.

This patch also adds the _n forms for svabd, svadd, svdiv, svdivr,
svmax, svmin, svmul, svmulh, svub and svsubr.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: SjoerdMeijer

Tags: #clang

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

4 years ago[AMDGPU] Fix test failures caused by dbdffe3ee9d.
Jay Foad [Wed, 22 Apr 2020 12:42:15 +0000 (13:42 +0100)]
[AMDGPU] Fix test failures caused by dbdffe3ee9d.

4 years ago[ARM] Distribute MVE post-increments
David Green [Wed, 22 Apr 2020 12:30:22 +0000 (13:30 +0100)]
[ARM] Distribute MVE post-increments

This adds some extra processing into the Pre-RA ARM load/store optimizer
to detect and merge MVE loads/stores and adds of the same base. This we
don't always turn into a post-inc during ISel, and due to the nature of
it being a graph we don't always know an order to use for the nodes, not
knowing which nodes to make post-inc and which to use the new post-inc
of. After ISel, we have an order that we can use to post-inc the
following instructions.

So this looks for a loads/store with a starting offset of 0, and an
add/sub from the same base, plus a number of other loads/stores. We then
do some checks and convert the zero offset load/store into a postinc
variant. Any loads/stores after it have the offset subtracted from their
immediates.  For example:
  LDR #4           LDR #4
  LDR #0           LDR_POSTINC #16
  LDR #8           LDR #-8
  LDR #12          LDR #-4
  ADD #16
It only handles MVE loads/stores at the moment. Normal loads/store will
be added in a followup patch, they just have some extra details to
ensure that we keep generating LDRD/LDM successfully.

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

4 years ago[AArch64][FIX] f16 indexed patterns encoding restrictions.
Pavel Iliin [Wed, 22 Apr 2020 11:34:36 +0000 (12:34 +0100)]
[AArch64][FIX] f16 indexed patterns encoding restrictions.

4 years ago[AsmPrinter] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 12:44:58 +0000 (13:44 +0100)]
[AsmPrinter] Remove unused forward declarations. NFC.

4 years agoMetadataLoader.h - remove unused MDNode forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:43:58 +0000 (12:43 +0100)]
MetadataLoader.h - remove unused MDNode forward declaration. NFC.

4 years ago[AsmParser] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:41:50 +0000 (12:41 +0100)]
[AsmParser] Remove unused forward declarations. NFC.

4 years agoX86TargetMachine.h - remove unused X86RegisterBankInfo forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:40:39 +0000 (12:40 +0100)]
X86TargetMachine.h - remove unused X86RegisterBankInfo forward declaration. NFC.

4 years ago[InstCombine] add tests for min/max FP intrinsics with FMF (PR45478); NFC
Sanjay Patel [Wed, 22 Apr 2020 12:42:44 +0000 (08:42 -0400)]
[InstCombine] add tests for min/max FP intrinsics with FMF (PR45478); NFC

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

4 years ago[ARM] MVE FMA loop tests. NFC
David Green [Wed, 22 Apr 2020 11:40:45 +0000 (12:40 +0100)]
[ARM] MVE FMA loop tests. NFC

4 years ago[NFC][AMDGPU] Fix cmake when LLVM is a subproject
Sebastian Neubauer [Wed, 22 Apr 2020 12:01:38 +0000 (14:01 +0200)]
[NFC][AMDGPU] Fix cmake when LLVM is a subproject

CMAKE_SOURCE_DIR is not the right directory if llvm is included in
another cmake project. PROJECT_SOURCE_DIR is always the same and should
be used instead.

4 years ago[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Louis Dionne [Fri, 17 Apr 2020 14:29:15 +0000 (10:29 -0400)]
[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'

Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

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

4 years ago[SveEmitter] Implement builtins for gathers/scatters
Andrzej Warzynski [Tue, 7 Apr 2020 10:09:01 +0000 (11:09 +0100)]
[SveEmitter] Implement builtins for gathers/scatters

This patch adds builtins for:
  * regular, first-faulting and non-temporal gather loads
  * regular and non-temporal scatter stores

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

4 years ago[InstCombine] Negator: shufflevector is negatible
Roman Lebedev [Wed, 22 Apr 2020 11:58:39 +0000 (14:58 +0300)]
[InstCombine] Negator: shufflevector is negatible

All these folds are correct as per alive-tv

4 years ago[NFC][InstCombine] Add shuffle negation tests
Roman Lebedev [Wed, 22 Apr 2020 11:57:57 +0000 (14:57 +0300)]
[NFC][InstCombine] Add shuffle negation tests

4 years ago[AMDGPU] Add 192-bit register classes
Jay Foad [Thu, 16 Apr 2020 16:02:19 +0000 (17:02 +0100)]
[AMDGPU] Add 192-bit register classes

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

4 years ago[AMDGPU] Add missing AReg classes
Jay Foad [Fri, 17 Apr 2020 08:25:37 +0000 (09:25 +0100)]
[AMDGPU] Add missing AReg classes

Add 96-bit, 160-bit and 256-bit AReg classes to match VReg and SReg.
NFC as far as I know, but it may avoid weird legalization problems.

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

4 years ago[libc++ testing] Fix unused variable warning turned error
David Zarzycki [Wed, 22 Apr 2020 11:45:47 +0000 (07:45 -0400)]
[libc++ testing] Fix unused variable warning turned error

4 years ago[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]
Peter Smith [Wed, 22 Apr 2020 10:57:13 +0000 (11:57 +0100)]
[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]

After D78301 MC no longer emits a relocation for this case. Change to use
.inst and .reloc to synthesize the same instruction and relocation. One
more test case I missed.

4 years ago[llvm-objdump] Look in all viable sections for call/branch targets
James Henderson [Mon, 20 Apr 2020 13:23:01 +0000 (14:23 +0100)]
[llvm-objdump] Look in all viable sections for call/branch targets

Prior to this patch, llvm-objdump would only look in the last section
(according to the section header table order) that matched an address
for a symbol when identifying the target symbol of a call or branch
operation. If there are multiple sections with the same address, due to
some of them being empty, it did not look in those, even if the symbol
couldn't be found in the first section looked in.

This patch causes llvm-objdump to look in all sections for possible
candidate symbols. If there are multiple possible symbols, it picks one
from a non-empty section, if possible (as that is more likely to be the
"real" symbol since functions can't really be in emptiy sections),
before falling back to those in empty sections. If all else fails, it
falls back to absolute symbols as it did before.

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

Reviewed by: grimar, Higuoxing

4 years ago[NFC][llvm][X86] Adding missing -mtiple to X86 test.
Lucas Prates [Wed, 22 Apr 2020 10:31:41 +0000 (11:31 +0100)]
[NFC][llvm][X86] Adding missing -mtiple to X86 test.

The modified test was missing the specification of the intended triple
in its run line, assuming X86 is the default.

4 years ago[AArch64][SVE] Add SVE intrinsic for LD1RQ
Kerry McLaughlin [Wed, 22 Apr 2020 08:38:48 +0000 (09:38 +0100)]
[AArch64][SVE] Add SVE intrinsic for LD1RQ

Summary:
Adds the following intrinsic for contiguous load & replicate:
  - @llvm.aarch64.sve.ld1rq

The LD1RQ intrinsic only needs the SImmS16XForm added by this
patch. The others (SImmS2XForm, SImmS3XForm & SImmS4XForm)
were added for consistency.

Reviewers: andwar, sdesmalen, efriedma, cameron.mcinally, dancgr, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoMake some static class members constexpr
Benjamin Kramer [Wed, 22 Apr 2020 10:09:37 +0000 (12:09 +0200)]
Make some static class members constexpr

This allows them to be ODR used in C++17 mode. NFC.

4 years ago[yaml2obj] - Program headers: add an additional check for `Offset`
Georgii Rymar [Thu, 16 Apr 2020 13:41:28 +0000 (16:41 +0300)]
[yaml2obj] - Program headers: add an additional check for `Offset`

The `Offset` field is used to set the file offset of a program header.
In a normal object it should not be greater than the minimal offset
of sections included into segment.

This patch adds a check for that and adds tests.

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

4 years ago[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.
Georgii Rymar [Fri, 17 Apr 2020 12:06:04 +0000 (15:06 +0300)]
[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.

This depends on D78361 and simplifies the computation of the `p_offset`.

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

4 years ago[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.
Georgii Rymar [Tue, 7 Apr 2020 15:20:51 +0000 (18:20 +0300)]
[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.

Imagine we have:

```
ProgramHeaders:
  - Type:  PT_LOAD
    Flags: [ PF_W, PF_R ]
    Sections:
      - Section: .bar
    VAddr: 0x2000
Sections:
  - Name:    .foo
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x1000
  - Name:    .bar
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x2000
```

Both `.foo` and `.bar` share the same starting file offset,
but `VA(.foo)` < `VA(PT_LOAD)`, we should not include it into segment.

This patch fixes the issue.

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