platform/upstream/llvm.git
3 years ago[X86] Remove extract_subvector(subv_broadcast_load()) fold.
Simon Pilgrim [Thu, 17 Dec 2020 11:02:34 +0000 (11:02 +0000)]
[X86] Remove extract_subvector(subv_broadcast_load()) fold.

This was needed in an earlier version of D92645, but isn't now - and I've just noticed that it was potentially flawed depending on the relevant widths of the broadcasted and extracted subvectors.

3 years agofix a -Wunused-variable warning in release build
Krasimir Georgiev [Thu, 17 Dec 2020 10:48:42 +0000 (11:48 +0100)]
fix a -Wunused-variable warning in release build

3 years ago[lldb] Add std::array to the supported template list of the CxxModuleHandler
Raphael Isemann [Thu, 17 Dec 2020 10:23:11 +0000 (11:23 +0100)]
[lldb] Add std::array to the supported template list of the CxxModuleHandler

Identical to the other patches that add STL containers to the supported
templated list.

3 years agoMake LLVM build in C++20 mode
Barry Revzin [Thu, 17 Dec 2020 10:41:35 +0000 (10:41 +0000)]
Make LLVM build in C++20 mode

Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).

There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:

// 1) Missing const
namespace missing_const {
    struct A {
    #ifndef FIXED
        bool operator==(A const&);
    #else
        bool operator==(A const&) const;
    #endif
    };

    bool a = A{} == A{}; // error
}

// 2) Type mismatch on CRTP
namespace crtp_mismatch {
    template <typename Derived>
    struct Base {
    #ifndef FIXED
        bool operator==(Derived const&) const;
    #else
        // in one case changed to taking Base const&
        friend bool operator==(Derived const&, Derived const&);
    #endif
    };

    struct D : Base<D> { };

    bool b = D{} == D{}; // error
}

// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
    template <bool Const>
    struct iterator {
        using const_iterator = iterator<true>;

        iterator();

        template <bool B, std::enable_if_t<(Const && !B), int> = 0>
        iterator(iterator<B> const&);

    #ifndef FIXED
        bool operator==(const_iterator const&) const;
    #else
        friend bool operator==(iterator const&, iterator const&);
    #endif
    };

    bool c = iterator<false>{} == iterator<false>{} // error
          || iterator<false>{} == iterator<true>{}
          || iterator<true>{} == iterator<false>{}
          || iterator<true>{} == iterator<true>{};
}

// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
    enum Color { Red };

    struct C {
        C();
        C(Color);
        operator Color() const;
        bool operator==(Color) const;
        friend bool operator==(C, C);
    };

    bool c = C{} == C{}; // error
    bool d = C{} == Red;
}

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

3 years ago[X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST ...
Simon Pilgrim [Thu, 17 Dec 2020 10:12:51 +0000 (10:12 +0000)]
[X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST (PR38969)

Subvector broadcasts are only load instructions, yet X86ISD::SUBV_BROADCAST treats them more generally, requiring a lot of fallback tablegen patterns.

This initial patch replaces constant vector lowering inside lowerBuildVectorAsBroadcast with direct X86ISD::SUBV_BROADCAST_LOAD loads which helps us merge a number of equivalent loads/broadcasts.

As well as general plumbing/analysis additions for SUBV_BROADCAST_LOAD, I needed to wrap SelectionDAG::makeEquivalentMemoryOrdering so it can handle result chains from non generic LoadSDNode nodes.

Later patches will continue to replace X86ISD::SUBV_BROADCAST usage.

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

3 years ago[libc] add back math.h #include utils/FPUtil/ManipulationFunctions.h
Krasimir Georgiev [Thu, 17 Dec 2020 10:16:08 +0000 (11:16 +0100)]
[libc] add back math.h #include utils/FPUtil/ManipulationFunctions.h

This partially reverts cee1e7d14f4628d6174b33640d502bff3b54ae45:
  [libc][NFC][Obvious] Remove few unnecessary #include directives in tests.

That commit causes a test failure in our configuration:
[ RUN      ] ILogbTest.SpecialNumbers_ilogb
third_party/llvm/llvm-project/libc/test/src/math/ILogbTest.h:28: FAILURE
      Expected: FP_ILOGBNAN
      Which is: 2147483647
To be equal to: func(__llvm_libc::fputil::FPBits<T>::buildNaN(1))
      Which is: -2147483648

3 years ago[lldb] Unify the two CreateTypedef implementations in TypeSystemClang
Raphael Isemann [Thu, 17 Dec 2020 09:46:26 +0000 (10:46 +0100)]
[lldb] Unify the two CreateTypedef implementations in TypeSystemClang

To get LLDB one step closer to fulfil the software redundancy requirements of
modern aircrafts, we apparently decided to have two separately maintained
implementations of `CreateTypedef` in TypeSystemClang. Let's pass on the idea of
an LLDB-powered jetliner and deleted one implementation.

On a more serious note: This function got duplicated a long time ago when the
idea of CompilerType with a backing TypeSystemClang subclass happened
(56939cb31061d24ae3d1fc62da38b57e78bb2556). One implementation was supposed to
be called from CompilerType::CreateTypedef and the other has just always been
around to create typedefs. By accident one of the implementations is only used
by the PDB parser while the CompilerType::CreateTypedef backend is used by the
rest of LLDB.

We also had some patches over the year that only fixed one of the two functions
(D18099 for example only fixed up the CompilerType::CreateTypedef
implementation). D51162 and D86140 both fixed the same missing `addDecl` call
for one of the two implementations.

This patch:
* deletes the `CreateTypedefType` function as its only used by the PDB parser
  and the `CreateTypedef` implementation is anyway needed as it's the backend
  implementation of CompilerType.
* replaces the calls in the PDB parser by just calling the CompilerType wrapper.
* moves the documentation to the remaining function.
* moves the check for empty typedef names that was only in the deleted
  implementation to the other (I don't think this fixes anything as I believe
  all callers are already doing the same check).

I'll fix up the usual stuff (not using StringRef, not doing early exit) in a NFC
follow-up.

This patch is not NFC as the PDB parser now calls the function that has the fix
from D18099.

Reviewed By: labath, JDevlieghere

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

3 years ago[Flang][openmp]Fix crash in OpenMP semantic check( bug 48308)
sameeran joshi [Fri, 4 Dec 2020 07:34:52 +0000 (13:04 +0530)]
[Flang][openmp]Fix crash in OpenMP semantic check( bug 48308)

Fixes the bug reported in https://bugs.llvm.org/show_bug.cgi?id=48308

Reviewed By: kiranchandramohan, clementval

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

3 years ago[clang-format] PR35514 brace-init member initializers in function-try-blocks are...
mydeveloperday [Thu, 17 Dec 2020 09:39:37 +0000 (09:39 +0000)]
[clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly

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

Initializer lists with a try-block are incorrectly formatted.

e.g.

```
Foo(int abc, int def) try : _abc(abc), _def{def}, _ghi{1} {
  callA();
  callB();
} catch (std::exception&) {
}
```

is formatted as:

```
Foo(int abc, int def) try : _abc(abc), _def { def }
, _ghi{1} {
  callA();
  callB();
}
catch (std::exception&) {
}
```

This revision adds support in the parseTryCatch for braced initializers in the initializer list

Reviewed By: curdeius, HazardyKnusperkeks

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

3 years ago[llvm][AArch64] Actually check expected FPU for CPUs
David Spickett [Tue, 15 Dec 2020 16:17:28 +0000 (16:17 +0000)]
[llvm][AArch64] Actually check expected FPU for CPUs

We were passing this as an argument but never using
it. ARM has always checked this.

Note that the FPU list is shared between ARM and AArch64
so there is no AArch64::getFPUName, just ARM::getFPUName.

Reviewed By: dmgreen

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

3 years ago[InstCombine] Preserve !annotation for newly created instructions.
Florian Hahn [Thu, 17 Dec 2020 08:47:46 +0000 (08:47 +0000)]
[InstCombine] Preserve !annotation for newly created instructions.

When replacing an instruction with !annotation with a newly created
replacement, add the !annotation metadata to the replacement.

This mostly covers cases where the new instructions are created using
the ::Create helpers. Instructions created by IRBuilder will be handled
by D91444.

Reviewed By: thegameg

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

3 years ago[clang][nfc] Update comment to match the opening `{`
Andrzej Warzynski [Thu, 17 Dec 2020 09:04:41 +0000 (09:04 +0000)]
[clang][nfc] Update comment to match the opening `{`

3 years ago[lldb] [POSIX-DYLD] Update the cached exe path after attach
Michał Górny [Sat, 28 Nov 2020 10:11:01 +0000 (11:11 +0100)]
[lldb] [POSIX-DYLD] Update the cached exe path after attach

Fix the POSIX-DYLD plugin to update the cached executable path after
attaching.  Previously, the path was cached in DYLDRendezvous
constructor and not updated afterwards.  This meant that if LLDB was
attaching to a process (e.g. via connecting to lldb-server), the code
stored the empty path before DidAttach() resolved it.  The fix updates
the cached path in DidAttach().

This fixes a new instance of https://llvm.org/pr17880

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

3 years ago[lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit
Michał Górny [Fri, 4 Dec 2020 17:56:46 +0000 (18:56 +0100)]
[lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit

Explicitly consider the libraries reported on the initial rendezvous
breakpoint hit added.  This is necessary on FreeBSD since the dynamic
loader issues only a single 'consistent' state rendezvous breakpoint hit
for all the libraries present in DT_NEEDED.  It is also helpful on Linux
where it ensures that ld-linux is considered loaded as well
as the shared system libraries reported afterwards.

Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.

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

3 years ago[mlir] Support index and memref types in llvm.mlir.cast
Alex Zinenko [Wed, 16 Dec 2020 17:32:26 +0000 (18:32 +0100)]
[mlir] Support index and memref types in llvm.mlir.cast

This operation is designed to support partial conversion, more specifically the
IR state in which some operations expect or produce built-in types and some
operations produce and expect LLVM dialect types. It is reasonable for it to
support cast between built-in types and any equivalent that could be produced
by the type conversion. (At the same time, we don't want the dialect to depend
on the type conversion as it could lead to a dependency cycle). Introduce
support for casting from index to any integer type and back, and from memref to
bare pointer or memref descriptor type and back.

Contrary to what the TODO in the code stated, there are no particular
precautions necessary to handle the bare pointer conversion for memerfs. This
conversion applies exclusively to statically-shaped memrefs, so we can always
recover the full descriptor contents from the type.

This patch simultaneously tightens the verification for other types to only
accept matching pairs of types, e.g., i64 and !llvm.i64, as opposed to the
previous implementation that only checked if the types were generally allowed
byt not for matching, e.g. i64 could be "casted" to !llvm.bfloat, which is not
the intended semantics.

Move the relevant test under test/Dialect/LLVMIR because it is not specific to
the conversion pass, but rather exercises an op in the dialect. If we decide
this op does not belong to the LLVM dialect, both the dialect and the op should
move together.

Reviewed By: silvas, ezhulenev

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

3 years agoExpand the fp_to_int/int_to_fp/fp_round/fp_extend as libcall for fp128
QingShan Zhang [Thu, 17 Dec 2020 07:59:30 +0000 (07:59 +0000)]
Expand the fp_to_int/int_to_fp/fp_round/fp_extend as libcall for fp128

X86 and AArch64 expand it as libcall inside the target. And PowerPC also
want to expand them as libcall for P8. So, propose an implement in the
legalizer to common the logic and remove the code for X86/AArch64 to
avoid the duplicate code.

Reviewed By: Craig Topper

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

3 years agoUse basic_string::find(char) instead of basic_string::find(const char *s, size_type...
Fangrui Song [Thu, 17 Dec 2020 07:28:32 +0000 (23:28 -0800)]
Use basic_string::find(char) instead of basic_string::find(const char *s, size_type pos=0)

Many (StringRef) cannot be detected by clang-tidy performance-faster-string-find.

3 years ago[NFC][SampleFDO] Preparation to support multiple sections with the same type
Wei Mi [Mon, 14 Dec 2020 22:49:20 +0000 (14:49 -0800)]
[NFC][SampleFDO] Preparation to support multiple sections with the same type
in ExtBinary format.

Currently ExtBinary format doesn't support multiple sections with the same type
in the profile. We add the support in this patch. Previously we use the section
type to identify a section uniquely. Now we introduces a LayoutIndex in the
SecHdrTableEntry and use the LayoutIndex to locate the target section. The
allocations of NameTable and FuncOffsetTable are adjusted accordingly.

Currently it works as a NFC because it won't change anything for current layout.
The test for multiple sections support will be included in another patch where a
new type of profile containing multiple sections with the same type is
introduced.

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

3 years ago[Debugify] Support checking Machine IR debug info
Xiang1 Zhang [Thu, 17 Dec 2020 04:23:29 +0000 (20:23 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.

For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".

Reviewed By: djtodoro

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

3 years ago[GCN] Remove unused function handleNewInstruction (NFC)
Kazu Hirata [Thu, 17 Dec 2020 05:57:48 +0000 (21:57 -0800)]
[GCN] Remove unused function handleNewInstruction (NFC)

The function was added without a user on Dec 22, 2016 in commit
7e274e02ae088923e67cd13b99d52644532ad1cc.  It seems to be unused since
then.

3 years ago[IR, CodeGen] Use llvm::is_contained (NFC)
Kazu Hirata [Thu, 17 Dec 2020 05:30:44 +0000 (21:30 -0800)]
[IR, CodeGen] Use llvm::is_contained (NFC)

3 years ago[NFC] factor update test function test builder as a class
Mircea Trofin [Wed, 16 Dec 2020 18:20:12 +0000 (10:20 -0800)]
[NFC] factor update test function test builder as a class

This allows us to have shared logic over multiple test runs, e.g. do we
have unused prefixes, or which function bodies have conflicting outputs
for a prefix appearing in different RUN lines.

This patch is just wrapping existing functionality, and replacing its uses.
A subsequent patch would then fold the current functionality into the newly
introduced class.

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

3 years ago[RISCV] Infer mask type from data type for vector vle and vse intrinsics.
Craig Topper [Thu, 17 Dec 2020 04:55:23 +0000 (20:55 -0800)]
[RISCV] Infer mask type from data type for vector vle and vse intrinsics.

The mask type should have the same number of elements as the data
type.

Similar to D93409 which did this for arithmetic intrinsics.

3 years ago[mlir][NFC] Remove StandardTypes.h now that all usages point to BuiltinTypes.h
River Riddle [Thu, 17 Dec 2020 04:35:25 +0000 (20:35 -0800)]
[mlir][NFC] Remove StandardTypes.h now that all usages point to BuiltinTypes.h

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

3 years ago[RISCV] Infer mask type for vector intrinsics from the data type
Craig Topper [Thu, 17 Dec 2020 04:04:48 +0000 (20:04 -0800)]
[RISCV] Infer mask type for vector intrinsics from the data type

We can use LLVMScalarOrSameVectorWidth<0, llvm_i1_ty> to infer the mask type from the anyvector_ty. This will save us from needing to pass it to getDeclaration when creating these intrinsics from clang.

No tests updates are needed because our declarations are exploiting a behavior in the IR parser where the declaration of an intrinsic doesn't need to mention all the types as long as there isn't a name conflict in the file.

Reviewed By: khchen

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

3 years agoRevert "[Debugify] Support checking Machine IR debug info"
Xiang1 Zhang [Thu, 17 Dec 2020 04:12:01 +0000 (20:12 -0800)]
Revert "[Debugify] Support checking Machine IR debug info"

This reverts commit 50aaa8c274910d78d7bf6c929a34fe58b1f45579.

3 years ago[RISCV] Define vector widening mul intrinsics.
Hsiangkai Wang [Wed, 16 Dec 2020 08:46:21 +0000 (16:46 +0800)]
[RISCV] Define vector widening mul intrinsics.

Define vector widening mul intrinsics and lower them to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93381

3 years ago[RISCV] Define vector mul/div/rem intrinsics.
Hsiangkai Wang [Wed, 16 Dec 2020 08:25:46 +0000 (16:25 +0800)]
[RISCV] Define vector mul/div/rem intrinsics.

Define vector mul/div/rem intrinsics and lower them to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93380

3 years ago[RISCV] V does not imply F.
Hsiangkai Wang [Tue, 15 Dec 2020 06:59:22 +0000 (14:59 +0800)]
[RISCV] V does not imply F.

If users want to use vector floating point instructions, they need to
specify 'F' extension additionally.

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

3 years agoAMDGPU: Remove SGPRSpillVGPRDefinedSet hack
Matt Arsenault [Thu, 15 Oct 2020 22:40:02 +0000 (18:40 -0400)]
AMDGPU: Remove SGPRSpillVGPRDefinedSet hack

These VGPRs should be reserved and therefore do not need "correct"
liveness. They should not have undef uses, which can still cause
issues.

3 years ago[RISCV] Define vle/vse intrinsics.
Zakk Chen [Tue, 15 Dec 2020 14:53:16 +0000 (06:53 -0800)]
[RISCV] Define vle/vse intrinsics.

Define vle/vse intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper

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

3 years ago[Debugify] Support checking Machine IR debug info
Xiang1 Zhang [Tue, 15 Dec 2020 07:48:11 +0000 (23:48 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.

For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".

Reviewed By: djtodoro

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

3 years ago[OpenMP] Add initial support for `omp [begin/end] assumes`
Johannes Doerfert [Mon, 23 Nov 2020 17:48:59 +0000 (11:48 -0600)]
[OpenMP] Add initial support for `omp [begin/end] assumes`

The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

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

3 years ago[gn build] (manually) port ddffcdf0a66
Nico Weber [Thu, 17 Dec 2020 01:49:56 +0000 (20:49 -0500)]
[gn build] (manually) port ddffcdf0a66

3 years ago[test] Cleanup some CGSCCPassManager tests
Arthur Eubanks [Wed, 16 Dec 2020 23:38:58 +0000 (15:38 -0800)]
[test] Cleanup some CGSCCPassManager tests

Don't iterate over SCC as we potentially modify it.
Verify module (and fix some broken ones).
Only run pass once and make sure that it's actually run.
Rename tests to just end in a number since I'm planning on adding a
bunch more which won't have good individual names. Instead, add comments
on the transformations that each test does.

Reviewed By: rnk

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

3 years ago[clang-tidy] Add a diagnostic callback to parseConfiguration
Nathan James [Thu, 17 Dec 2020 00:24:58 +0000 (00:24 +0000)]
[clang-tidy] Add a diagnostic callback to parseConfiguration

Currently errors detected when parsing the YAML for .clang-tidy files are always printed to errs.
For clang-tidy binary workflows this usually isn't an issue, but using clang-tidy as a library for integrations may want to handle displaying those errors in their own specific way.

Reviewed By: aaron.ballman

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

3 years ago[mlir] Modify linalg loops test to have nested regions
Tres Popp [Wed, 16 Dec 2020 21:08:34 +0000 (22:08 +0100)]
[mlir] Modify linalg loops test to have nested regions

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

3 years ago[gn build] Port ac068e014b2
LLVM GN Syncbot [Thu, 17 Dec 2020 00:07:28 +0000 (00:07 +0000)]
[gn build] Port ac068e014b2

3 years ago[OpenMP][Libomptarget][NFC] Use CMake Variables
Atmn [Sun, 6 Dec 2020 02:41:09 +0000 (21:41 -0500)]
[OpenMP][Libomptarget][NFC] Use CMake Variables

This patchs adds CMake variables to add subdirectories and include
directories for libomptarget and explicitly gives the location of source
files.

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

3 years ago[CSSPGO] Consume pseudo-probe-based AutoFDO profile
Hongtao Yu [Wed, 16 Dec 2020 20:54:50 +0000 (12:54 -0800)]
[CSSPGO] Consume pseudo-probe-based AutoFDO profile

This change enables pseudo-probe-based sample counts to be consumed by the sample profile loader under the regular `-fprofile-sample-use` switch with minimal adjustments to the existing sample file formats. After the counts are imported, a probe helper, aka, a `PseudoProbeManager` object, is automatically launched to verify the CFG checksum of every function in the current compilation against the corresponding checksum from the profile. Mismatched checksums will cause a function profile to be slipped. A `SampleProfileProber` pass is scheduled before any of the `SampleProfileLoader` instances so that the CFG checksums as well as probe mappings are available during the profile loading time. The `PseudoProbeManager` object is set up right after the profile reading is done. In the future a CFG-based fuzzy matching could be done in `PseudoProbeManager`.

Samples will be applied only to pseudo probe instructions as well as probed callsites once the checksum verification goes through. Those instructions are processed in the same way that regular instructions would be processed in the line-number-based scenario. In other words, a function is processed in a regular way as if it was reduced to just containing pseudo probes (block probes and callsites).

**Adjustment to profile format **

A CFG checksum field is being added to the existing AutoFDO profile formats. So far only the text format and the extended binary format are supported. For the text format, a new line like
```
!CFGChecksum: 12345
```
is added to the end of the body sample lines. For the extended binary profile format, we introduce a metadata section to store the checksum map from function names to their CFG checksums.

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

3 years ago[MBP] Add whole chain to BlockFilterSet instead of individual BB
Guozhi Wei [Wed, 16 Dec 2020 23:42:08 +0000 (15:42 -0800)]
[MBP] Add whole chain to BlockFilterSet instead of individual BB

Currently we add individual BB to BlockFilterSet if its frequency satisfies

  LoopFreq / Freq <= LoopToColdBlockRatio

LoopFreq is edge frequency from outside to loop header.
LoopToColdBlockRatio is a command line parameter.

It doesn't make sense since we always layout whole chain, not individual BBs.

It may also cause a tricky problem. Sometimes it is possible that the LoopFreq
of an inner loop is smaller than LoopFreq of outer loop. So a BB can be in
BlockFilterSet of inner loop, but not in BlockFilterSet of outer loop,
like .cold in the test case. So it is added to the chain of inner loop. When
work on the outer loop, .cold is not added to BlockFilterSet, so the edge to
successor .problem is not counted in UnscheduledPredecessors of .problem chain.
But other blocks in the inner loop are added BlockFilterSet, so the whole inner
loop chain can be layout, and markChainSuccessors is called to decrease
UnscheduledPredecessors of following chains. markChainSuccessors calls
markBlockSuccessors for every BB, even it is not in BlockFilterSet, like .cold,
so .problem chain's UnscheduledPredecessors is decreased, but this edge was not
counted on in fillWorkLists, so .problem chain's UnscheduledPredecessors
becomes 0 when it still has an unscheduled predecessor .pred! And it causes
problems in following various successor BB selection algorithms.

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

3 years agoDisable Jump Threading for the targets with divergent control flow
alex-t [Tue, 15 Dec 2020 16:05:56 +0000 (19:05 +0300)]
Disable Jump Threading for the targets with divergent control flow

Details: Jump Threading does not make sense for the targets with divergent CF
         since they do not use branch prediction for speculative execution.
         Also in the high level IR there is no enough information to conclude that the branch is divergent or uniform.
         This may cause errors in further CF lowering.

Reviewed By: rampitec

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

3 years ago[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.
Tom Roeder [Wed, 2 Dec 2020 01:23:55 +0000 (17:23 -0800)]
[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter. Additionally, this change adds support for structural
equivalence of _Generic in the AST.

Reviewed By: martong, aaron.ballman

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

3 years agoTest commit: add valid punctuation to a comment. NFC.
Tom Roeder [Wed, 16 Dec 2020 22:58:22 +0000 (14:58 -0800)]
Test commit: add valid punctuation to a comment. NFC.

3 years ago[IR] Fixed the typo in attributes test
Gulfem Savrun Yeniceri [Wed, 16 Dec 2020 23:05:35 +0000 (15:05 -0800)]
[IR] Fixed the typo in attributes test

Fixed the typo introduced in D90275.

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

3 years ago[X86] Avoid %fs:(%eax) references in x32 mode
Harald van Dijk [Wed, 16 Dec 2020 22:39:57 +0000 (22:39 +0000)]
[X86] Avoid %fs:(%eax) references in x32 mode

The ABI explains that %fs:(%eax) zero-extends %eax to 64 bits, and adds
that the TLS base address, but that the TLS base address need not be
at the start of the TLS block, TLS references may use negative offsets.

Reviewed By: RKSimon

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

3 years ago[Test] Fix undef var in catch-undef-behavior.c
Thomas Preud'homme [Tue, 15 Dec 2020 23:05:45 +0000 (23:05 +0000)]
[Test] Fix undef var in catch-undef-behavior.c

Commit 9e52c43090f8cd980167bbd2719878ae36bcf6b5 removed the directive
defining LINE_1600 but left a string substitution to that variable in a
CHECK-NOT directive. This will make that CHECK-NOT directive always fail
to match, no matter the string.

This commit follows the pattern done in
9e52c43090f8cd980167bbd2719878ae36bcf6b5 of simplifying the CHECK-NOT to
only look for the function name and the opening parenthesis, thereby not
requiring the LINE_1600 variable.

Reviewed By: rnk

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

3 years agoRevert "[mlir] Lookup the latest value with a legal type when remapping values."
Alexander Belyaev [Wed, 16 Dec 2020 22:09:04 +0000 (23:09 +0100)]
Revert "[mlir] Lookup the latest value with a legal type when remapping values."

This reverts commit f8184d4c44dff1fab13122221f0c23ab50936647.

3 years agoImprove the verifier diagnostic on dominance error
Mehdi Amini [Wed, 16 Dec 2020 04:18:41 +0000 (04:18 +0000)]
Improve the verifier diagnostic on dominance error

Address PR47937

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

3 years ago[SimplifyCFG] Teach mergeEmptyReturnBlocks() to preserve DomTree
Roman Lebedev [Wed, 16 Dec 2020 20:04:41 +0000 (23:04 +0300)]
[SimplifyCFG] Teach mergeEmptyReturnBlocks() to preserve DomTree

A first real transformation that didn't already knew how to do that,
but it's pretty tame - either change successor of all the predecessors
of a block and carefully delay deletion of the block until afterwards
the DomTree updates are appled, or add a successor to the block.

There wasn't a great test coverage for this, so i added extra, to be sure.

3 years ago[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve...
Roman Lebedev [Wed, 16 Dec 2020 21:11:42 +0000 (00:11 +0300)]
[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.

3 years ago[SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree
Roman Lebedev [Wed, 16 Dec 2020 19:34:05 +0000 (22:34 +0300)]
[SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.

3 years ago[SimplifyCFG] removeUnreachableBlocks() already knows how to preserve DomTree
Roman Lebedev [Wed, 16 Dec 2020 18:48:29 +0000 (21:48 +0300)]
[SimplifyCFG] removeUnreachableBlocks() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Apparently, there were no dedicated tests just for that functionality,
so i'm adding one here.

3 years ago[NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate...
Roman Lebedev [Wed, 16 Dec 2020 18:26:43 +0000 (21:26 +0300)]
[NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such

First step after e1133179587dd895962a2fe4d6eb0cb1e63b5ee2,
in these tests, DomTree is valid afterwards, so mark them as such,
so that they don't regress.

In further steps, SimplifyCFG transforms shall taught to preserve DomTree,
in as small steps as possible.

3 years ago[AArch64InstPrinter] Use * 4096 instead of << 12
Fangrui Song [Wed, 16 Dec 2020 22:02:25 +0000 (14:02 -0800)]
[AArch64InstPrinter] Use * 4096 instead of << 12

Left shirting a negative integer is undefined before C++20.

3 years ago[libc++] Fix CI Dockerfile
Louis Dionne [Wed, 16 Dec 2020 22:00:09 +0000 (17:00 -0500)]
[libc++] Fix CI Dockerfile

Installing clang-format-11 doesn't seem to work if it's done before
we've installed LLVM. I must admit I didn't try to get to the bottom
of the issue, since installing it after seems to work.

3 years agoFix split-debug.c test on Windows
Reid Kleckner [Wed, 16 Dec 2020 21:48:47 +0000 (13:48 -0800)]
Fix split-debug.c test on Windows

3 years ago[PGO] Use the sum of profile counts to fix the function entry count
Rong Xu [Wed, 16 Dec 2020 21:11:59 +0000 (13:11 -0800)]
[PGO] Use the sum of profile counts to fix the function entry count

Raw profile count values for each BB are not kept after profile
annotation. We record function entry count and branch weights
and use them to compute the count when needed.  This mechanism
works well in a perfect world, but often breaks in real programs,
because of number prevision, inconsistent profile, or bugs in
BFI). This patch uses sum of profile count values to fix
function entry count to make the BFI count close to real profile
counts.

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

3 years ago[libc++] Install git-clang-format on CI nodes.
Marek Kurdej [Wed, 16 Dec 2020 21:33:10 +0000 (16:33 -0500)]
[libc++] Install git-clang-format on CI nodes.

Two problems fixed:
* an old version of clang-format get installed by default (6.0).
* git-clang-format is not present, only git-clang-format-<version> (e.g. git-clang-format-6.0).

Solution:
* install clang-format-11 with explicit version
* make symlink git-clang-format to the latest version of git-clang-format-<version>

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

3 years agoFix XCore test on Windows, the register order is reversed, for reasons unknown
Reid Kleckner [Wed, 16 Dec 2020 21:33:06 +0000 (13:33 -0800)]
Fix XCore test on Windows, the register order is reversed, for reasons unknown

3 years ago[VectorCombine] adjust test alignments for better coverage; NFC
Sanjay Patel [Wed, 16 Dec 2020 21:13:55 +0000 (16:13 -0500)]
[VectorCombine] adjust test alignments for better coverage; NFC

3 years ago[libc++abi] Remove redundant null pointer check in operator delete
Fangrui Song [Wed, 16 Dec 2020 21:29:40 +0000 (13:29 -0800)]
[libc++abi] Remove redundant null pointer check in operator delete

Similar to D52401. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).

C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function

    If ptr is a null pointer, no action shall occur.

free on MSDN:

    If memblock is NULL, the pointer is ignored and free immediately returns.

Reviewed By: #libc_abi, ldionne

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

3 years ago[DSE] Pass MemoryLocation by const ref (NFC)
Nikita Popov [Wed, 16 Dec 2020 20:34:47 +0000 (21:34 +0100)]
[DSE] Pass MemoryLocation by const ref (NFC)

3 years ago[NFC] Remove unused prefixes in llvm/test/CodeGen/X86
Mircea Trofin [Tue, 15 Dec 2020 17:00:05 +0000 (09:00 -0800)]
[NFC] Remove unused prefixes in llvm/test/CodeGen/X86

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

3 years ago[VectorCombine] optimize alignment for load transform
Sanjay Patel [Wed, 16 Dec 2020 19:22:46 +0000 (14:22 -0500)]
[VectorCombine] optimize alignment for load transform

Here's another minimal step suggested by D93229 / D93397 .
(I'm trying to be extra careful in these changes because
load transforms are easy to get wrong.)

We can optimistically choose the greater alignment of a
load and its pointer operand. As the test diffs show, this
can improve what would have been unaligned vector loads
into aligned loads.

When we enhance with gep offsets, we will need to adjust
the alignment calculation to include that offset.

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

3 years agoPrint source location in the error message when parens are missing around sizeof...
Shivanshu Goyal [Wed, 16 Dec 2020 20:01:54 +0000 (12:01 -0800)]
Print source location in the error message when parens are missing around sizeof typename and the expression is inside macro expansion

Given the following code:

```
void Foo(int);

void Baz()
{
Bar(sizeof int);
}
```

The error message which is printed today is this:
```
error: expected parentheses around type name in sizeof expression
```

There is no source location printed whatsoever, so fixing a compile break like this becomes extremely hard in a large codebase.

My change improves the error message. But it doesn't output a FixItHint because I wasn't able to figure out how to get the locations for left and right parens. So any tips would be appreciated.

```
<source>:7:6: error: expected parentheses around type name in sizeof expression
        Bar(sizeof int);
            ^
```

Reviewed By: rsmith

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

3 years agoPR47474: Add test for Clang's current behavior.
Richard Smith [Wed, 16 Dec 2020 19:59:57 +0000 (11:59 -0800)]
PR47474: Add test for Clang's current behavior.

Our current behavior rejects the example, following the current language
rules, but it's likely the rules will be revised to allow this example.

3 years ago[sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists.
Mitch Phillips [Wed, 16 Dec 2020 19:57:55 +0000 (11:57 -0800)]
[sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists.

Fix-forward for D93352.

Slight rework of the same idea, pickup the external symbolizer from the
binary directory iff it exists.

3 years ago[clang-offload-bundler] Add option -allow-missing-bundles
Yaxun (Sam) Liu [Thu, 10 Dec 2020 21:30:24 +0000 (16:30 -0500)]
[clang-offload-bundler] Add option -allow-missing-bundles

There are out-of-tree tools using clang-offload-bundler to extract
bundles from bundled files. When a bundle is not in the bundled
file, clang-offload-bundler is expected to emit an error message
and return non-zero value. However currently clang-offload-bundler
silently generates empty file for the missing bundles.

Since OpenMP/HIP toolchains expect the current behavior, an option
-allow-missing-bundles is added to let clang-offload-bundler
create empty file when a bundle is missing when unbundling.
The unbundling job action is updated to use this option by
default.

clang-offload-bundler itself will emit error when a bundle
is missing when unbundling by default.

Changes are also made to check duplicate targets in -targets
option and emit error.

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

3 years agoMark implicit coroutine variables as being implicit
Emma Blink [Wed, 16 Dec 2020 19:42:07 +0000 (14:42 -0500)]
Mark implicit coroutine variables as being implicit

This prevents the clang-tidy readability-identifier-naming check from
triggering on implicit __coro_gro and __promise variables in coroutines.

3 years ago[mlir] Async: re-enable tests after fixing fkakines
Eugene Zhulenev [Wed, 16 Dec 2020 10:17:53 +0000 (02:17 -0800)]
[mlir] Async: re-enable tests after fixing fkakines

Test flakiness was fixed by: https://github.com/llvm/llvm-project/commit/9edcedf7f222ce7c893d1e3bf19b3a7a1f0f2218

Runs these tests to verify that all parts of the lowering work correctly.

Reviewed By: mehdi_amini

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

3 years ago[mlir] AsyncRuntime: mode runtime declarations to mlir::runtime namespace
Eugene Zhulenev [Wed, 16 Dec 2020 13:14:12 +0000 (05:14 -0800)]
[mlir] AsyncRuntime: mode runtime declarations to mlir::runtime namespace

Define Async runtime related typedefs in the `mlir::runtime` namespace.

Reviewed By: mehdi_amini

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

3 years ago[flang] Handle undeclared names in EQUIVALENCE statements
Peter Steinfeld [Tue, 15 Dec 2020 22:44:22 +0000 (14:44 -0800)]
[flang] Handle undeclared names in EQUIVALENCE statements

Names in EQUIVALENCE statements are only allowed to indicate local
objects as per 19.5.1.4, paragraph 2, item (10).  Thus, a name appearing
in an EQUIVALENCE statement with no corresponding declaration in the
same scope is an implicit declaration of the name.  If that scope
contains an IMPLICIT NONE, it's an error.

I implemented this by adding a state variable to ScopeHandler to
indicate if we're resolving the names in an EQUIVALENCE statement and
then checked this state when resolving names.  I also added a test to
the existing tests for EQUIVALENCE statements.

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

3 years ago[lldb][NFC] Apply performance-faster-string-find (`str.find("X")` -> `str.find('x')`)
Jordan Rupprecht [Wed, 16 Dec 2020 18:53:18 +0000 (10:53 -0800)]
[lldb][NFC] Apply performance-faster-string-find (`str.find("X")` -> `str.find('x')`)

3 years ago[SimplifyCFG] Precommit test for preserving !annotation.
Florian Hahn [Wed, 16 Dec 2020 16:51:14 +0000 (16:51 +0000)]
[SimplifyCFG] Precommit test for preserving !annotation.

3 years ago[Go] Fix bindings/go/llvm/IRBindings.cpp
Fangrui Song [Wed, 16 Dec 2020 18:09:58 +0000 (10:09 -0800)]
[Go] Fix bindings/go/llvm/IRBindings.cpp

3 years ago[mlir] Fix for gpu-async-region pass.
Christian Sigg [Tue, 15 Dec 2020 20:15:28 +0000 (21:15 +0100)]
[mlir] Fix for gpu-async-region pass.

- the !gpu.async.token is the second result of 'gpu.alloc async', not the first.
- async.execute construction takes operand types not yet wrapped in !async.value.
- fix typo

Reviewed By: herhut

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

3 years ago[gn build] Port 6eff12788ee
LLVM GN Syncbot [Wed, 16 Dec 2020 17:38:06 +0000 (17:38 +0000)]
[gn build] Port 6eff12788ee

3 years ago[DDG] Data Dependence Graph - DOT printer - recommit
Bardia Mahjour [Wed, 16 Dec 2020 17:34:38 +0000 (12:34 -0500)]
[DDG] Data Dependence Graph - DOT printer - recommit

This is being recommitted to try and address the MSVC complaint.

This patch implements a DDG printer pass that generates a graph in
the DOT description language, providing a more visually appealing
representation of the DDG. Similar to the CFG DOT printer, this
functionality is provided under an option called -dot-ddg and can
be generated in a less verbose mode under -dot-ddg-only option.

Reviewed By: Meinersbur

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

3 years agoRemove spurious MLIRLLVMConversionsIncGen dependency from LLVM Dialect (NFC)
Mehdi Amini [Wed, 16 Dec 2020 17:31:22 +0000 (17:31 +0000)]
Remove spurious MLIRLLVMConversionsIncGen dependency from LLVM Dialect (NFC)

Reviewed By: ftynse

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

3 years ago[VectorCombine] loosen alignment constraint for load transform
Sanjay Patel [Wed, 16 Dec 2020 17:11:57 +0000 (12:11 -0500)]
[VectorCombine] loosen alignment constraint for load transform

As discussed in D93229, we only need a minimal alignment constraint
when querying whether a hypothetical vector load is safe. We still
pass/use the potentially stronger alignment attribute when checking
costs and creating the new load.

There's already a test that changes with the minimum code change,
so splitting this off as a preliminary commit independent of any
gep/offset enhancements.

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

3 years ago[AArch64InstPrinter] Change printADRPLabel to print the target address in hexadecimal...
Fangrui Song [Wed, 16 Dec 2020 17:20:55 +0000 (09:20 -0800)]
[AArch64InstPrinter] Change printADRPLabel to print the target address in hexadecimal form

Similar to D77853. Change ADRP to print the target address in hex, instead of the raw immediate.
The behavior is similar to GNU objdump but we also include `0x`.

Note: GNU objdump is not consistent whether or not to emit `0x` for different architectures. We try emitting 0x consistently for all targets.

```
GNU objdump:       adrp x16, 10000000
Old llvm-objdump:  adrp x16, #0
New llvm-objdump:  adrp x16, 0x10000000
```

`adrp Xd, 0x...` assembles to a relocation referencing `*ABS*+0x10000` which is not intended. We need to use a linker or use yaml2obj.
The main test is `test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml`

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

3 years agoRevert "[PowerPC] Extend folding RLWINM + RLWINM to post-RA."
Esme-Yi [Wed, 16 Dec 2020 17:12:24 +0000 (17:12 +0000)]
Revert "[PowerPC] Extend folding RLWINM + RLWINM to post-RA."

This reverts commit 1c0941e1524f499e3fbde48fc3bdd0e70fc8f2e4.

3 years ago[LoopNest] Handle loop-nest passes in LoopPassManager
Whitney Tsang [Wed, 16 Dec 2020 17:05:44 +0000 (17:05 +0000)]
[LoopNest] Handle loop-nest passes in LoopPassManager

Per http://llvm.org/OpenProjects.html#llvm_loopnest, the goal of this
patch (and other following patches) is to create facilities that allow
implementing loop nest passes that run on top-level loop nests for the
New Pass Manager.

This patch extends the functionality of LoopPassManager to handle
loop-nest passes by specializing the definition of LoopPassManager that
accepts both kinds of passes in addPass.

Only loop passes are executed if L is not a top-level one, and both
kinds of passes are executed if L is top-level. Currently, loop nest
passes should have the following run method:

PreservedAnalyses run(LoopNest &, LoopAnalysisManager &,
LoopStandardAnalysisResults &, LPMUpdater &);

Reviewed By: Whitney, ychen
Differential Revision: https://reviews.llvm.org/D87045

3 years ago[NFC] Use regex for code object version in hip tests
Jon Chesterfield [Wed, 16 Dec 2020 17:00:18 +0000 (17:00 +0000)]
[NFC] Use regex for code object version in hip tests

[NFC] Use regex for code object version in hip tests

Extracted from D93258. Makes tests robust to changes in default
code object version.

Reviewed By: t-tye

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

3 years ago[ELF] --emit-relocs: fix a crash if .rela.dyn is an empty output section
Fangrui Song [Wed, 16 Dec 2020 16:59:38 +0000 (08:59 -0800)]
[ELF] --emit-relocs: fix a crash if .rela.dyn is an empty output section

Fix PR48357: If .rela.dyn appears as an output section description, its type may
be SHT_RELA (due to the empty synthetic .rela.plt) while there is no input
section. The empty .rela.dyn may be retained due to a reference in a linker
script. Don't crash.

Reviewed By: grimar

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

3 years ago[libomptarget][nfc] Replace static const with enum
Jon Chesterfield [Wed, 16 Dec 2020 16:40:21 +0000 (16:40 +0000)]
[libomptarget][nfc] Replace static const with enum

[libomptarget][nfc] Replace static const with enum

Semantically identical. Replaces 0xff... with ~0 to spare counting the f.
Has the advantage that the compiler doesn't need to prove the 4/8 byte
value dead before discarding it, and sidesteps the compilation question
associated with what static means for a single source language.

Reviewed By: jdoerfert

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

3 years ago[CMake] Avoid __FakeVCSRevision.h with no git repository
Jonas Hahnfeld [Sat, 5 Dec 2020 11:52:38 +0000 (12:52 +0100)]
[CMake] Avoid __FakeVCSRevision.h with no git repository

Set the return variable to "" in find_first_existing_vc_file to
say that there is a repository, but no file to depend on. This works
transparently for all other callers that handle undefinedness and
equality to an empty string the same way.

Use the knowledge to avoid depending on __FakeVCSRevision.h if there
is no git repository at all (for example when building a release) as
there is no point in regenerating an empty VCSRevision.h.

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

3 years ago[flang] Fix crash in folding (#48437)
peter klausler [Tue, 15 Dec 2020 18:59:26 +0000 (10:59 -0800)]
[flang] Fix crash in folding (#48437)

Elemental intrinsic function folding was not taking the lower
bounds of constant array arguments into account; these lower bounds
can be distinct from 1 when named constants appear as arguments.

LLVM bugzilla #48437.

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

3 years ago[Doc][SystemZ] Add Linux/SystemZ to Getting Started guide.
Kai Nacke [Wed, 16 Dec 2020 11:01:08 +0000 (06:01 -0500)]
[Doc][SystemZ] Add Linux/SystemZ to Getting Started guide.

The Linux/SystemZ platform is missing in the Getting Started guide
as platform on which LLVM is known to work.

Reviewed by: uweigand

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

3 years ago[InstCombine] Precommit tests for !annotation metadata handling.
Florian Hahn [Wed, 16 Dec 2020 11:30:01 +0000 (11:30 +0000)]
[InstCombine] Precommit tests for !annotation metadata handling.

3 years agoLangRef: Update byval/sret description for required types
Matt Arsenault [Wed, 16 Dec 2020 15:25:07 +0000 (10:25 -0500)]
LangRef: Update byval/sret description for required types

3 years ago[flang] Handle multiple names for same operator
Tim Keith [Wed, 16 Dec 2020 15:06:53 +0000 (07:06 -0800)]
[flang] Handle multiple names for same operator

Some operators have more than one name, e.g. operator(==), operator(.eq).
That was working correctly in generic definitions but they can also
appear in other contexts: USE statements and access statements, for
example.

This changes FindInScope to always look for each of the names for
a symbol. So an operator may be use-associated under one name but
declared private under another name and it will be the same symbol.
This replaces GenericSpecInfo::FindInScope which was only usable in
some cases.

Add a version of FindInScope() that looks in the current scope to
simplify many of the calls.

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

3 years agoNFC: balance a quote in AttrDocs.td
Erik Pilkington [Tue, 15 Dec 2020 22:01:20 +0000 (17:01 -0500)]
NFC: balance a quote in AttrDocs.td

This was confusing my editor.

3 years ago[Sema] Fix a miscompile by retaining array qualifiers when folding VLAs to constant...
Erik Pilkington [Tue, 15 Dec 2020 22:00:20 +0000 (17:00 -0500)]
[Sema] Fix a miscompile by retaining array qualifiers when folding VLAs to constant arrays

rdar://72243125

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

3 years ago[TableGen] Slim down the data structures in xxxGenInstrInfo.inc, step 1
Paul C. Anagnostopoulos [Fri, 11 Dec 2020 21:19:52 +0000 (16:19 -0500)]
[TableGen] Slim down the data structures in xxxGenInstrInfo.inc, step 1

3 years ago[X86] Regenerate bit extraction tests, cleaning up check-prefixes.
Simon Pilgrim [Wed, 16 Dec 2020 14:42:08 +0000 (14:42 +0000)]
[X86] Regenerate bit extraction tests, cleaning up check-prefixes.

As noticed on D92965, we needed to simplify the prefixes to ensure all RUNs were properly covered.

We should never have a target with BMI2 without BMI1, so use that as the 'BMI level' and then check with/without TBM (all TBM targets have at least BMI1).

3 years ago[X86] Rename reduction combiners to make it clearer whats happening. NFCI.
Simon Pilgrim [Wed, 16 Dec 2020 13:31:10 +0000 (13:31 +0000)]
[X86] Rename reduction combiners to make it clearer whats happening. NFCI.

Since these are all working on reduction patterns, actually use that term in the function name to make them easier to search for.

At some point we're likely to start working with the ISD::VECREDUCE_* opcodes directly in the x86 backend, but that is still some way off.

3 years ago[sanitizer-common] Force pickup of llvm-symbolizer from new binaries.
Mitch Phillips [Wed, 16 Dec 2020 14:36:22 +0000 (06:36 -0800)]
[sanitizer-common] Force pickup of llvm-symbolizer from new binaries.

It's possible currently that the sanitizer runtimes when testing grab
the path to the symbolizer through *SAN_SYMBOLIZER_PATH=...

This can be polluted by things like Android's setup script. This patch
forces external_symbolizer_path=$new_build_out_dir/llvm-symbolizer when
%env_tool_options is used.

Reviewed By: vitalybuka

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

3 years ago[XCOFF][AIX] Emit EH information in traceback table
diggerlin [Wed, 16 Dec 2020 14:34:59 +0000 (09:34 -0500)]
[XCOFF][AIX] Emit EH information in traceback table

SUMMARY:

In order for the runtime on AIX to find the compact unwind section(EHInfo table),
we would need to set the following on the traceback table:

The 6th byte's longtbtable field to true to signal there is an Extended TB Table Flag.
The Extended TB Table Flag to be 0x08 to signal there is an exception handling info presents.
Emit the offset between ehinfo TC entry and TOC base after all other optional portions of traceback table.

The patch is authored by Jason Liu.

Reviewers: David Tenty, Digger Lin
Differential Revision: https://reviews.llvm.org/D92766