Commit Graph

376435 Commits

Author SHA1 Message Date
Roman Lebedev f8875c313c
[NFC][SimplifyCFG] Add test with an unreachable block with two identical successors 2021-01-08 02:15:25 +03:00
Roman Lebedev 1f9b591ee6
[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock(): switch to non-permissive DomTree updates
... which requires not deleting edges that were just deleted already,
    by not processing the same predecessor more than once.
2021-01-08 02:15:25 +03:00
Roman Lebedev b3822728fa
[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `indirectbr` handling
... which requires not deleting edges that were just deleted already.
2021-01-08 02:15:25 +03:00
Roman Lebedev 8b9a0e6f7e
[NFC][SimlifyCFG] Add some indirectbr-of-blockaddress tests 2021-01-08 02:15:25 +03:00
Roman Lebedev 36593a30a4
[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `SwitchInst` handling
... which requires not deleting edges that will still be present.
2021-01-08 02:15:24 +03:00
Roman Lebedev 16ab8e5f6d
[SimplifyCFG] ConstantFoldTerminator(): handle matching destinations of condbr earlier
We need to handle this case before dealing with the case of constant
branch condition, because if the destinations match, latter fold
would try to remove the DomTree edge that would still be present.

This allows to make that particular DomTree update non-permissive
2021-01-08 02:15:24 +03:00
Roman Lebedev 087be536fe
[NFC][SimplifyCFG] Add a test with cond br on constant w/ identical destinations 2021-01-08 02:15:24 +03:00
Arthur Eubanks 9ccf13c36d [NewPM][NVPTX] Port NVPTX opt passes
There are only two used in the IR optimization pipeline.
Port these and add them to the default pipeline.

Similar to https://reviews.llvm.org/D93863.

I added -mtriple to some tests since under the new PM, the passes are
only available when the TargetMachine is specified.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D93930
2021-01-07 15:12:35 -08:00
Arthur O'Dwyer ff1b6f9ff2 [libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.
For ease of comparing our list with the official SD-6 list, which is alphabetized.
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#library-feature-test-macros
This also alphabetizes the lists of headers in which the macros are
defined, which harmlessly alters many comments in <version>.
Also drive-by-fix some trivial flake8 warnings.
2021-01-07 18:11:46 -05:00
Arthur Eubanks b2dafd44ca [NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline
In https://reviews.llvm.org/D88138 this was incorrectly added with
registerOptimizerLastEPCallback(), when it should be
registerLoopOptimizerEndEPCallback(), matching the legacy PM's
EP_LoopOptimizerEnd.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D93929
2021-01-07 15:04:28 -08:00
Luís Marques 15f5971150 [LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detection
Adds the RISC-V ArchSpec bits contributed by @simoncook as part of D62732,
plus logic to distinguish between riscv32 and riscv64 based on ELF class.

The patch follows the implementation approach previously used for MIPS.
It defines RISC-V architecture subtypes and inspects the ELF header,
namely the ELF class, to detect the right subtype.

Differential Revision: https://reviews.llvm.org/D86292
2021-01-07 23:02:55 +00:00
Joseph Huber 2ce16810f2 [OpenMP] Always print error messages in libomptarget CUDA plugin
Summary:
Currently error messages from the CUDA plugins are only printed to the user if they have debugging enabled. Change this behaviour to always print the messages that result in offloading failure. This improves the error messages by indidcating what happened when the error occurs in the plugin library, such as a segmentation fault on the device.

Reviewed by: jdoerfert

Differential Revision: https://reviews.llvm.org/D94263
2021-01-07 17:47:32 -05:00
Michael Liao f78d6af731 [hip] Enable HIP compilation with `<complex`> on MSVC.
- MSVC has different `<complex>` implementation which calls into functions
  declared in `<ymath.h>`. Provide their device-side implementation to enable
  `<complex>` compilation on HIP Windows.

Differential Revision: https://reviews.llvm.org/D93638
2021-01-07 17:41:28 -05:00
Matt Arsenault 2cbbc6e87c GlobalISel: Fail legalization on narrowing extload below memory size 2021-01-07 17:40:34 -05:00
Louis Dionne c01202a7ef [libc++] Fix typo in run-buildbot
The installation directory was never meant to contain a brace.
2021-01-07 17:37:09 -05:00
David Blaikie 274afac9a1 lldb: Add support for DW_AT_ranges on DW_TAG_subprograms
gcc already produces debug info with this form
-freorder-block-and-partition
clang produces this sort of thing with -fbasic-block-sections and with a
coming-soon tweak to use ranges in DWARFv5 where they can allow greater
reuse of debug_addr than the low/high_pc forms.

This fixes the case of breaking on a function name, but leaves broken
printing a variable - a follow-up commit will add that and improve the
test case to match.

Differential Revision: https://reviews.llvm.org/D94063
2021-01-07 14:28:03 -08:00
Alexandre Ganea eaadb41db6 [LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under /DEBUG:GHASH
Before this patch, when using LLD with /DEBUG:GHASH and MSVC precomp.OBJ files, we had a bunch of:

lld-link: warning: S_[GL]PROC32ID record in blabla.obj refers to PDB item index 0x206ED1 which is not a LF[M]FUNC_ID record

This was caused by LF_FUNC_ID and LF_MFUNC_ID which didn't have correct mapping to the corresponding TPI records. The root issue was that the indexMapStorage was improperly re-assembled in UsePrecompSource::remapTpiWithGHashes.

After this patch, /DEBUG and /DEBUG:GHASH produce exactly the same debug infos in the PDB.

Differential Revision: https://reviews.llvm.org/D93732
2021-01-07 17:27:13 -05:00
Craig Topper 973c35d338 [TableGen] Make CodeGenDAGPatterns::getSDNodeNamed take a StringRef instead of const std::string &.
All callers use a string literal and the getDef method the string
is passed to already takes a StringRef.
2021-01-07 14:20:16 -08:00
David Blaikie 3503c85681 Fixup Asserts+!AbiBreakingChecks fallout from db33f85c71 2021-01-07 14:18:19 -08:00
Arthur Eubanks 1a2eaebc09 [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones
Apparently there can be no clones, as happens in
coro-retcon-unreachable.ll.

The alternative is to allow no split functions in
addSplitRefRecursiveFunctions(), but it seems better to have the caller
make sure it's not accidentally splitting no functions out.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D94258
2021-01-07 14:06:35 -08:00
Arthur Eubanks d002cd4e0f [test] Move coro-retcon-unreachable.ll into llvm/test
Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D94257
2021-01-07 14:06:01 -08:00
Fangrui Song 85f86e8a3c [libc++abi] Simplify __gxx_personality_v0
In three cases we call `scan_eh_tab` to parse LSDA:

* `actions & _UA_SEARCH_PHASE`
* `actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && !native_exception`
* `actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`

Check
`actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && native_exception` first,
then we can move three `scan_eh_tab` into one place.

Another simplification is that we can check whether the result of `scan_eh_tab`
is `_UA_CONTINUE_UNWIND` or `_UA_FATAL_PHASE1_ERROR` first. Then many of the
original checks will be dead and can thus be deleted.

Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D93186
2021-01-07 14:05:46 -08:00
Jeroen Dobbelaere 63b42a0514 [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name
This makes the test more robust to other changes.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D93038
2021-01-07 16:39:17 -05:00
Matt Arsenault 1f9b6ef91f GlobalISel: Add combine for G_UREM by power of 2
Really I want this in the legalizer, but this is a start.
2021-01-07 16:36:35 -05:00
Mehdi Amini 9e1aaa9943 Fix check-gdb-mlir-support build after MLIR API changed to take Context as first argument 2021-01-07 21:30:39 +00:00
Mehdi Amini 476db17dcb Fix include path for check-gdb-mlir-support to include the MLIR binary dir
This fixes a build failure:

fatal error: 'mlir/IR/BuiltinTypes.h.inc' file not found
2021-01-07 21:29:09 +00:00
Johannes Doerfert 0b0f2e6ee0 [OpenMP][FIX] Avoid string literal comparison, use `StringRef::equal` 2021-01-07 14:53:20 -06:00
Eric Schweitz 70b841ac31 [mlir] Adds argument attributes for using LLVM's sret and byval attributes
to the conversion of LLVM IR dialect. These attributes are used in FIR to
support the lowering of Fortran using target-specific calling conventions.

Add roundtrip tests.

Add changes per review comments/concerns.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D94052
2021-01-07 12:52:14 -08:00
Alexandre Ganea ce7f30b2a8 [llvm-pdbutil] Don't crash when printing unknown CodeView type records
Differential Revision: https://reviews.llvm.org/D93720
2021-01-07 15:44:55 -05:00
Johannes Doerfert 6e7101530d [OpenMP][Docs] Mark finished features as done
Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D94185
2021-01-07 14:39:18 -06:00
Jeffrey T Mott 275f30df8a [clang] Change builtin object size when subobject is invalid
Motivating example:

```
  struct { int v[10]; } t[10];

  __builtin_object_size(
      &t[0].v[11], // access past end of subobject
      1            // request remaining bytes of closest surrounding
                   // subobject
  );
```

In GCC, this returns 0. https://godbolt.org/z/7TeGs7

In current clang, however, this returns 356, the number of bytes
remaining in the whole variable, as if the `type` was 0 instead of 1.
https://godbolt.org/z/6Kffox

This patch checks for the specific case where we're requesting a
subobject's size (type 1) but the subobject is invalid.

Differential Revision: https://reviews.llvm.org/D92892
2021-01-07 12:34:07 -08:00
Johannes Doerfert 36c4dc9b42 [OpenMP][FIX] Ensure the isa trait is evaluated last
Since isa can cause diagnostics we want it to be evaluated last to avoid
the "unknown isa" warning if the rest of the selector wouldn't match
anyway. That allows us to guard isa with arch properly.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D93785
2021-01-07 14:31:20 -06:00
Johannes Doerfert d970a285b8 [OpenMP][Fix] Make the arch selector for x86_64 work
The triple uses a bar "x86-64" instead of an underscore. Since we
have troubles accepting x86-64 as an identifier, we stick with
x86_64 in the frontend and translate it explicitly.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D93786
2021-01-07 14:31:18 -06:00
Johannes Doerfert 9ae171bcd3 [OpenMP][Docs] Add remarks intro section
Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D93735
2021-01-07 14:31:17 -06:00
Alexandre Ganea 3854b81b0f [Clang][Driver] Fix read-after-free when using /clang:
Fixes PR42501.

Differential Revision: https://reviews.llvm.org/D93772
2021-01-07 15:15:13 -05:00
Mehdi Amini 467e916d30 Fix gcc5 build failure (NFC)
The loop index was shadowing the container name.
It seems that we can just not use a for-range loop here since there is
an induction variable anyway.

Differential Revision: https://reviews.llvm.org/D94254
2021-01-07 20:11:57 +00:00
Joseph Huber abb174bbc1 [OpenMP] Add example in Libomptarget Information docs
Add an example to the OpenMP Documentation on the LIBOMPTARGET_INFO environment variable

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94246
2021-01-07 15:00:51 -05:00
dfukalov 6a87e9b08b [NFC][AMDGPU] Reduce include files dependency.
Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D93813
2021-01-07 22:22:05 +03:00
Reid Kleckner ad55d5c3f3 Simplify vectorcall argument classification of HVAs, NFC
This reduces the number of `WinX86_64ABIInfo::classify` call sites from
3 to 1. The call sites were similar, but passed different values for
FreeSSERegs. Use variables instead of `if`s to manage that argument.
2021-01-07 11:14:18 -08:00
Sanjay Patel 4c7148d75c [SLP] remove opcode identifier for reduction; NFC
Another step towards allowing intrinsics in reduction matching.
2021-01-07 14:07:27 -05:00
Alex Zinenko 906efeec0a [mlir] don't match the text produced only in debug mode in Python tests
Some Python bindings tests were using FileCheck to match parts of the
error description produced only in the debug compilation mode. Remove
these parts (but keep the main message) to ensure tests also pass when
running them in the release compilation mode.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94221
2021-01-07 19:57:28 +01:00
Alex Zinenko 2230bf99c7 [mlir] replace LLVMIntegerType with built-in integer type
The LLVM dialect type system has been closed until now, i.e. did not support
types from other dialects inside containers. While this has had obvious
benefits of deriving from a common base class, it has led to some simple types
being almost identical with the built-in types, namely integer and floating
point types. This in turn has led to a lot of larger-scale complexity: simple
types must still be converted, numerous operations that correspond to LLVM IR
intrinsics are replicated to produce versions operating on either LLVM dialect
or built-in types leading to quasi-duplicate dialects, lowering to the LLVM
dialect is essentially required to be one-shot because of type conversion, etc.
In this light, it is reasonable to trade off some local complexity in the
internal implementation of LLVM dialect types for removing larger-scale system
complexity. Previous commits to the LLVM dialect type system have adapted the
API to support types from other dialects.

Replace LLVMIntegerType with the built-in IntegerType plus additional checks
that such types are signless (these are isolated in a utility function that
replaced `isa<LLVMType>` and in the parser). Temporarily keep the possibility
to parse `!llvm.i32` as a synonym for `i32`, but add a deprecation notice.

Reviewed By: mehdi_amini, silvas, antiagainst

Differential Revision: https://reviews.llvm.org/D94178
2021-01-07 19:48:31 +01:00
Wouter van Oortmerssen 5c38ae36c5 [WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION
A struct in C passed by value did not get debug information. Such values are currently
lowered to a Wasm local even in -O0 (not to an alloca like on other archs), which becomes
a Target Index operand (TI_LOCAL). The DWARF writing code was not emitting locations
in for TI's specifically if the location is a single range (not a list).

In addition, the ExplicitLocals pass which removes the ARGUMENT pseudo instructions did
not update the associated DBG_VALUEs, and couldn't even find these values since the code
assumed such instructions are adjacent, which is not the case here.

Also fixed asm printing of TIs needed by a test.

Differential Revision: https://reviews.llvm.org/D94140
2021-01-07 10:31:38 -08:00
Matt Arsenault c9122ddef5 CodeGen: Refactor regallocator command line and target selection
Make the sequence of passes to select and rewrite instructions to
physical registers be a target callback. This is to prepare to allow
targets to split register allocation into multiple phases.
2021-01-07 13:13:25 -05:00
Hiroshi Yamauchi cf5415c727 [PGO][PGSO] Let unroll hints take precedence over PGSO.
Differential Revision: https://reviews.llvm.org/D94199
2021-01-07 10:10:31 -08:00
Alexandre Ganea d0154456e6 Silence warning: comparison of integers of different signs: 'const unsigned int' and 'const long' [-Wsign-compare]
(off_t being a signed type)
2021-01-07 13:01:06 -05:00
Mircea Trofin ee57d30f44 [NFC] Removed unused prefixes from CodeGen/AMDGPU
Last bulk batch.

Differential Revision: https://reviews.llvm.org/D94236
2021-01-07 09:48:14 -08:00
Mehdi Amini 41e31eac14 Fix GCC5 build, require explicit this->... in this call inside a lambda (NFC)
Error was:

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp:2247:36: error: cannot call member function 'mlir::LLVM::FastmathFlags mlir::LLVM::FMFAttr::getFlags() const' without object
     return bitEnumContains(getFlags(), flag);
                                    ^
2021-01-07 17:44:42 +00:00
Eric Schweitz bd78f4e932 [mlir] revert 82f5ee3c3e 2021-01-07 09:38:21 -08:00
Alan Phipps ebcc8dcb68 [Coverage] Refactor three tests from commit rG9f2967bcfe2f
Refactor three tests to not depend on other test files as input but to instead
refer to "Inputs" subdirectory.
2021-01-07 11:18:31 -06:00