Commit Graph

374198 Commits

Author SHA1 Message Date
Sean Silva ae9fd5578e [SmallVector] Allow SmallVector<T>
This patch adds a capability to SmallVector to decide a number of
inlined elements automatically. The policy is:

- A minimum of 1 inlined elements, with more as long as
sizeof(SmallVector<T>) <= 64.
- If sizeof(T) is "too big", then trigger a static_assert: this dodges
the more pathological cases

This is expected to systematically improve SmallVector use in the
LLVM codebase, which has historically been plagued by semi-arbitrary /
cargo culted N parameters, often leading to bad outcomes due to
excessive sizeof(SmallVector<T, N>). This default also makes
programming more convenient by avoiding edit/rebuild cycles due to
forgetting to type the N parameter.

Differential Revision: https://reviews.llvm.org/D92522
2020-12-03 17:21:44 -08:00
Arthur Eubanks 2f0de58294 [NewPM] Support --print-before/after in NPM
This changes --print-before/after to be a list of strings rather than
legacy passes. (this also has the effect of not showing the entire list
of passes in --help-hidden after --print-before/after, which IMO is
great for making it less verbose).

Currently PrintIRInstrumentation passes the class name rather than pass
name to llvm::shouldPrintBeforePass(), meaning
llvm::shouldPrintBeforePass() never functions as intended in the NPM.
There is no easy way of converting class names to pass names outside of
within an instance of PassBuilder.

This adds a map of pass class names to their short names in
PassRegistry.def within PassInstrumentationCallbacks. It is populated
inside the constructor of PassBuilder, which takes a
PassInstrumentationCallbacks.

Add a pointer to PassInstrumentationCallbacks inside
PrintIRInstrumentation and use the newly created map.

This is a bit hacky, but I can't think of a better way since the short
id to class name only exists within PassRegistry.def. This also doesn't
handle passes not in PassRegistry.def but rather added via
PassBuilder::registerPipelineParsingCallback().

llvm/test/CodeGen/Generic/print-after.ll doesn't seem very useful now
with this change.

Reviewed By: ychen, jamieschmeiser

Differential Revision: https://reviews.llvm.org/D87216
2020-12-03 16:52:14 -08:00
River Riddle 96efe90fe7 [mlir][IR] Add explicit default constructor to OwningModuleRef to appease MSVC 2020-12-03 16:31:21 -08:00
Wouter van Oortmerssen fd65e4815c [WebAssembly] Fixed Writer::createInitMemoryFunction to work for wasm64
Differential Revision: https://reviews.llvm.org/D92348
2020-12-03 16:20:55 -08:00
George 5f65c4a8e6 Use MlirStringRef in StandardAttributes.h 2020-12-03 16:12:01 -08:00
Duncan P. N. Exon Smith 99b823c2eb Frontend: Remove redundant call to CompilerInstance::setFileManager, NFC
`ASTUnit::Parse` sets up the `FileManager` earlier in the same function,
ensuring `ASTUnit::getFileManager()` matches `Clang->getFileManager()`.
Remove the later call to `setFileManager(getFileManager())` since it
does nothing.

Differential Revision: https://reviews.llvm.org/D90888
2020-12-03 16:10:59 -08:00
Craig Topper 3fcdf9ca78 [RISCV] Rename FPCCToExtend->FPOpToExpand and FPOpToExtend->FPOpToExpand. NFC
These are used to call setOperationAction/setCondCodeAction with
the Expand action so it seems that Expand is a better name than
Extend.
2020-12-03 16:00:49 -08:00
Richard Smith eccc734a69 P0857R0: Parse a requires-clause after an explicit
template-parameter-list in a lambda.

This implements one of the missing parts of P0857R0. Mark it as not done
on the cxx_status page given that it's still incomplete.
2020-12-03 15:54:16 -08:00
River Riddle b57980309a [mlir][Parser] Don't hardcode the use of ModuleOp in the parser
This was important when ModuleOp was the only top level operation, but that isn't necessarily the case anymore. This is one of the last remaining aspects of the infrastructure that is hardcoded to ModuleOp.

Differential Revision: https://reviews.llvm.org/D92605
2020-12-03 15:47:02 -08:00
River Riddle 00c6ef8628 [mlir][Pass] Remove the restriction that PassManager can only run on ModuleOp
This was a somewhat important restriction in the past when ModuleOp was distinctly the top-level container operation, as well as before the pass manager had support for running nested pass managers natively. With these two issues fading away, there isn't really a good reason to enforce that a ModuleOp is the thing running within a pass manager. As such, this revision removes the restriction and allows for users to pass in the name of the operation that the pass manager will be scheduled on.

The only remaining dependency on BuiltinOps from Pass after this revision is due to FunctionPass, which will be resolved in a followup revision.

Differential Revision: https://reviews.llvm.org/D92450
2020-12-03 15:47:01 -08:00
River Riddle 672cc75cce [mlir][IR] Remove references to BuiltinOps from IR/
There isn't a good reason for anything within IR to specifically reference any of the builtin operations. The only place that had a good reason in the past was AsmPrinter, but the behavior there doesn't need to hardcode ModuleOp anymore.

Differential Revision: https://reviews.llvm.org/D92448
2020-12-03 15:47:01 -08:00
Thomas Raoux c503dc1b8a [mlir][linalg] Add vectorization for element-wise linalg ops
Add support for vectorization for linalg.generic representing element-wise ops.
Those are converted to transfer_read + vector ops + transfer_write.
Also re-organize the vectorization tests to be together.

Implementation derived from the work of @burmako, @agrue and
@fedelebron.

Differential Revision: https://reviews.llvm.org/D92540
2020-12-03 15:31:13 -08:00
Richard Smith be162f4c0e PR45699: Fix crash if an unexpanded parameter pack appears in a
requires-clause.
2020-12-03 15:26:06 -08:00
Jonas Devlieghere 54710b346c [lldb] Use the cpu subtype enum values from llvm::MachO in ArchSpec (NFC)
Use the cpu subtype enum values from llvm::MachO in the ArchSpec MachO
table. As I'm already cluttering the history, restore the table's
formatting to its original glory.

Differential revision: https://reviews.llvm.org/D92601
2020-12-03 15:10:18 -08:00
Nico Weber 32b7d0f5e1 try more to fix t.s on Windows after 7cb0a373d1 2020-12-03 18:06:34 -05:00
Philip Reames 0129cd5035 Use deref facts derived from minimum object size of allocations
This change should be fairly straight forward. If we've reached a call, check to see if we can tell the result is dereferenceable from information about the minimum object size returned by the call.

To control compile time impact, I'm only adding the call for base facts in the routine. getObjectSize can also do recursive reasoning, and we don't want that general capability here.

As a follow up patch (without separate review), I will plumb through the missing TLI parameter. That will have the effect of extending this to known libcalls - malloc, new, and the like - whereas currently this only covers calls with the explicit allocsize attribute.

Differential Revision: https://reviews.llvm.org/D90341
2020-12-03 15:01:14 -08:00
Aaron En Ye Shi ba2612ce01 [HIP] cmath demote long double args to double
Since there is no ROCm Device Library support for
long double, demote them to double, and use the fp64
math functions.

Differential Revision: https://reviews.llvm.org/D92130
2020-12-03 23:00:14 +00:00
Philip Reames 0c866a3d6a [LoopVec] Support non-instructions as argument to uniform mem ops
The initial step of the uniform-after-vectorization (lane-0 demanded only) analysis was very awkwardly written. It would revisit use list of each pointer operand of a widened load/store. As a result, it was in the worst case O(N^2) where N was the number of instructions in a loop, and had restricted operand Value types to reduce the size of use lists.

This patch replaces the original algorithm with one which is at most O(2N) in the number of instructions in the loop. (The key observation is that each use of a potentially interesting pointer is visited at most twice, once on first scan, once in the use list of *it's* operand. Only instructions within the loop have their uses scanned.)

In the process, we remove a restriction which required the operand of the uniform mem op to itself be an instruction.  This allows detection of uniform mem ops involving global addresses.

Differential Revision: https://reviews.llvm.org/D92056
2020-12-03 14:51:44 -08:00
Philip Reames 55db6ec1cc [BasicAA] Move newline to dump from printer 2020-12-03 14:35:43 -08:00
Jonas Devlieghere 99ea2c461d [lldb] Refactor the Symbolicator initializer
We found out that we have clients relying on the old signature of the
Symbolicator initializer. Make the signature compatible again and
provide a factory method to initialize the class correctly based on
whether you have a target or want the symbolicator to create one for
you.

Differential revision: D92601
2020-12-03 14:31:59 -08:00
Fangrui Song 86fa896363 Revert D90844 "[TableGen][SchedModels] Fix read/write variant substitution"
This reverts commit 112b3cb6ba.

D90844 made lib/Target/AArch64/AArch64GenSubtargetInfo.inc non-deterministic.
2020-12-03 14:24:29 -08:00
Justin Bogner 203748e76d Revert "[test] Add a triple to an x86 test"
This fails on some of the bots. Reverting to investigate.

This reverts commit d5268ebe19.
2020-12-03 14:21:37 -08:00
Justin Bogner d5268ebe19 [test] Add a triple to an x86 test
This already "REQUIRE"d an x86 target, but it was also implicitly
depending on a default triple being set.
2020-12-03 14:05:51 -08:00
Siva Chandra Reddy 3a375125b0 [libc][NFC] Remove dependence on xmmintrin.h to read/write MXCSR.
The version of clang on the bots is unhappy with using xmmintrin.h.
So, this change removes dependence on xmmintrin by using inline
assembly.
2020-12-03 13:49:17 -08:00
Nico Weber caa99e3f0a try to fix t.s on Windows after 7cb0a373d1 2020-12-03 16:42:08 -05:00
Jonas Devlieghere 9d9959eeac [lldb] Recognize MachO cpu sub-type 2 as arm64
Make sure we recognize cpu sub-type 2 as arm64. In reality it's arm64e,
but we don't have the triple for that. Without this patch, we fall back
to unknown-apple-macosx- for the default architecture, which breaks
things like running expressions without a target.

Differential revision: https://reviews.llvm.org/D92603
2020-12-03 13:31:31 -08:00
David Blaikie 0fd0f885eb [mlir] Use long rather than int to address pointer-to-int narrowing warning 2020-12-03 13:09:36 -08:00
David Blaikie 30b1ae5916 [mlir] Make conversion functions inline instead of static to avoid -Wunused-function 2020-12-03 13:09:36 -08:00
Philip Reames 17b195b632 [BasicAA] Minor formatting improvements for printers 2020-12-03 13:08:56 -08:00
Nico Weber 7cb0a373d1 [mac/lld] Implement -t
Goes well with `-why_load` to get an idea of load order.

Differential Revision: https://reviews.llvm.org/D92583
2020-12-03 16:02:38 -05:00
Siva Chandra Reddy 4fff2a7e89 [libc] Add simple x86_64 floating point exception and rounding mode support.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D92546
2020-12-03 12:55:12 -08:00
Philip Reames d93b8acd09 [BasicAA] Add print routines to DecomposedGEP for ease of debugging 2020-12-03 12:43:39 -08:00
Peter Steinfeld f24c642178 [flang] Fix bogus message on interface procedure argument names
We were keeping the state of parsed equivalence sets in the class
DeclarationVisitor.  A problem happened when  analyzing the the specification
part of a declaration that contained an EQUIVALENCE statement followed by an
interface block.  The same DeclarationVisitor object that was created for the
outer declaration was being used to analyze the specification part
of a procedure body in the interface block.  When analyzing the specification
part of the procedure in the interface block, the names in the outer
declaration's EQUIVALENCE statement were erroneously compared with the names in
the arguments of the interface procedure.  This resulted in a bogus error
message.

I fixed this by not checking equivalence sets when we're in an interface
block.  I also added a test that will produce an error message without
this change.

Differential Revision: https://reviews.llvm.org/D92501
2020-12-03 12:08:55 -08:00
Arthur O'Dwyer d430330788 [libc++] Update and normalize the "all the headers" tests.
Some C++20 headers weren't added properly to all three of these
test files. Add them, and take the time to normalize the formatting
so that

    diff <(grep '#include' foo.cpp) <(grep '#include' bar.cpp)

shows no diffs (except that `no_assert_include` deliberately
excludes `<cassert>`).

- Add macro guards to <{barrier,latch,semaphore}>.
- Add macro guards to <experimental/simd>.
- Remove an include of <cassert> from <semaphore>.
- Instead, include <cassert> in the semaphore tests.

Differential Revision: https://reviews.llvm.org/D92525
2020-12-03 15:01:38 -05:00
Mehdi Amini 5d208d5054 Revert "Include Region.h in OperationSupport.h instead of forward declaring it (NFC)"
This reverts commit e312b388eb.

The original breaking change has been reverted
2020-12-03 19:59:20 +00:00
Mehdi Amini 6cd9608fb3 Revert "Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible"
This reverts commit c8d406c93c.

Builds are broken with some versions of GCC.
2020-12-03 19:58:06 +00:00
Scott Linder f6b9afae00 [AMDGPU] Extend and reorganize memory legalizer tests
* Rename some tests to try to make a convention (where all components
  are optional) of:

    <addrspace>_<syncscope>_<memory-orders>_<operation>

* Split up at a level of granularity appropriate for the different RUN
  lines (i.e. split on addrspace so GFX6 can avoid FLAT) and that makes
  running a specific test reasonable in terms of wall time taken. This
  also means when run as part of the test suite the testing is not one
  serial bottleneck.

* Auto-generate check lines with `update_llc_test_checks.py` to make
  future maintenance more tractable.

Reviewed By: rampitec, t-tye

Differential Revision: https://reviews.llvm.org/D91545
2020-12-03 19:36:33 +00:00
Adam Czachorowski c282b7de5a [clangd] AddUsing: Fix a crash on ElaboratedTypes without NestedNameSpecfiiers.
Differential Revision: https://reviews.llvm.org/D92579
2020-12-03 20:25:38 +01:00
Craig Topper a18d5e3e9f [RISCV] Merge FMV_H_X_RV32/FMV_H_X_RV64 into a single opcode. Same with FMV_X_ANYEXTH_RV32/RV64
Rather than having a different opcode for RV32 and RV64. Let's just say the integer type is XLenVT and use a single opcode for both modes.

Differential Revision: https://reviews.llvm.org/D92538
2020-12-03 11:12:40 -08:00
serge-sans-paille 9501419e87 Speedup some unicode rendering
Use a fast path for column width computation for ascii characters. Especially
relevant for llvm-objdump.

before:

    % time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
    ./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.75s user 0.01s system 99% cpu 0.757 total

after:

    % time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
    ./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.37s user 0.01s system 99% cpu 0.378 total

Differential Revision: https://reviews.llvm.org/D92180
2020-12-03 20:11:11 +01:00
Adhemerval Zanella c288715e95 [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available
On AArch64 it allows use the native FP16 ABI (although libcalls are
not emitted for fptrunc/fpext lowering), while on other architectures
the expected current semantic is preserved (arm for instance).

For testing the _Float16 usage is enabled by architecture base,
currently only for arm, aarch64, and arm64.

This re-enabled revert done by https://reviews.llvm.org/rGb534beabeed3ba1777cd0ff9ce552d077e496726

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D92241
2020-12-03 16:08:55 -03:00
Sam Clegg 701fa0b5ab [lld][WebAssembly] Fix malformed output with -pie + --shared-memory
The conditional guarding createInitMemoryFunction was incorrect and
didn't match that guarding the creation of the associated symbol.

Rather that reproduce the same conditions in multiple places we can
simply use the presence of the associated symbol.

Also, add an assertion that would have caught this bug.

Also, add a new test for this flag combination.

This is part of an ongoing effort to enable dynamic linking with
threads in emscripten.

See https://github.com/emscripten-core/emscripten/issues/3494

Differential Revision: https://reviews.llvm.org/D92520
2020-12-03 11:06:07 -08:00
Anna Thomas fb2e109d45 [ScalarizeMaskedMemIntrin] NFC: Pass args by reference 2020-12-03 14:04:21 -05:00
Fangrui Song 756fa8b9be [Metadata] Fix layer violation in D91576
There is a library layering issue. LLVMAnalysis provides llvm/Analysis/ScopedNoAliasAA.h and depends on LLVMCore.

LLVMCore provides llvm/IR/Metadata.cpp and it should not include a header file in LLVMAnalysis
2020-12-03 10:58:46 -08:00
Mehdi Amini e312b388eb Include Region.h in OperationSupport.h instead of forward declaring it (NFC)
This fixes the build on gcc5 toolchain where sizeof is required for
types used in SmallVector now.
This is a consequence of using std::is_trivially_copy_constructible
instead of the LLVM variant: https://reviews.llvm.org/D92543
2020-12-03 18:54:27 +00:00
LLVM GN Syncbot d69762c404 [gn build] Port 2020-12-03 18:47:31 +00:00
Mehdi Amini 1c2159494d Use the generic form when printing from the python bindings and the verifier fails
This reduces the chances of segfault. While it is a good practice to ensure
robust custom printers, it is unfortunately common to have them crash on
invalid input.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D92536
2020-12-03 18:45:00 +00:00
Nico Weber df8a79258f [gn build] (semi-manually) port cc8df90b03 2020-12-03 13:43:19 -05:00
Nico Weber 498693a7b5 [gn build] (manually) port 65049d1610 2020-12-03 13:43:19 -05:00
Stella Stamenova 1410b72be3 [compiler-rt] Fix a bug in the cmakelists file when CMAKE_CXX_FLAGS are empty
Right now, the regex expression will fail if the flags were not set. Instead, we should follow the pattern of other llvm projects and quote the expression, so that it can work even when the flags are not set.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D92586
2020-12-03 10:25:52 -08:00