Commit Graph

421304 Commits

Author SHA1 Message Date
Vitaly Buka e75d8b7037 Revert "Treat `std::move`, `forward`, and `move_if_noexcept` as builtins."
Revert "Extend support for std::move etc to also cover std::as_const and"
Revert "Update test to handle opaque pointers flag flip."

It crashes on libcxx tests https://lab.llvm.org/buildbot/#/builders/85/builds/8174

This reverts commit fc30901096.
This reverts commit a571f82a50.
This reverts commit 64c045e25b.
2022-04-16 00:27:51 -07:00
Mehdi Amini 709868707c Apply clang-tidy fixes for readability-identifier-naming in OpFormatGen.cpp (NFC) 2022-04-16 06:36:12 +00:00
Mehdi Amini cdbd9c9bab Apply clang-tidy fixes for llvm-qualified-auto in OpFormatGen.cpp (NFC) 2022-04-16 06:36:11 +00:00
River Riddle 0f304ef017 [mlir] Add asserts when changing various MLIRContext configurations
This helps to prevent tsan failures when users inadvertantly mutate the
context in a non-safe way.

Differential Revision: https://reviews.llvm.org/D112021
2022-04-15 21:49:03 -07:00
chenglin.bi 9d9eddd3dd [Arch64][SelectionDAG] Add target-specific implementation of srem
X%C to the equivalent of X-X/C*C is not always fastest path if there is no SDIV pair exist. So check target have faster for srem only first. Add AArch64 faster path for SREM only pow2 case.

Fix https://github.com/llvm/llvm-project/issues/54649

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D122968
2022-04-16 12:29:11 +08:00
Fangrui Song 3ff17b053e [msan][test] Remove legacy PM style opt -foo tests 2022-04-15 21:07:51 -07:00
Peter Klausler 1fe7a187ae [flang][runtime] Don't emit empty lines for bad writes
When an error occurs in a formatted sequential output statement
and no output was ever emitted, don't emit a blank record.
This matches the error case behavior of other Fortran compilers.

Differential Revision: https://reviews.llvm.org/D123734
2022-04-15 20:32:32 -07:00
Jun Zhang 7fde4e2213
Add some helpers to better check Scope's kind. NFC
Signed-off-by: Jun Zhang <jun@junz.org>
2022-04-16 11:31:40 +08:00
Peter Klausler 9f5f2eb2a1 [flang] Accept %KIND type parameter inquiries on %RE,%IM, &c.
The x%KIND inquiry needs to be supported when 'x' is itself
a complex part reference or a type parameter inquiry.

Differential Revision: https://reviews.llvm.org/D123733
2022-04-15 20:22:03 -07:00
Peter Klausler de6e88ef5a [flang] Allow POINTER attribute statement on procedure interfaces
A POINTER attribute statement is allowed to add the POINTER attribute
to a procedure entity that has already been declared, e.g. with an
INTERFACE block.

Differential Revision: https://reviews.llvm.org/D123732
2022-04-15 20:20:56 -07:00
Fangrui Song 468c7b65e5 [test] Test -Werror=foo -Wfoo & -Werror -Wno-error=foo -Wfoo
Clang now matches GCC in the two cases.

D109981 fixed the second case though it did not call out the effect.
2022-04-15 20:14:07 -07:00
Peter Klausler 847c39838e [flang] Upgrade short actual character arguments to errors
f18 was emitting a warning about short character actual arguments to
subprograms and statement functions; every other compiler considers this
case to be an error.

Differential Revision: https://reviews.llvm.org/D123731
2022-04-15 20:05:04 -07:00
Fangrui Song 01252b4815 [asan][test] Remove legacy PM style opt -foo tests 2022-04-15 20:00:56 -07:00
Weining Lu dd018b96d4 [LoongArch] Fix typo that SP should be R3 but not R2 2022-04-16 10:01:20 +08:00
Peter Klausler 64aff3632f [flang][runtime] Fix ENDFILE for formatted stream output
A predicate expression made ENDFILE statements significant
only for sequential files, but it's applicable to formatted
stream output as well.

Differential Revision: https://reviews.llvm.org/D123730
2022-04-15 18:57:29 -07:00
Shilei Tian e8760b51ee [Clang][OpenMP] Use bitfields for flags in `OMPAtomicDirective`
As suggested in D120290.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D123862
2022-04-15 21:34:28 -04:00
Joseph Huber 33b604d1c3 [OpenMP] Fix linting diagnostics in the linker wrapper
Summary:
A previous patch had some linter warnings that should've been addressed.
2022-04-15 21:19:29 -04:00
Chris Bieneman 329abac134 Blind stab in the dark to fix a bot failure
*fingers crossed*
2022-04-15 20:12:59 -05:00
Mogball b1d3faab7a [NFC] fix cmake build 2022-04-16 00:56:38 +00:00
Mehdi Amini 94244bda9d Apply clang-tidy fixes for readability-identifier-naming in mlir-parser-fuzzer.cpp (NFC) 2022-04-16 00:44:51 +00:00
Mehdi Amini fc9e440942 Apply clang-tidy fixes for readability-identifier-naming in DummyParserFuzzer.cpp (NFC) 2022-04-16 00:44:51 +00:00
Craig Topper ac8c720d48 [IR] Allow constant folding (insertelement <vscale x 2 x i32> zeroinitializer, i32 0, i32 i32 0.
Most of insertelement constant folding is blocked if the vector type
is scalable. I believe we can make an exception for inserting null
into an all zeros vector.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D123413
2022-04-15 17:44:32 -07:00
Mogball fa26c7ff4b [mlir] Refactor LICM into a utility
LICM is refactored into a utility that is application on any region. The implementation is moved to Transform/Utils.
2022-04-16 00:37:07 +00:00
Joseph Huber 984a0dc386 [OpenMP] Use new offloading binary when embedding offloading images
The previous patch introduced the offloading binary format so we can
store some metada along with the binary image. This patch introduces
using this inside the linker wrapper and Clang instead of the previous
method that embedded the metadata in the section name.

Differential Revision: https://reviews.llvm.org/D122683
2022-04-15 20:35:26 -04:00
Joseph Huber cac81161ed [OpenMP] Don't manually strip sections in the linker wrapper
Summary:
The changes in D122987 ensures that the offloading sections always have
the SHF_EXCLUDE flag. This means that we do not need to manually strip
these sections for ELF or COFF targets.
2022-04-15 20:35:25 -04:00
Matt Arsenault 193fde7509 llvm-reduce: Clone some of the easy function properties
Error on some of these other fields, since tracking down test cases
for all of these at once is exhausting.
2022-04-15 20:31:07 -04:00
Matt Arsenault b8033de063 MIR: Serialize a few bool function fields 2022-04-15 20:31:07 -04:00
Craig Topper 9d86bf825c [X86] Move hasOneUse check after opcode check. NFC
Checking opcode is cheap. hasOneUse might not be if the node has
multiple results. By checking the opcode we can rule out nodes
with multiple results we aren't interested in.
2022-04-15 17:20:57 -07:00
Stella Stamenova 353f0a8e43 Revert "[mlir] Refactor LICM into a utility"
This reverts commit 3131f80824.

This commit broke the Windows mlir bot:
https://lab.llvm.org/buildbot/#/builders/13/builds/19745
2022-04-15 17:09:16 -07:00
Craig Topper c6dc229a6d [DAGCombiner] Move call to hasOneUse after opcode checks. NFC
Checking the opcode is cheap, counting the number of uses is not.
2022-04-15 17:02:16 -07:00
Chris Bieneman f2526c1a5c Add DXIL Bitcode Writer and DXIL testing
This change is a big blob of code that isn't easy to break up. It
either comes in all together as a blob, works and has tests, or it
doesn't do anything.

Logically you can think of this patch as three things:
(1) Adding virtual interfaces so the bitcode writer can be overridden
(2) Adding a new bitcode writer implementation for DXIL
(3) Adding some (optional) crazy CMake goop to build the
DirectXShaderCompiler's llvm-dis as dxil-dis for testing

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D122082
2022-04-15 18:50:26 -05:00
Craig Topper a7b9d75e7a [DAGCombiner] Move or/xor/and opcode check in ReduceLoadOpStoreWidth before hasOneUse check.
hasOneUse is not cheap on nodes with chain results that might have
many uses. By checking the opcode first, we can avoid a costly walk
of the use list on nodes we aren't interested in.

Found by investigating calls to hasNUsesOfValue from the example
provided in D123857.
2022-04-15 16:38:27 -07:00
Johannes Doerfert 81143b69dd [Attributor][FIX] Use AttributorConfig in the unit tests too 2022-04-15 18:36:38 -05:00
Richard Smith fc30901096 Extend support for std::move etc to also cover std::as_const and
std::addressof, plus the libstdc++-specific std::__addressof.

This brings us to parity with the corresponding GCC behavior.

Remove STDBUILTIN macro that ended up not being used.
2022-04-15 16:31:39 -07:00
Peter Klausler 9e7eef9989 [flang] Handle parameter-dependent types in PDT initializers
For parameterized derived type component initializers whose
expressions' types depend on parameter values, f18's current
scheme of analyzing the initialization expression once during
name resolution fails.  For example,

  type :: pdt(k)
    integer, kind :: k
    real :: component = real(0.0, kind=k)
  end type

To handle such cases, it is necessary to re-analyze the parse
trees of these initialization expressions once for each distinct
initialization of the type.

This patch adds code to wipe an expression parse tree of its
typed expressions, and update those of its symbol table pointers
that reference type parameters, and then re-analyze that parse
tree to generate the properly typed component initializers.

Differential Revision: https://reviews.llvm.org/D123728
2022-04-15 16:20:41 -07:00
Johannes Doerfert 3be3b40188 [Attributor][NFCI] Introduce AttributorConfig to bundle all options
Instead of lengthy constructors we can now set the members of a
read-only struct before the Attributor is created. Should make it
clearer what is configurable and also help introducing new options in
the future. This actually added IsModulePass and avoids deduction
through the Function set size. No functional change was intended.
2022-04-15 18:17:19 -05:00
Bill Wendling 2a404cdfd8 [randstruct] Force errors for all platforms 2022-04-15 15:17:07 -07:00
Mogball 3131f80824 [mlir] Refactor LICM into a utility
LICM is refactored into a utility that is application on any region. The implementation is moved to Transform/Utils.
2022-04-15 22:07:01 +00:00
Richard Smith a571f82a50 Update test to handle opaque pointers flag flip. 2022-04-15 14:51:30 -07:00
Pavel Kosov a5b7ea0783 [llvm-objdump] Implemented PrintBranchImmAsAddress for MIPS
Updated MipsInstPrinter to print absolute hex offsets for branch instructions.
It is necessary to make the llvm-objdump output close to the gnu objdump output.
This implementation is based on the implementation for RISC-V.

OS Laboratory. Huawei Russian Research Institute. Saint-Petersburg

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D123764
2022-04-15 23:48:38 +02:00
Vitaly Buka eb4d22917e [msan] Set poison_in_dtor=1 by default
It's still disabled by default at compile time.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D123875
2022-04-15 14:40:23 -07:00
Peter Klausler 7e225423d3 [flang] Finer control over error recovery with GetExpr()
Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that has not been set by expression semantics.  This is the
right behavior when called from lowering, by which time it is known
that the program had no fatal user errors, since it signifies a
fatal internal error.  However, prior to lowering, in the statement
semantics checking code, a more nuanced test should be used before
crashing -- specifically, we should not crash in the face of a
missing typed expression when in error recovery mode.

Getting this right requires GetExpr() and its helper class to have
access to the semantics context, so that it can check AnyFatalErrors()
before crashing.  So this patch touches nearly all of its call sites.

Differential Revision: https://reviews.llvm.org/D123873
2022-04-15 14:25:41 -07:00
Richard Smith 64c045e25b Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.
We still require these functions to be declared before they can be used,
but don't instantiate their definitions unless their addresses are
taken. Instead, code generation, constant evaluation, and static
analysis are given direct knowledge of their effect.

This change aims to reduce various costs associated with these functions
-- per-instantiation memory costs, compile time and memory costs due to
creating out-of-line copies and inlining them, code size at -O0, and so
on -- so that they are not substantially more expensive than a cast.
Most of these improvements are very small, but I measured a 3% decrease
in -O0 object file size for a simple C++ source file using the standard
library after this change.

We now automatically infer the `const` and `nothrow` attributes on these
now-builtin functions, in particular meaning that we get a warning for
an unused call to one of these functions.

In C++20 onwards, we disallow taking the addresses of these functions,
per the C++20 "addressable function" rule. In earlier language modes, a
compatibility warning is produced but the address can still be taken.

The same infrastructure is extended to the existing MSVC builtin
`__GetExceptionInfo`, which is now only recognized in namespace `std`
like it always should have been.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D123345
2022-04-15 14:09:45 -07:00
Florian Hahn 73f5d7d0d6
[VPlan] Handle equal address and store ops in onlyFirstLaneDemanded.
With opaque pointers, the stored value and address can be the same.

Previously the code in VPWidenMemoryInstructionRecipe::onlyFirstLaneDemanded
incorrectly considers stores with matching store and pointer operands as
only demanding the first lane, causing a crash.
2022-04-15 22:53:33 +02:00
Chih-Ping Chen eab6e94f91 [DebugInfo] Add a TargetFuncName field in DISubprogram for
specifying DW_AT_trampoline as a string. Also update the signature
of DIBuilder::createFunction to reflect this addition.

Differential Revision: https://reviews.llvm.org/D123697
2022-04-15 16:38:23 -04:00
Johannes Doerfert 39a68cc016 Revert "[Attributor] CGSCC pass should not recompute results outside the SCC"
This reverts commit 0d7f81e313, it caused
the AMDGPU tests that use the Attributor to fail.
2022-04-15 15:29:51 -05:00
Lang Hames 0d11351bd7 [JITLink] Add missing moves from 43acef48d3. 2022-04-15 12:58:22 -07:00
River Riddle ac860240ad [mlir][NFC] Cleanup the TestClone pass
Fix variable naming convention and cleanup a clang-tidy warning.
2022-04-15 12:57:07 -07:00
River Riddle 31c88660ab [mlir] Remove the use of FilterTypes for template metaprogramming
This technique results in an explosion in compile time, resulting from a
huge number of std::tuple/concat instatiations. This technique is replaced
by simpler metaprogramming and results in a signficant reduction in
compile time. A local debug/asan build saw a 4x speed up in the processing
of ArithmeticOps.h.inc, and given the nature of this change every dialect
should see similar reductions in compile time.

Differential Revision: https://reviews.llvm.org/D123360
2022-04-15 12:57:07 -07:00
Johannes Doerfert 04f3a224bc [Attributor][NFC] Introduce a flag to distinguish the scope of a query 2022-04-15 14:56:10 -05:00