platform/upstream/llvm.git
3 years ago[mlir] Add include guard to TOSA tblgen passes
Marius Brehler [Wed, 19 May 2021 19:40:52 +0000 (19:40 +0000)]
[mlir] Add include guard to TOSA tblgen passes

Reviewed By: sjarus, stellaraccident

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

3 years ago[Reland] [mlir] Speed up Lexer::getEncodedSourceLocation
River Riddle [Wed, 19 May 2021 19:45:24 +0000 (12:45 -0700)]
[Reland] [mlir] Speed up Lexer::getEncodedSourceLocation

Reland Note: This was accidentally reverted in 80d981eda69f1ada6d944ed89571456cad13b850, but is an important improvement even outside of the driving motivator in D102567.

We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.

3 years ago[OpaquePtr] Make atomicrmw work with opaque pointers
Arthur Eubanks [Wed, 19 May 2021 17:37:17 +0000 (10:37 -0700)]
[OpaquePtr] Make atomicrmw work with opaque pointers

FullTy is only necessary when we need to figure out what type an
instruction works with given a pointer's pointee type. However, we just
end up using the value operand's type, so FullTy isn't necessary.

Reviewed By: dblaikie

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

3 years ago[OpaquePtr] Make cmpxchg work with opaque pointers
Arthur Eubanks [Wed, 19 May 2021 04:03:25 +0000 (21:03 -0700)]
[OpaquePtr] Make cmpxchg work with opaque pointers

Reviewed By: dblaikie

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

3 years ago[PDB] Do not record PGO or coverage public symbols
Reid Kleckner [Thu, 13 May 2021 21:42:18 +0000 (14:42 -0700)]
[PDB] Do not record PGO or coverage public symbols

These symbols are long, and they tend to cause the PDB file size to
overflow. They are generally not necessary when debugging problems in
user code.

This change reduces the size of chrome.dll.pdb with coverage from
6,937,108,480 bytes to 4,690,210,816 bytes.

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

3 years ago[OpaquePtr] Make GEPs work with opaque pointers
Arthur Eubanks [Tue, 18 May 2021 22:23:00 +0000 (15:23 -0700)]
[OpaquePtr] Make GEPs work with opaque pointers

No verifier changes needed, the verifier currently doesn't check that
the pointer operand's pointee type matches the GEP type. There is a
similar check in GetElementPtrInst::Create() though.

Reviewed By: dblaikie

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

3 years ago[lldb] Fix UB in half2float and add some more tests.
Raphael Isemann [Wed, 19 May 2021 19:35:24 +0000 (21:35 +0200)]
[lldb] Fix UB in half2float and add some more tests.

The added DumpDataExtractorTest uncovered that this is lshifting a negative
integer which upsets ubsan and breaks the sanitizer bot. This patch just
changes the variable we shift to be unsigned and adds a bunch of tests to make
sure this function does what it promises.

3 years ago[clang][ObjC] Allow different availability annotation on a method
Alex Lorenz [Fri, 14 May 2021 03:16:54 +0000 (20:16 -0700)]
[clang][ObjC] Allow different availability annotation on a method
when implementing an optional protocol requirement

When an Objective-C method implements an optional protocol requirement,
allow the method to use a newer introduced or older obsoleted
availability version than what's specified on the method in the protocol
itself. This allows SDK adopters to adopt an optional method from a
protocol later than when the method is introduced in the protocol. The users
that call an optional method on an object that conforms to this protocol
are supposed to check whether the object implements the method or not,
so a lack of appropriate `if (@available)` check for a new OS version
is not a cause of concern as there's already another runtime check that's required.

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

3 years ago[Diagnostics] Allow emitting analysis and missed remarks on functions
Joseph Huber [Wed, 19 May 2021 16:19:50 +0000 (12:19 -0400)]
[Diagnostics] Allow emitting analysis and missed remarks on functions

Summary:
Currently, only `OptimizationRemarks` can be emitted using a Function.
Add constructors to allow this for `OptimizationRemarksAnalysis` and
`OptimizationRemarkMissed` as well.

Reviewed By: jdoerfert thegameg

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

3 years ago[x86] add tests for fma folds with fast-math-flags; NFC
Sanjay Patel [Wed, 19 May 2021 18:28:57 +0000 (14:28 -0400)]
[x86] add tests for fma folds with fast-math-flags; NFC

Part of prep work for D90901

3 years ago[x86] propagate FMF from x86-specific intrinsic nodes to others during combining
Sanjay Patel [Wed, 19 May 2021 18:21:20 +0000 (14:21 -0400)]
[x86] propagate FMF from x86-specific intrinsic nodes to others during combining

This is another FMF gap exposed by D90901, but I don't see a way
to show the difference in a regression test as with:
f66ba4c
6025663

We will see an asm difference if we add a test as part of D90901.

3 years ago[lld/mac] Remove dead declaration
Nico Weber [Wed, 19 May 2021 18:17:52 +0000 (14:17 -0400)]
[lld/mac] Remove dead declaration

3 years ago[libcxx][ranges] adds concept `sized_range` and cleans up `ranges::size`
Christopher Di Bella [Thu, 13 May 2021 19:34:06 +0000 (19:34 +0000)]
[libcxx][ranges] adds concept `sized_range` and cleans up `ranges::size`

* adds `sized_range` and conformance tests
* moves `disable_sized_range` into namespace `std::ranges`
* removes explicit type parameter

Implements part of P0896 'The One Ranges Proposal'.

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

3 years ago[MCA] Unbreak the buildbots by passing flag -mcpu=generic to the new test added by...
Andrea Di Biagio [Wed, 19 May 2021 18:03:13 +0000 (19:03 +0100)]
[MCA] Unbreak the buildbots by passing flag -mcpu=generic to the new test added by commit e5d59db469.

This should unbreak buildbot clang-ppc64le-linux-lnt.

3 years ago[libcxx][iterator][nfc] acquires lock for working on [range.iter.ops]
Christopher Di Bella [Tue, 4 May 2021 16:32:10 +0000 (16:32 +0000)]
[libcxx][iterator][nfc] acquires lock for working on [range.iter.ops]

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

3 years ago[x86] update fma test with deprecated intrinsics; NFC
Sanjay Patel [Wed, 19 May 2021 17:51:03 +0000 (13:51 -0400)]
[x86] update fma test with deprecated intrinsics; NFC

Similar to 8854b27 -

All of the CHECK lines should be identical to before,
but without any of the x86-specific calls that were
replaced with generic FMA long ago.

The file still has value because it shows a miscompile
as demonstrated in D90901, but we probably need to
add tests with FMF to make that explicit without
losing coverage.

3 years ago[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment
Stephen Neuendorffer [Tue, 13 Apr 2021 19:34:28 +0000 (12:34 -0700)]
[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment

vector.transfer_read and vector.transfer_write operations are converted
to llvm intrinsics with specific alignment information, however there
doesn't seem to be a way in llvm to take information from llvm.assume
intrinsics and change this alignment information.  In any
event, due the to the structure of the llvm.assume instrinsic, applying
this information at the llvm level is more cumbersome.  Instead, let's
generate the masked vector load and store instrinsic with the right
alignment information from MLIR in the first place.  Since
we're bothering to do this, lets just emit the proper alignment for
loads, stores, scatter, and gather ops too.

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

3 years ago[CoverageMapping] Handle gaps in counter IDs for source-based coverage
Pirama Arumuga Nainar [Mon, 3 May 2021 18:57:14 +0000 (11:57 -0700)]
[CoverageMapping] Handle gaps in counter IDs for source-based coverage

For source-based coverage, the frontend sets the counter IDs and the
constraints of counter IDs is not defined.  For e.g., the Rust frontend
until recently had a reserved counter #0
(https://github.com/rust-lang/rust/pull/83774).  Rust coverage
instrumentation also creates counters on edges in addition to basic
blocks.  Some functions may have more counters than regions.

This breaks an assumption in CoverageMapping.cpp where the number of
counters in a function is assumed to be bounded by the number of
regions:
  Counts.assign(Record.MappingRegions.size(), 0);

This assumption causes CounterMappingContext::evaluate() to fail since
there are not enough counter values created in the above call to
`Counts.assign`.  Consequently, some uncovered functions are not
reported in coverage reports.

This change walks a Function's CoverageMappingRecord to find the maximum
counter ID, and uses it to initialize the counter array when instrprof
records are missing for a function in sparse profiles.

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

3 years ago[NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): use DeleteDeadBlocks()
Roman Lebedev [Wed, 19 May 2021 17:26:33 +0000 (20:26 +0300)]
[NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): use DeleteDeadBlocks()

3 years ago[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
Roman Lebedev [Wed, 19 May 2021 16:53:48 +0000 (19:53 +0300)]
[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()

3 years ago[NFCI][Local] removeUnreachableBlocks(): use DeleteDeadBlocks()
Roman Lebedev [Wed, 19 May 2021 15:20:25 +0000 (18:20 +0300)]
[NFCI][Local] removeUnreachableBlocks(): use DeleteDeadBlocks()

3 years ago[MCA] llvm-mca MCTargetStreamer segfault fix
Patrick Holland [Wed, 19 May 2021 09:29:41 +0000 (10:29 +0100)]
[MCA] llvm-mca MCTargetStreamer segfault fix

In order to create the code regions for llvm-mca to analyze, llvm-mca creates an
AsmCodeRegionGenerator and calls AsmCodeRegionGenerator::parseCodeRegions().
Within this function, both an MCAsmParser and MCTargetAsmParser are created so
that MCAsmParser::Run() can be used to create the code regions for us.

These parser classes were created for llvm-mc so they are designed to emit code
with an MCStreamer and MCTargetStreamer that are expected to be setup and passed
into the MCAsmParser constructor. Because llvm-mca doesn’t want to emit any
code, an MCStreamerWrapper class gets created instead and passed into the
MCAsmParser constructor. This wrapper inherits from MCStreamer and overrides
many of the emit methods to just do nothing. The exception is the
emitInstruction() method which calls Regions.addInstruction(Inst).

This works well and allows llvm-mca to utilize llvm-mc’s MCAsmParser to build
our code regions, however there are a few directives which rely on the
MCTargetStreamer. llvm-mc assumes that the MCStreamer that gets passed into the
MCAsmParser’s constructor has a valid pointer to an MCTargetStreamer. Because
llvm-mca doesn’t setup an MCTargetStreamer, when the parser encounters one of
those directives, a segfault will occur.

In x86, each one of these 7 directives will cause this segfault if they exist in
the input assembly to llvm-mca:

.cv_fpo_proc
.cv_fpo_setframe
.cv_fpo_pushreg
.cv_fpo_stackalloc
.cv_fpo_stackalign
.cv_fpo_endprologue
.cv_fpo_endproc
I haven’t looked at other targets, but I wouldn’t be surprised if some of the
other ones also have certain directives which could result in this same
segfault.

My proposed solution is to simply initialize an MCTargetStreamer after we
initialize the MCStreamerWrapper. The MCTargetStreamer requires an ostream
object, but we don’t actually want any of these directives to be emitted
anywhere, so I use an ostream created with the nulls() function. Since this
needs to happen after the MCStreamerWrapper has been initialized, it needs to
happen within the AsmCodeRegionGenerator::parseCodeRegions() function. The
MCTargetStreamer also needs an MCInstPrinter which is easiest to initialize
within the main() function of llvm-mca. So this MCInstPrinter gets constructed
within main() then passed into the parseCodeRegions() function as a parameter.
(If you feel like it would be appropriate and possible to create the
MCInstPrinter within the parseCodeRegions() function, then feel free to modify
my solution. That would stop us from having to pass it into the function and
would limit its scope / lifetime.)

My solution stops the segfault from happening and still passes all of the
current (expected) llvm-mca tests. I also added a new test for x86 that checks
for this segfault on an input that includes one of the .cv_fpo directives (this
test fails without my solution, but passes with it).

As far as I can tell, all of the functions that I modified are only called from
within llvm-mca so there shouldn’t be any worries about breaking other tools.

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

3 years agoDo actual DCE in LoopUnroll (try 4)
Philip Reames [Wed, 19 May 2021 16:50:21 +0000 (09:50 -0700)]
Do actual DCE in LoopUnroll (try 4)

Turns out simplifyLoopIVs sometimes returns a non-dead instruction in it's DeadInsts out param.  I had done a bit of NFC cleanup which was only NFC if simplifyLoopIVs obeyed it's documentation.  I'm simplfy dropping that part of the change.

Commit message from try 3:

Recommitting after fixing a bug found post commit. Amusingly, try 1 had been correct, and by reverting to incorporate last minute review feedback, I introduce the bug. Oops. :)

Original commit message:

The problem was that recursively deleting an instruction can delete instructions beyond the current iterator (via a dead phi), thus invalidating iteration. Test case added in LoopUnroll/dce.ll to cover this case.

LoopUnroll does a limited DCE pass after unrolling, but if you have a chain of dead instructions, it only deletes the last one. Improve the code to recursively delete all trivially dead instructions.

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

3 years agoRevert "Reapply "[clang][deps] Support inferred modules""
Frederik Gossen [Wed, 19 May 2021 17:19:37 +0000 (19:19 +0200)]
Revert "Reapply "[clang][deps] Support inferred modules""

This reverts commit c98833cdaad01787ea70ecdfabb05a7e142a6671.
The test `ClangScanDeps/modules-inferred-explicit-build.m` creates files
in the current directory.

3 years ago[x86] propagate FMF from x86-specific intrinsic nodes to others during lowering
Sanjay Patel [Wed, 19 May 2021 16:40:09 +0000 (12:40 -0400)]
[x86] propagate FMF from x86-specific intrinsic nodes to others during lowering

This is another fast-math-flags failure exposed by D90901.

3 years ago[x86] add test check lines to demonstrate FMF propagation failure; NFC
Sanjay Patel [Wed, 19 May 2021 16:20:17 +0000 (12:20 -0400)]
[x86] add test check lines to demonstrate FMF propagation failure; NFC

3 years ago[ScalarEvolution] Remove unused ExitLimit::hasOperand() method (NFC)
Nikita Popov [Wed, 19 May 2021 16:41:27 +0000 (18:41 +0200)]
[ScalarEvolution] Remove unused ExitLimit::hasOperand() method (NFC)

We only use BackedgeTakenInfo::hasOperand().

3 years ago[profile] Skip mmap() if there are no counters
Vedant Kumar [Tue, 18 May 2021 23:35:21 +0000 (16:35 -0700)]
[profile] Skip mmap() if there are no counters

If there are no counters, an mmap() of the counters section would fail
due to the size argument being too small (EINVAL).

rdar://78175925

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

3 years agoRecommit "[GlobalISel] Simplify G_ICMP to true/false when the result is known"
Jessica Paquette [Wed, 19 May 2021 16:18:52 +0000 (09:18 -0700)]
Recommit "[GlobalISel] Simplify G_ICMP to true/false when the result is known"

Add missing REQUIRES line to
prelegalizer-combiner-icmp-to-true-false-known-bits.

3 years ago[CSSPGO] Overwrite branch weight annotated in previous pass.
Hongtao Yu [Mon, 17 May 2021 06:13:39 +0000 (23:13 -0700)]
[CSSPGO] Overwrite branch weight annotated in previous pass.

Sample profile loader can be run in both LTO prelink and postlink. Currently the counts annoation in postilnk doesn't fully overwrite what's done in prelink. I'm adding a switch (`-overwrite-existing-weights=1`) to enable a full overwrite, which includes:

1. Clear old metadata for calls when their parent block has a zero count. This could be caused by prelink code duplication.

2. Clear indirect call metadata if somehow all the rest targets have a sum of zero count.

3. Overwrite branch weight for basic blocks.

With a CS profile, I was seeing #1 and #2 help reduce code size by preventing post-sample ICP and CGSCC inliner working on obsolete metadata, which come from a partial global inlining in prelink.  It's not expected to work well for non-CS case with a less-accurate post-inline count quality.

It's worth calling out that some prelink optimizations can damage counts quality in an irreversible way. One example is the loop rotate optimization. Due to lack of exact loop entry count (profiling can only give loop iteration count and loop exit count), moving one iteration out of the loop body leaves the rest iteration count unknown. We had to turn off prelink loop rotate to achieve a better postlink counts quality. A even better postlink counts quality can be archived by turning off prelink CGSCC inlining which is not context-sensitive.

Reviewed By: wenlei, wmi

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

3 years agoRevert "Do actual DCE in LoopUnroll (try 3)"
Amy Huang [Wed, 19 May 2021 15:47:30 +0000 (08:47 -0700)]
Revert "Do actual DCE in LoopUnroll (try 3)"

This reverts commit b6320eeb8622f05e4a5d4c7f5420523357490fca
as it causes clang to assert; see
https://reviews.llvm.org/rGb6320eeb8622f05e4a5d4c7f5420523357490fca.

3 years ago[mlir][SCF] NFC - Drop SCF EDSC usage
Nicolas Vasilache [Wed, 19 May 2021 15:41:54 +0000 (15:41 +0000)]
[mlir][SCF] NFC - Drop SCF EDSC usage

Drop the SCF dialect EDSC subdirectory and update all uses.

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

3 years agoFix lld macho standalone build by including llvm/Config/llvm-config.h instead of...
Mariusz Ceier [Wed, 19 May 2021 15:07:39 +0000 (11:07 -0400)]
Fix lld macho standalone build by including llvm/Config/llvm-config.h instead of llvm/Config/config.h

lld/MachO/Driver.cpp and lld/MachO/SyntheticSections.cpp include
llvm/Config/config.h which doesn't exist when building standalone lld.

This patch replaces llvm/Config/config.h include with llvm/Config/llvm-config.h
just like it is in lld/ELF/Driver.cpp and HAVE_LIBXAR with LLVM_HAVE_LIXAR and
moves LLVM_HAVE_LIBXAR from config.h to llvm-config.h

Also it adds LLVM_HAVE_LIBXAR to LLVMConfig.cmake and links liblldMachO2.so
with XAR_LIB if LLVM_HAVE_LIBXAR is set.

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

3 years ago[VP] make getFunctionalOpcode return an Optional
Simon Moll [Wed, 19 May 2021 15:08:20 +0000 (17:08 +0200)]
[VP] make getFunctionalOpcode return an Optional

The operation of some VP intrinsics do/will not map to regular
instruction opcodes.  Returning 'None' seems more intuitive here than
'Instruction::Call'.

Reviewed By: frasercrmck

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

3 years ago[AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 1
Anirudh Prasad [Wed, 19 May 2021 15:05:00 +0000 (11:05 -0400)]
[AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 1

- This patch (is one in a series of patches) which introduces HLASM Parser support (for the first parameter of inline asm statements) to LLVM ([[ https://lists.llvm.org/pipermail/llvm-dev/2021-January/147686.html | main RFC here ]])
- This patch in particular introduces HLASM Parser support for Z machine instructions.
- The approach taken here was to subclass `AsmParser`, and make various functions and variables as "protected" wherever appropriate.
- The `HLASMAsmParser` class overrides the `parseStatement` function. Two new private functions `parseAsHLASMLabel` and `parseAsMachineInstruction` are introduced as well.

The general syntax is laid out as follows (more information available in [[ https://www.ibm.com/support/knowledgecenter/SSENW6_1.6.0/com.ibm.hlasm.v1r6.asm/asmr1023.pdf | HLASM V1R6 Language Reference Manual ]] - Chapter 2 - Instruction Statement Format):

```
<TokA><spaces.*><TokB><spaces.*><TokC><spaces.*><TokD>
```

1. TokA is referred to as the Name Entry. This token is optional
2. TokB is referred to as the Operation Entry. This token is mandatory.
3. TokC is referred to as the Operand Entry. This token is mandatory
4. TokD is referred to as the Remarks Entry. This token is optional

- If TokA is provided, then we either parse TokA as a possible comment or as a label (Name Entry), Tok B as the Operation Entry and so on.
- If TokA is not provided (i.e. we have one or more spaces and then the first token), then we will parse the first token (i.e TokB) as a possible Z machine instruction, TokC as the operands to the Z machine instruction and TokD as a possible Remark field
- TokC (Operand Entry), no spaces are allowed between OperandEntries. If a space occurs it is classified as an error.
- TokD if provided is taken as is, and emitted as a comment.

The following additional approach was examined, but not taken:

- Adding custom private only functions to base AsmParser class, and only invoking them for z/OS. While this would eliminate the need for another child class, these private functions would be of non-use to every other target. Similarly, adding any pure virtual functions to the base MCAsmParser class and overriding them in AsmParser would also have the same disadvantage.

Testing:

- This patch doesn't have tests added with it, for the sole reason that MCStreamer Support and Object File support hasn't been added for the z/OS target (yet). Hence, it's not possible generate code outright for the z/OS target. They are in the process of being committed / process of being worked on.

- Any comments / feedback on how to combat this "lack of testing" due to other missing required features is appreciated.

Reviewed By: Kai, uweigand

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

3 years ago[lldb] Enable TestCppBitfields on Windows
Andy Yankovsky [Wed, 19 May 2021 13:36:13 +0000 (15:36 +0200)]
[lldb] Enable TestCppBitfields on Windows

The test works correctly on Windows, the linked bug has been resolved.

Reviewed By: teemperor

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

3 years ago[clang][patch] Add support for option -fextend-arguments={32,64}: widen integer argum...
Melanie Blower [Wed, 19 May 2021 14:57:04 +0000 (10:57 -0400)]
[clang][patch] Add support for option -fextend-arguments={32,64}: widen integer arguments to int64 in unprototyped function calls

Reviewed By: Aaron Ballman

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

3 years agoReapply "[X86] Limit X86InterleavedAccessGroup to handle the same type case only"
Wang, Pengfei [Wed, 19 May 2021 10:01:11 +0000 (18:01 +0800)]
Reapply "[X86] Limit X86InterleavedAccessGroup to handle the same type case only"

The current implementation assumes the destination type of shuffle is the same as the decomposed ones. Add the check to avoid crush when the condition is not satisfied.

This fixes PR37616.

Reviewed By: RKSimon

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

3 years agoRevert rG528bc10e95d5f9d6a338f9bab5e91d7265d1cf05 : "[X86FixupLEAs] Transform the...
Simon Pilgrim [Wed, 19 May 2021 13:59:58 +0000 (14:59 +0100)]
Revert rG528bc10e95d5f9d6a338f9bab5e91d7265d1cf05 : "[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB"

Reports on D101970 indicate this is causing failures on multi-stage compiles.

3 years ago[lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used...
Jan Kratochvil [Wed, 19 May 2021 13:51:54 +0000 (15:51 +0200)]
[lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx).
In such case DW_AT_rnglists_base does not need to be present.
DWARF-5 spec:
        "If the offset_entry_count is zero, then DW_FORM_rnglistx cannot
        be used to access a range list; DW_FORM_sec_offset must be used
        instead. If the offset_entry_count is non-zero, then
        DW_FORM_rnglistx may be used to access a range list;"

This fix is for TestTypeCompletion.py category `dwarf` using GCC with DWARF-5.

The fix just provides GetRnglist() lazy getter for `m_rnglist_table`.
The testcase is easier to review by:
        diff -u lldb/test/Shell/SymbolFile/DWARF/DW_AT_low_pc-addrx.s \
          lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

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

3 years ago[nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base...
Jan Kratochvil [Wed, 19 May 2021 13:49:14 +0000 (15:49 +0200)]
[nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

Refactor code only for D98289.

Reviewed By: clayborg

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

3 years ago[X86][AVX] createVariablePermute - generalize the PR50356 fix for smaller indices...
Simon Pilgrim [Wed, 19 May 2021 13:13:41 +0000 (14:13 +0100)]
[X86][AVX] createVariablePermute - generalize the PR50356 fix for smaller indices vector as well

Generalize the fix from rGd0902a8665b1 by ensuring we widen/narrow the indices subvector first and then perform the ZERO_EXTEND_VECTOR_INREG (if necessary), which should allow us to perform the variable permutes with source/destination/indices vectors of any widths.

3 years ago[X86][Atom] Fix vector integer shift by immediate resource/throughputs
Simon Pilgrim [Wed, 19 May 2021 12:51:34 +0000 (13:51 +0100)]
[X86][Atom] Fix vector integer shift by immediate resource/throughputs

Match whats documented in the Intel AOM (and Agner/instlatx64 agree) - these are all Port0 only.

Now that we can use in-order models in llvm-mca, the atom model is a good "worst case scenario" analysis for x86.

3 years ago[mir][Python][linalg] Support OpDSL extensions in C++.
Tobias Gysi [Wed, 19 May 2021 13:10:28 +0000 (13:10 +0000)]
[mir][Python][linalg] Support OpDSL extensions in C++.

The patch extends the yaml code generation to support the following new OpDSL constructs:
- captures
- constants
- iteration index accesses
- predefined types
These changes have been introduced by revision
https://reviews.llvm.org/D101364.

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

3 years ago[lldb] Encode `bool` as unsigned int
Andy Yankovsky [Tue, 18 May 2021 12:43:20 +0000 (14:43 +0200)]
[lldb] Encode `bool` as unsigned int

`bool` is considered to be unsigned according to `std::is_unsigned<bool>::value` (and `Type::GetTypeInfo`). Encoding it as signed int works fine for normal variables and fields, but breaks when reading the values of boolean bitfields. If the field is declared as `bool b : 1` and has a value of `0b1`, the call to `SBValue::GetValueAsSigned()` will return `-1`.

Reviewed By: teemperor

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

3 years ago[lldb][NFC] Remove sample test boilerplate from TestBreakOnCPP11Initializers
Raphael Isemann [Wed, 19 May 2021 13:22:03 +0000 (15:22 +0200)]
[lldb][NFC] Remove sample test boilerplate from TestBreakOnCPP11Initializers

3 years agoRevert "[GlobalISel] Simplify G_ICMP to true/false when the result is known"
Nico Weber [Wed, 19 May 2021 13:02:27 +0000 (09:02 -0400)]
Revert "[GlobalISel] Simplify G_ICMP to true/false when the result is known"

This reverts commit 892497c806306a4b7185ead16d60b0ebcca0a304.
Breaks tests, see comments on https://reviews.llvm.org/D102542

3 years ago[llvm][AArch64][SVE] Model FFR-using intrinsics with inaccessiblemem
Peter Waller [Thu, 13 May 2021 14:44:53 +0000 (14:44 +0000)]
[llvm][AArch64][SVE] Model FFR-using intrinsics with inaccessiblemem

Intriniscs reading or writing the FFR register need to model the fact
there is additional state being read/wrtten.

Model this state as inaccessible memory.

* setffr => write inaccessiblememonly
* rdffr => read inaccessiblememonly
* ldff* => read arg memory, write inaccessiblemem
* ldnf => read arg memory, write inaccessiblemem

3 years ago[mlir][Vector] NFC - Drop vector EDSC usage
Nicolas Vasilache [Wed, 19 May 2021 12:34:52 +0000 (12:34 +0000)]
[mlir][Vector] NFC - Drop vector EDSC usage

Drop the vector dialect EDSC subdirectory and update all uses.

3 years agoRevert "[X86] Limit X86InterleavedAccessGroup to handle the same type case only"
Wang, Pengfei [Wed, 19 May 2021 12:34:47 +0000 (20:34 +0800)]
Revert "[X86] Limit X86InterleavedAccessGroup to handle the same type case only"

This reverts commit ca23a38e373142a18ab56700ba4f3b947bfe9db0.

Revert due to EXPENSIVE_CHECKS fail.

3 years agoRemove scalable vector assert from InnerLoopVectorizer::setDebugLocFromInst
David Sherwood [Wed, 19 May 2021 11:13:13 +0000 (12:13 +0100)]
Remove scalable vector assert from InnerLoopVectorizer::setDebugLocFromInst

In InnerLoopVectorizer::setDebugLocFromInst we were previously
asserting that the VF is not scalable. This is because we want to
use the number of elements to create a duplication factor for the
debug profiling data. However, for scalable vectors we only know the
minimum number of elements. I've simply removed the assert for now
and added a FIXME saying that we assume vscale is always 1. When
vscale is not 1 it just means that the profiling data isn't as
accurate, but shouldn't cause any functional problems.

3 years ago[ARM][NEON] Combine base address updates for vst1x intrinsics
Kristina Bessonova [Thu, 6 May 2021 20:51:30 +0000 (22:51 +0200)]
[ARM][NEON] Combine base address updates for vst1x intrinsics

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

3 years ago[SDAG] propagate FMF from target-specific IR intrinsics
Sanjay Patel [Wed, 19 May 2021 10:20:45 +0000 (06:20 -0400)]
[SDAG] propagate FMF from target-specific IR intrinsics

This is a step towards relying more on node-level FMF rather than function-wide
or target settings.
I think it was just an oversight that we didn't get this path in D87361
or follow-on patches.

The lack of FMF propagation is blocking D90901 from converting tests to IR-level FMF.

We can't do much more than this currently because we also fail to propagate flags
from x86-specific node to generic FMA node. That would be another patch, so the
test just verifies that we can transfer from IR to initial SDAG node.

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

3 years agoReapply "[clang][deps] Support inferred modules"
Michael Spencer [Wed, 19 May 2021 11:04:56 +0000 (13:04 +0200)]
Reapply "[clang][deps] Support inferred modules"

This reapplies commit 95033eb3 that reverted commit 1d9e8e13.

The tests were failing on Windows due to spaces and backslashes in paths not being handled carefully.

3 years ago[clang] Fix a crash on CheckArgAlignment.
Haojian Wu [Wed, 19 May 2021 08:26:03 +0000 (10:26 +0200)]
[clang] Fix a crash on CheckArgAlignment.

We might encounter an undeduced type before calling getTypeAlignInChars.

NOTE: this retrieves the fix from
8f80c66bd2982788a8eede4419684ca72f48b9a2, which was removed in Adam's
followup fix fbfcfdbf6828b8d36f4ec0ff5f4eac11fb1411a5. We originally
thought the crash was caused by recovery-ast, but it turns out it can
occur for other cases, e.g. typo-correction.

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

3 years ago[X86] Atom (pre-SLM) doesn't support PTEST instructions
Simon Pilgrim [Wed, 19 May 2021 10:33:58 +0000 (11:33 +0100)]
[X86] Atom (pre-SLM) doesn't support PTEST instructions

3 years ago[X86] Remove copy + paste typos in AtomWriteResPair comment.
Simon Pilgrim [Wed, 19 May 2021 10:09:19 +0000 (11:09 +0100)]
[X86] Remove copy + paste typos in AtomWriteResPair comment.

Remnants from when the Atom model was copied from the Btver2 model.....

3 years ago[HIP] Tighten checks in hip-include-path.hip test case
Bjorn Pettersson [Tue, 18 May 2021 13:02:45 +0000 (15:02 +0200)]
[HIP] Tighten checks in hip-include-path.hip test case

The checks (both positive and negative checks) in the test case
hip-include-path.hip could mistakenly end up matching the string
"clang" from the InstalledDir in case the build dir for example
was named "/home/username/build-clang/". Intention with this
patch is to tighten up the checks a bit to filter our the
part of the paths that match with InstalledDir when doing the
checks, as well as matching "/lib/clang/" rather than
just "clang/".

Problem was found when building with
  -DCLANG_DEFAULT_RTLIB=compiler-rt
  -DCLANG_DEFAULT_CXX_STDLIB=libc++
and having "clang/" in the path to the build dir.

Reviewed By: yaxunl

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

3 years ago[NFCI][SimplifyCFG] removeEmptyCleanup(): use DeleteDeadBlock()
Roman Lebedev [Wed, 19 May 2021 10:53:36 +0000 (13:53 +0300)]
[NFCI][SimplifyCFG] removeEmptyCleanup(): use DeleteDeadBlock()

This required some changes to, instead of eagerly making PHI's
in the UnwindDest valid as-if the BB is already not a predecessor,
to be valid while BB is still a predecessor.

3 years ago[NFCI][SimplifyCFG] removeEmptyCleanup(): streamline PHI node updating
Roman Lebedev [Wed, 19 May 2021 09:48:40 +0000 (12:48 +0300)]
[NFCI][SimplifyCFG] removeEmptyCleanup(): streamline PHI node updating

3 years ago[NFC][SimplifyCFG] removeEmptyCleanup(): use BasicBlock::phis()
Roman Lebedev [Wed, 19 May 2021 09:19:45 +0000 (12:19 +0300)]
[NFC][SimplifyCFG] removeEmptyCleanup(): use BasicBlock::phis()

3 years agotsan: mark sigwait as blocking
Dmitry Vyukov [Fri, 7 May 2021 09:16:03 +0000 (11:16 +0200)]
tsan: mark sigwait as blocking

Add a test case reported in:
https://github.com/google/sanitizers/issues/1401
and fix it.
The code assumes sigwait will process other signals.

Reviewed By: vitalybuka

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

3 years ago[x86] Fix FMF propagation test
Frederik Gossen [Wed, 19 May 2021 10:39:14 +0000 (12:39 +0200)]
[x86] Fix FMF propagation test

3 years ago[analyzer] Check the checker name, rather than the ProgramPointTag when silencing...
Kristóf Umann [Tue, 18 May 2021 11:06:02 +0000 (13:06 +0200)]
[analyzer] Check the checker name, rather than the ProgramPointTag when silencing a checker

The program point created by the checker, even if it is an error node,
might not be the same as the name under which the report is emitted.
Make sure we're checking the name of the checker, because thats what
we're silencing after all.

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

3 years ago[X86] Limit X86InterleavedAccessGroup to handle the same type case only
Wang, Pengfei [Wed, 19 May 2021 10:01:11 +0000 (18:01 +0800)]
[X86] Limit X86InterleavedAccessGroup to handle the same type case only

The current implementation assumes the destination type of shuffle is the same as the decomposed ones. Add the check to avoid crush when the condition is not satisfied.

This fixes PR37616.

Reviewed By: RKSimon

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

3 years agoUse a non-recursive mutex in GsymCreator.
Simon Giesecke [Fri, 14 May 2021 11:10:18 +0000 (11:10 +0000)]
Use a non-recursive mutex in GsymCreator.

There doesn't seem to be a need to support recursive locking,
and a recursive mutex is unnecessarily inefficient.

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

3 years agoMove FunctionInfo in addFunctionInfo rather than copying.
Simon Giesecke [Fri, 14 May 2021 11:06:39 +0000 (11:06 +0000)]
Move FunctionInfo in addFunctionInfo rather than copying.

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

3 years agoAvoid calculating the string hash twice in GsymCreator::insertString.
Simon Giesecke [Fri, 14 May 2021 10:59:51 +0000 (10:59 +0000)]
Avoid calculating the string hash twice in GsymCreator::insertString.

Do the single hash calculation before acquiring the lock, to reduce
lock contention. If Copy is true, and the string was not yet contained
in the StringStorage, use the new address from StringStorage, but
reuse the hash we already calculated.

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

3 years agoReformat GSYMCreator.cpp
Simon Giesecke [Fri, 7 May 2021 15:32:02 +0000 (15:32 +0000)]
Reformat GSYMCreator.cpp

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

3 years agoMachineBasicBlock: add liveout iterator aware of which liveins are defined by the...
Tim Northover [Tue, 11 May 2021 08:57:18 +0000 (09:57 +0100)]
MachineBasicBlock: add liveout iterator aware of which liveins are defined by the runtime.

Using this in RegAlloc fast reduces register pressure, and in some cases allows
x86 code to compile that wouldn't before.

3 years ago[LV] Add -scalable-vectorization=<option> flag.
Sander de Smalen [Thu, 8 Apr 2021 11:19:44 +0000 (12:19 +0100)]
[LV] Add -scalable-vectorization=<option> flag.

This patch adds a new option to the LoopVectorizer to control how
scalable vectors can be used.

Initially, this suggests three levels to control scalable
vectorization, although other more aggressive options can be added in
the future.

The possible options are:
- Disabled:   Disables vectorization with scalable vectors.
- Enabled:    Vectorize loops using scalable vectors or fixed-width
              vectors, but favors fixed-width vectors when the cost
              is a tie.
- Preferred:  Like 'Enabled', but favoring scalable vectors when the
              cost-model is inconclusive.

Reviewed By: paulwalker-arm, vkmr

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

3 years ago[NFCI][SimplifyCFG] simplifyUnreachable(): use DeleteDeadBlock()
Roman Lebedev [Wed, 19 May 2021 08:54:27 +0000 (11:54 +0300)]
[NFCI][SimplifyCFG] simplifyUnreachable(): use DeleteDeadBlock()

3 years ago[NFCI][SimplifyCFG] simplifyReturn(): use DeleteDeadBlock()
Roman Lebedev [Wed, 19 May 2021 08:50:06 +0000 (11:50 +0300)]
[NFCI][SimplifyCFG] simplifyReturn(): use DeleteDeadBlock()

3 years ago[NFCI][SimplifyCFG] simplifySingleResume(): use DeleteDeadBlock()
Roman Lebedev [Wed, 19 May 2021 08:49:16 +0000 (11:49 +0300)]
[NFCI][SimplifyCFG] simplifySingleResume(): use DeleteDeadBlock()

3 years ago[NFCI][SimplifyCFG] simplifyCommonResume(): use DeleteDeadBlock()
Roman Lebedev [Wed, 19 May 2021 08:44:43 +0000 (11:44 +0300)]
[NFCI][SimplifyCFG] simplifyCommonResume(): use DeleteDeadBlock()

3 years ago[llvm-objcopy] Add support for '--' for delimiting options from input/output files
Sergey Dmitriev [Wed, 19 May 2021 08:11:53 +0000 (01:11 -0700)]
[llvm-objcopy] Add support for '--' for delimiting options from input/output files

This will allow to use llvm-objcopy with file names that begin with dashes.

Reviewed By: jhenderson

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

3 years ago[RISCV] Support INSERT_VECTOR_ELT into i1 vectors
Fraser Cormack [Tue, 18 May 2021 16:17:21 +0000 (17:17 +0100)]
[RISCV] Support INSERT_VECTOR_ELT into i1 vectors

Like the element extraction of these vectors, we choose to promote up to
an i8 vector type and perform the insertion there.

Reviewed By: craig.topper

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

3 years ago[NFCI] SimplifyCFGPass: mergeEmptyReturnBlocks(): use DeleteDeadBlocks()
Roman Lebedev [Wed, 19 May 2021 08:31:53 +0000 (11:31 +0300)]
[NFCI] SimplifyCFGPass: mergeEmptyReturnBlocks(): use DeleteDeadBlocks()

In this case, it does the same thing as the original pattern does.

SimplifyCFG has a few lurking miscompilations about deleting blocks that
have their address taken, and consistently using DeleteDeadBlocks() instead
 of a hand-rolled pattern will allow to weed those cases out easierly.

3 years ago[clang-tidy] Fix a crash on invalid code for memset-usage check.
Haojian Wu [Tue, 18 May 2021 19:53:32 +0000 (21:53 +0200)]
[clang-tidy] Fix a crash on invalid code for memset-usage check.

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

3 years agoFix sanitizer test errors from commit 886629a8
Rong Xu [Wed, 19 May 2021 05:40:30 +0000 (22:40 -0700)]
Fix sanitizer test errors from commit 886629a8

Explictly handle the empty string in the Hash calculation.

3 years ago[mlir] Use VectorTransferPermutationMapLoweringPatterns in VectorToSCF
Matthias Springer [Mon, 17 May 2021 05:37:32 +0000 (14:37 +0900)]
[mlir] Use VectorTransferPermutationMapLoweringPatterns in VectorToSCF

VectorTransferPermutationMapLoweringPatterns can be enabled via a pass option. These additional patterns lower permutation maps to minor identity maps with broadcasting, if possible, allowing for more efficient vector load/stores. The option is deactivated by default.

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

3 years ago[libfuzzer] Update doc mentioning removed flags.
Vitaly Buka [Wed, 19 May 2021 05:39:36 +0000 (22:39 -0700)]
[libfuzzer] Update doc mentioning removed flags.

3 years ago[mlir][Linalg] Break unnecessary dependency through unused `outs` tensor.
MaheshRavishankar [Wed, 19 May 2021 05:08:12 +0000 (22:08 -0700)]
[mlir][Linalg] Break unnecessary dependency through unused `outs` tensor.

LinalgOps that are all parallel do not use the value of `outs`
tensor. The semantics is that the `outs` tensor is fully
overwritten. Using anything other than `init_tensor` can add false
dependencies between operations, when the use is just for the shape of
the tensor. Adding a canonicalization to always use `init_tensor` in
such cases, breaks this dependence.

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

3 years ago[NewPM] Add options to PrintPassInstrumentation
Arthur Eubanks [Fri, 7 May 2021 21:32:20 +0000 (14:32 -0700)]
[NewPM] Add options to PrintPassInstrumentation

To bring D99599's implementation in line with the existing
PrintPassInstrumentation, and to fix a FIXME, add more customizability
to PrintPassInstrumentation.

Introduce three new options. The first takes over the existing
"-debug-pass-manager-verbose" cl::opt.

The second and third option are specific to -fdebug-pass-structure. They
allow indentation, and also don't print analysis queries.

To avoid more golden file tests than necessary, prune down the
-fdebug-pass-structure tests.

Reviewed By: asbirlea

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

3 years ago[Utils][vim] Highlight CHECK-EMPTY: & CHECK-COUNT: directives
Senran Zhang [Wed, 19 May 2021 03:40:59 +0000 (23:40 -0400)]
[Utils][vim] Highlight CHECK-EMPTY: & CHECK-COUNT: directives

Reviewed By: porglezomp

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

3 years ago[CMake] Update Cmake cache file for Win to ARM Linux cross builds. NFC
Vladimir Vereschaka [Wed, 19 May 2021 02:04:49 +0000 (19:04 -0700)]
[CMake] Update Cmake cache file for Win to ARM Linux cross builds. NFC

Parametrize the cache file with TARGET_TRIPLE parameter. Normalize
the target triple to follow the runtime library installation directory.

Explicity enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR option.

3 years agoEnhance InferShapedTypeOpInterface to make it accessible during dialect conversion
Wenyi Zhao [Wed, 19 May 2021 02:11:33 +0000 (02:11 +0000)]
Enhance InferShapedTypeOpInterface to make it accessible during dialect conversion

Original interfaces are not safe to be called during dialect conversion.
This is because some ops (e.g. `dynamic_reshape(input, target_shape)`)
depend on the values of their operands to calculate the output shape.
However the operands may be out of reach during dialect conversion (e.g.
converting from tensor world to buffer world). This patch provides a new
kind of interface which accpets user-provided operands to solve this
problem.

Reviewed By: herhut

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

3 years agoRevert "[IR] Add a Location to BlockArgument." and follow-on commit
Richard Smith [Wed, 19 May 2021 00:43:06 +0000 (17:43 -0700)]
Revert "[IR] Add a Location to BlockArgument." and follow-on commit
"[mlir] Speed up Lexer::getEncodedSourceLocation"

This reverts commit 3043be9d2db4d0cdf079adb5e1bdff032405e941 and commit
861d69a5259653f60d59795597493a7939b794fe.

This change resulted in printing textual MLIR that can't be parsed; see
review thread https://reviews.llvm.org/D102567 for details.

3 years ago[Attributor] Change AAExecutionDomain to only accept intrinsics
Joseph Huber [Wed, 19 May 2021 00:10:05 +0000 (20:10 -0400)]
[Attributor] Change AAExecutionDomain to only accept intrinsics

Summary:
The OpenMP runtime functions don't always provide unique thread ID's to
determine if a basic block is truly single-threaded. Change the implementation
to only check NVPTX intrinsics for now.

Reviewed By: jdoerfert

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

3 years ago[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB
Guozhi Wei [Wed, 19 May 2021 01:02:36 +0000 (18:02 -0700)]
[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

This patch transforms the sequence

    lea (reg1, reg2), reg3
    sub reg3, reg4

to two sub instructions

    sub reg1, reg4
    sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.
The modifications to TwoAddressInstructionPass is to ensure the operands of ADD
instruction has expected order (the dest register of LEA should be src register
of ADD).

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

3 years agoAdd a helper function to convert LogicalResult to int for return from main
Thomas Köppe [Tue, 18 May 2021 23:44:25 +0000 (23:44 +0000)]
Add a helper function to convert LogicalResult to int for return from main

At present, a lot of code contains main function bodies like "return failed(mlir::MlirOptMain(...);". This is unfortunate for two reasons: a) it uses ADL, which is maybe not what the free "failed" function was designed for; and b) it is a bit awkward to read, requring the reader to both understand the boolean nature of the value and the semantics of main's return value. (And it's also not portable, since 1 is not a portable success value.)

The replacement code, `return mlir::AsMainReturnCode(mlir::MlirOptMain(...))` is a bit more self-explanatory.

The change applies the new function to a few internal uses of MlirOptMain, too.

Reviewed By: mehdi_amini

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

3 years ago[mlir] Speed up Lexer::getEncodedSourceLocation
River Riddle [Tue, 18 May 2021 23:36:19 +0000 (16:36 -0700)]
[mlir] Speed up Lexer::getEncodedSourceLocation

We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.

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

3 years agoApply [[standalone_debug]] to some types in the STL.
Amy Huang [Mon, 15 Mar 2021 21:20:49 +0000 (14:20 -0700)]
Apply [[standalone_debug]] to some types in the STL.

Add this attribute to some types to ensure that they have
debug info.
The debug info for these classes are required for debuggers to display
some STL types. With constructor homing (a new debug info optimization)
their debug info isn't emitted because their constructors are never
called.

The list of types with the attribute added are __hash_value_type,
__value_type, __tree_node_base, __tree_node, __hash_node, __list_node,
and __forward_list_node.

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

3 years ago[libc++] Alphabetize header inclusions and include-what-you-use <__debug>. NFCI.
Arthur O'Dwyer [Thu, 13 May 2021 03:04:03 +0000 (23:04 -0400)]
[libc++] Alphabetize header inclusions and include-what-you-use <__debug>. NFCI.

3 years ago[libc++] Some fixes to the <bit> utilities.
Arthur O'Dwyer [Wed, 12 May 2021 17:09:26 +0000 (13:09 -0400)]
[libc++] Some fixes to the <bit> utilities.

Fix __bitop_unsigned_integer and rename to __libcpp_is_unsigned_integer.
There are only five unsigned integer types, so we should just list them out.
Also provide `__libcpp_is_signed_integer`, even though the Standard doesn't
consume that trait anywhere yet.

Notice that `concept uniform_random_bit_generator` is specifically specified
to rely on `concept unsigned_integral` and *not* `__is_unsigned_integer`.
Instantiating `std::ranges::sample` with a type `U` satisfying
`uniform_random_bit_generator` where `unsigned_integral<U::result_type>`
and not `__is_unsigned_integer<U::result_type>` is simply IFNDR.

Orthogonally, fix an undefined behavior in std::countr_zero(__uint128_t).

Orthogonally, improve tests for the <bit> manipulation functions.
It was these new tests that detected the bug in countr_zero.

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

3 years agoFix a buildbot failure from commit 886629a8
Rong Xu [Tue, 18 May 2021 23:52:07 +0000 (16:52 -0700)]
Fix a buildbot failure from commit 886629a8

3 years ago[gn build] Port 886629a8c9e5
LLVM GN Syncbot [Tue, 18 May 2021 23:27:42 +0000 (23:27 +0000)]
[gn build] Port 886629a8c9e5

3 years ago[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
Rong Xu [Tue, 18 May 2021 23:08:38 +0000 (16:08 -0700)]
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO

This patch implements first part of Flow Sensitive SampleFDO (FSAFDO).
It has the following changes:
(1) disable current discriminator encoding scheme,
(2) new hierarchical discriminator for FSAFDO.

For this patch, option "-enable-fs-discriminator=true" turns on the new
functionality. Option "-enable-fs-discriminator=false" (the default)
keeps the current SampleFDO behavior. When the fs-discriminator is
enabled, we insert a flag variable, namely, llvm_fs_discriminator, to
the object. This symbol will checked by create_llvm_prof tool, and used
to generate a profile with FS-AFDO discriminators enabled. If this
happens, for an extbinary format profile, create_llvm_prof tool
will add a flag to profile summary section.

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

3 years ago[OpenMP] Stabilize OpenMP/parallel_for_codegen.cpp test (NFC)
Mike Rice [Tue, 18 May 2021 16:18:17 +0000 (09:18 -0700)]
[OpenMP] Stabilize OpenMP/parallel_for_codegen.cpp test (NFC)

Revert recent commit to require x86-registered-target (e4b790c5e3653053819182a67c593bc65de860ac).
Remove -O1 from the run lines so they are less dependent on backend passes.
Update the CHECK6 and CHECK10 lines with script.

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

3 years ago[Demangle][Rust] Speculative fix for bot build failure
Tomasz Miąsko [Wed, 19 May 2021 00:00:00 +0000 (00:00 +0000)]
[Demangle][Rust] Speculative fix for bot build failure

> error: ‘InType’ is not a class, namespace, or enumeration