Commit Graph

385195 Commits

Author SHA1 Message Date
Yang Fan ca55f05116
[clang][SourceManager] Fix -Wparentheses warning (NFC)
GCC warning:
```
/llvm-project/clang/lib/Basic/SourceManager.cpp: In instantiation of ‘constexpr T likelyhasbetween(T, unsigned char, unsigned char) [with T = long unsigned int]’:
/llvm-project/clang/lib/Basic/SourceManager.cpp:1292:52:   required from here
/llvm-project/clang/lib/Basic/SourceManager.cpp:1264:48: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses]
 1264 |           (x & ~static_cast<T>(0) / 255 * 127) +
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 1265 |               (~static_cast<T>(0) / 255 * (127 - (m - 1)))) &
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2021-04-09 10:22:56 +08:00
Jim Lin 49c79e3b56 [RISCV][NFC] Add explicit type i64 to RV64 only patterns.
Add explicit type i64 to RV64 only patterns to stop emitting unneeded i32 patterns.

It can reduce the isel table size.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D100089
2021-04-09 09:37:04 +08:00
Alex Orlov f47a4c0713 [lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order.
This fixes https://bugs.llvm.org/show_bug.cgi?id=41712 bug.

Reviewed By: aganea

Differential Revision: https://reviews.llvm.org/D99978
2021-04-09 05:29:14 +04:00
Rob Suderman ceeb5b0f87 [mlir][tosa] Add tosa.max_pool2d lowering to linalg int max pooling additions
Lowerings tosa.max_pool2d to linalg equivalent operations. Includes
adding max pooling operations for linalg, with corresponding tests.

Differential Revision: https://reviews.llvm.org/D99824
2021-04-08 18:17:16 -07:00
Duncan P. N. Exon Smith 4a84b03ece ADT: Sink the guts of StringMapEntry::Create into StringMapEntryBase
Sink the interesting parts of StringMapEntry::Create into a new function
StringMapEntryBase::allocateWithKey that's only templated on the
allocator, taking the entry size and alignment as parameters.

As dblaikie pointed out in the review, it'd be interesting as a
follow-up to make this more generic and maybe sink at least some of it
into a source file; I haven't done that yet myself, but I left behind an
encouraging comment.

Differential Revision: https://reviews.llvm.org/D95654
2021-04-08 17:57:47 -07:00
David Blaikie eb8a28e2cf DebugInfo: Include inline namespaces in template specialization parameter names
This ensures these types have distinct names if they are distinct types
(eg: if one is an instantiation with a type in one inline namespace, and
another from a type with the same simple name, but in a different inline
namespace).
2021-04-08 17:37:55 -07:00
David Blaikie 8294019633 Use default ref capture to avoid unused capture warning on assert-used variable 2021-04-08 17:37:55 -07:00
Weiwei Li 12ffc26067 [mlir][spirv] Define spv.ImageDrefGather operation
This patch doesn't support the optional operands of ImageDrefGather. The support of optional operands will be implemented later.

co-authered-by: Alan Liu <alanliu.yf@gmail.com>

Differential Revision: https://reviews.llvm.org/D100128
2021-04-08 20:15:54 -04:00
Duncan P. N. Exon Smith 6dc432510f Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC, 3rd attempt
This reverts commit e35afbe535, reapplying
022ccedde8 and
e7ed5c920d.

- The first attempt missed defining `SignpostEmitterImpl`.
- The second attempt missed defining `llvm::SignpostEmitterImpl`.

Not sure how I failed to test both versions locally before; I thought
I'd turned the feature off via rerunning `cmake` but it must have been
stuck in place. This time I confirmed via `clang -E` that I was testing
both build configurations.

Original commit message:

    Replace some manual memory management with std::unique_ptr.

    Differential Revision: https://reviews.llvm.org/D100151
2021-04-08 17:05:59 -07:00
Duncan P. N. Exon Smith e35afbe535 Revert "Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC"""
This reverts commit e7ed5c920d again, due
to more buildbot failures:
https://lab.llvm.org/buildbot/#/builders/131/builds/8191
2021-04-08 16:58:12 -07:00
Duncan P. N. Exon Smith e7ed5c920d Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC""
This reverts commit 078072285d, reapplying
022ccedde8.

I figured out why this was failing in other environments: it's not a
problem with std::unique_ptr, but that SignpostEmitterImpl only has a
forward declaration. Adding an empty definition should do the trick.

Original commit message:

    Replace some manual memory management with std::unique_ptr.

    Differential Revision: https://reviews.llvm.org/D100151
2021-04-08 16:50:39 -07:00
Duncan P. N. Exon Smith 078072285d Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC"
This reverts commit 022ccedde8. Looks like
some hosts need a definition of SignpostEmitterImpl to put it in a
unique_ptr:
https://lab.llvm.org/buildbot/#/builders/92/builds/7733
2021-04-08 16:38:47 -07:00
Duncan P. N. Exon Smith 9be4387434 Support: Avoid unnecessary std::function for SignpostEmitterImpl::SignpostLog
The destructor for SignPostEmitterImpl::SignpostLog is known statically. Avoid
the unnecessary vtable indirection through std::function in the std::unique_ptr
by turning LogDeleter into a struct. No real functionality change here.

Differential Revision: https://reviews.llvm.org/D100154
2021-04-08 16:34:22 -07:00
Duncan P. N. Exon Smith bf12b711f9 Support: Drop the no-op initializer for SignpostEmitterImpl::Signposts, NFC
This is a DenseMap, which has its own initializer; we don't need to explicitly
call the default constructor here.

Differential Revision: https://reviews.llvm.org/D100152
2021-04-08 16:34:00 -07:00
Duncan P. N. Exon Smith 022ccedde8 Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC
Replace some manual memory management with std::unique_ptr.

Differential Revision: https://reviews.llvm.org/D100151
2021-04-08 16:31:59 -07:00
Duncan P. N. Exon Smith 429088b9e2 Support: Extract fs::resize_file_before_mapping_readwrite from FileOutputBuffer
Add a variant of `fs::resize_file` for use immediately before opening a
file with `mapped_file_region::readwrite`. On Windows, `_chsize`
(`ftruncate`) is slow, but `CreateFileMapping` (`mmap`) automatically
extends the file so the call to `fs::resize_file` can be skipped.

This optimization was added to `FileOutputBuffer` in
da9bc2e56d5a5c6332a9def1a0065eb399182b93; this commit just extracts the
logic out and adds a unit test.

Differential Revision: https://reviews.llvm.org/D95490
2021-04-08 16:26:35 -07:00
Mehdi Amini 38b106f681 Improve error message when tring to export to LLVM IR with a dialect missing the interface
Dialects can be translated to LLVM IR when they have the
LLVMTranslationDialectInterface interface registered. In case the
interface isn't explicitly registered, even the LLVM dialect can't be
exported to LLVM IR. This make the error message more explicit on this.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D96729
2021-04-08 23:21:27 +00:00
Nikita Kniazev 2f181086b5 [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)
Required for capturing base specifier in matchers:
  `cxxRecordDecl(hasDirectBase(cxxBaseSpecifier().bind("base")))`

Reviewed By: steveire, aaron.ballman

Differential Revision: https://reviews.llvm.org/D69218
2021-04-09 00:05:36 +01:00
Leonard Chan a7b51d8a4f [compiler-rt][hwasan] Add C++17 new/delete operators with alignment
Differential Revision: https://reviews.llvm.org/D99368
2021-04-08 15:44:39 -07:00
Craig Topper 872931e5d8 [RISCV] Use multiclass inheritance where possible for the VPat* multiclasses in RISVInstrInfoVPseudos. NFCI
Instead of instantiating multiclasses inside multiclasses, just
inherit from them.

We can do the same for the VPseudo* multiclasses, but that may
interfere with the scheduler class work.
2021-04-08 15:14:06 -07:00
Craig Topper ac347a8a0f [RISCV] Remove empty string after 'defm' at top level of vector .td files. NFC
This doesn't do anything so it's just wasted characters. I have
other plans for the ones in multiclasses.
2021-04-08 15:14:06 -07:00
Jonas Devlieghere e761b6b4c5 [lldb] (Temporarily) disable vfork-follow-parent-wp.test on Darwin
The test is failing on GreenDragon. Pinged Michał in D98822.
2021-04-08 15:05:27 -07:00
Alexey Bataev ab124bbe2a [SLP]Fix PR49898: Infinite loop in SLP vectorizer.
We should not re-try attempt of finding of the consecutive store chain
if it was tried before.

Differential Revision: https://reviews.llvm.org/D100131
2021-04-08 14:18:06 -07:00
Philip Reames 35393c865c [funcattrs] Infer nosync from instruction walk
Pretty straightforward use of existing infrastructure and port of the attributor inference rules for nosync.

A couple points of interest:
* I deliberately switched from "monotonic or better" to "unordered or better". This is simply me being conservative and is better in line with the rest of the optimizer. We treat monotonic conservatively pretty much everywhere.
* The operand bundle test change is suspicious. It looks like we might have missed something here, but if so, it's an issue with the existing nofree inference as well. I'm going to take a closer look at that separately.
* I needed to keep the previous inference from readnone. This surprised me, but made sense once I realized readonly inference goes to lengths to reason about local vs non-local memory and that writes to local memory are okay. This is fine for the purpose of nosync, but would e.g. prevent us from inferring nofree from readnone - which is slightly surprising.

Differential Revision: https://reviews.llvm.org/D99769
2021-04-08 14:05:00 -07:00
Arthur Eubanks c5d1ccbcdf [GVN] Properly invalidate ICF cache when we simplify a value
This fixes a "Cached first special instruction is wrong!" assert.

The assert fires because replacing a value with another can cause an
instruction to no longer be "special" to ICF. In this case,
devirtualization happened, turning an indirect call to a
call to a willreturn function which is no longer special.

Reviewed By: nikic, rnk

Differential Revision: https://reviews.llvm.org/D99977
2021-04-08 14:01:57 -07:00
Dan Liew f66e05a720 Include `count` in AppleClang toolchains.
The motivation here is so we can run the compiler-rt tests
from a standalone build against AppleClang.

In particular the `Posix/halt_on_error-torture.cpp` and
`Posix/halt_on_error_suppress_equal_pcs.cpp` ASan test cases currently
require this binary for the tests to pass.

rdar://76366784

Differential Revision: https://reviews.llvm.org/D100087
2021-04-08 14:00:29 -07:00
Thomas Preud'homme 5ca168b032 [FileCheck, test] Rename checkWildcardRegexCharMatchFailure
Proposed edit https://reviews.llvm.org/D97845#inline-922769 in D97845
suggests the checkWildcardRegexCharMatchFailure function name is
misleading because it is not clear it checks for a match failure on each
character in the string parameter. This commit renames it to an
hopefully clearer name.

Reviewed By: jdenny

Differential Revision: https://reviews.llvm.org/D98343
2021-04-08 21:57:55 +01:00
Konstantin Zhuravlyov 4fae63c612 AMDGPU: Add gfx90c support to code object v2 for backwards compatibility
Differential Revision: https://reviews.llvm.org/D100126
2021-04-08 16:42:43 -04:00
Stanislav Mekhanoshin 627dab3dbf [AMDGPU] Check for all meta instrs in GCNRegBankReassign
It used to work correctly even with a KILL, but there is
no reason to consider meta instructions since they do not
create real HW uses.

Differential Revision: https://reviews.llvm.org/D100135
2021-04-08 13:41:10 -07:00
Jason Molenda dd453a1389 Add setting to disable LanguageRuntime UnwindPlans
When debugging LanguageRuntime unwindplans, it can be
helpful to disable their use and see the normal
stack walk.  Add a setting for this.

Differential Revision: https://reviews.llvm.org/D99828
2021-04-08 13:28:59 -07:00
Nikita Popov 59a2f67011 [LoopRotate] Don't split loop pass manager
After D99249 we use three different loop pass managers for LICM,
LoopRotate and LICM+LoopUnswitch. This happens because LazyBFI
and LazyBPI are not preserved by LoopRotate (note that D74640
is no longer needed). Avoid this by marking them as preserved.

My understanding of D86156 is that it is okay to simply preserve
them (which LoopUnswitch already does for the same reason) and
rely on callbacks to deal with deleted blocks.

Differential Revision: https://reviews.llvm.org/D99843
2021-04-08 22:05:18 +02:00
Stanislav Mekhanoshin 189310a140 [AMDGPU] Allow -amdgpu-unsafe-fp-atomics to ignore denorm mode
Fixes: SWDEV-274276

Differential Revision: https://reviews.llvm.org/D100072
2021-04-08 12:46:36 -07:00
Xiangling Liao d508561798 [AIX] Support init priority attribute
Differential Revision: https://reviews.llvm.org/D99291
2021-04-08 15:40:09 -04:00
Arnamoy Bhattacharyya 3a4c0354b6 [flang][OpenMP] Add functionality to check "close nesting" of regions, which can be used for Semantic checks. Also adding more test cases.
Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D99970
2021-04-08 15:19:38 -04:00
Hanhan Wang c361435845 [mlir][StandardToSPIRV] Handle i1 case for lowering memref.load/store op
This patch unconditionally converts i1 types to i8 types on memrefs. If the
extensions or capabilities are not met, they will be converted to i32. Hence the
logic in IntLoadPattern and IntStorePattern are also updated.

Also added the implementation of SPIRVTypeConverter::getOptions().

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D99724
2021-04-08 12:15:25 -07:00
Wouter van Oortmerssen 04e9cd09c8 [WebAssembly] Fix for PIC external symbol ISEL
wasm64 was missing DAG ISEL patterns for external symbol based global.get, but simply adding these analogous to the existing 32-bit versions doesn't work.
This is because we are conflating the 32-bit global index with the pointer represented by the external symbol, which for wasm32 happened to work.
The simplest fix is to pretend we have a 64-bit global index. This sounds incorrect, but is immaterial since once this index is stored as a MachineOperand it becomes 64-bit anyway (and has been all along). As such, the EmitInstrWithCustomInserter based implementation I experimented with become a no-op and no further changes in the C++ code are required.

Differential Revision: https://reviews.llvm.org/D99904
2021-04-08 12:07:38 -07:00
Congzhe Cao ce2db9005d [LoopInterchange] Fix transformation bugs in loop interchange
After loop interchange, the (old) outer loop header should not jump to
the `LoopExit`. Note that the old outer loop becomes the new inner loop
after interchange. If we branched to `LoopExit` then after interchange
we would jump directly from the (new) inner loop header to `LoopExit`
without executing the rest of outer loop.

This patch modifies adjustLoopBranches() such that the old outer
loop header (which becomes the new inner loop header) jumps to the
old inner loop latch which becomes the new outer loop latch after
interchange.

Reviewed By: bmahjour

Differential Revision: https://reviews.llvm.org/D98475
2021-04-08 14:58:13 -04:00
Levy Hsu 461b554999 [RISCV] Add InstAlias for Zbb Zbp and Zbs extension
Add InstAlias that allows the last operand to be an imm for following instructions:

1. Zbb or Zbp:
    - ror
    - rorw (RV64 Only)

2. Zbs
    - best
    - bclr
    - binv
    - bext

Reviewed By: craig.topper, jrtc27

Differential Revision: https://reviews.llvm.org/D100083
2021-04-08 11:51:31 -07:00
Sanjay Patel 5094e1279e [InstCombine] fold min/max intrinsic with negated operand to abs
The smax case shows up in https://llvm.org/PR49885 .
The others seem unlikely, but we might as well try
for uniformity (although that could mean an extra
instruction to create "nabs").

smax -- https://alive2.llvm.org/ce/z/8yYaGy
smin -- https://alive2.llvm.org/ce/z/0_7zc_
umax -- https://alive2.llvm.org/ce/z/EcsZWs
umin -- https://alive2.llvm.org/ce/z/Xw6WvB
2021-04-08 14:37:39 -04:00
Sanjay Patel c52dbdbc33 [InstCombine] add tests for min/max with negated operand; NFC 2021-04-08 14:37:39 -04:00
Craig Topper 02ef9963e1 [RISCV] Prevent __builtin_riscv_orc_b_64 from being compiled RV32 target.
The backend can't handle this and will throw a fatal error from
type legalization. It's easy enough to fix that for this intrinsic
by just splitting the IR intrinsic since it works on individual bytes.

There will be other intrinsics in the future that would be harder
to support through splitting, for example grev, gorc, and shfl. Those
would require a compare and a select be inserted to check the MSB of
their control input.

This patch adds support for preventing this in the frontend with
a nice diagnostic.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D99984
2021-04-08 11:34:56 -07:00
Stanislav Mekhanoshin 5f0ac1ef78 Set IgnoreLLVMUsed to false in CallGraph::addToCallGraph()
clang++ uses llvm.compiler.used in certain cases to preserve
symbol which is fully inlined. D96087 has resulted in undefined
symbols in such cases. Set it to false by default to preserve
old behavior but keep the option for specific uses where we
want to ignore these (e.g. to detect a potential indirect call
to a function).

Differential Revision: https://reviews.llvm.org/D99897
2021-04-08 11:14:09 -07:00
Jez Ng c2e76a9a6d [lld-macho][nfc] Use varargs form of hasArg() 2021-04-08 14:12:55 -04:00
Jez Ng c23b92acd0 [lld-macho] Support -add_ast_path
Swift builds seem to use it. All it requires is emitting the
corresponding paths as STABS.

Fixes llvm.org/PR49385.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D100076
2021-04-08 14:12:55 -04:00
Michał Górny d01bff8cbd [lldb] [test] Skip clone() tests on Linux/aarch64 2021-04-08 20:03:45 +02:00
Paul C. Anagnostopoulos 3f919ff250 Revert "[TableGen] Add support for the 'assert' statement in multiclasses"
This reverts commit 3b9a15d910.
2021-04-08 13:58:58 -04:00
Sushma Unnibhavi b68545acf9 [lldb] Improve the documentation (#42017)
Added punctuation and changed "So for instance" to "For instance".

Fixes https://llvm.org/PR42017

Differential revision: https://reviews.llvm.org/D100053
2021-04-08 10:58:02 -07:00
Lei Zhang 151752ab20 [mlir][linalg] Fix loop upper bounds in conv fusion test
Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D100112
2021-04-08 13:40:48 -04:00
Valeriy Savchenko 663ac91ed1 [analyzer] Fix false positives in inner pointer checker (PR49628)
This patch supports std::data and std::addressof functions.

rdar://73463300

Differential Revision: https://reviews.llvm.org/D99260
2021-04-08 20:30:12 +03:00
Valeriy Savchenko 4b958dd6bc [analyzer] Fix crash on spaceship operator (PR47511)
rdar://68954187

Differential Revision: https://reviews.llvm.org/D99181
2021-04-08 20:28:05 +03:00