Peter Klausler [Tue, 12 Apr 2022 01:57:59 +0000 (18:57 -0700)]
[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
Fangrui Song [Sat, 16 Apr 2022 03:14:07 +0000 (20:14 -0700)]
[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.
Peter Klausler [Tue, 12 Apr 2022 01:39:02 +0000 (18:39 -0700)]
[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
Fangrui Song [Sat, 16 Apr 2022 03:00:56 +0000 (20:00 -0700)]
[asan][test] Remove legacy PM style opt -foo tests
Weining Lu [Sat, 9 Apr 2022 08:52:24 +0000 (16:52 +0800)]
[LoongArch] Fix typo that SP should be R3 but not R2
Peter Klausler [Tue, 12 Apr 2022 00:12:39 +0000 (17:12 -0700)]
[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
Shilei Tian [Sat, 16 Apr 2022 01:34:19 +0000 (21:34 -0400)]
[Clang][OpenMP] Use bitfields for flags in `OMPAtomicDirective`
As suggested in D120290.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D123862
Joseph Huber [Sat, 16 Apr 2022 01:18:56 +0000 (21:18 -0400)]
[OpenMP] Fix linting diagnostics in the linker wrapper
Summary:
A previous patch had some linter warnings that should've been addressed.
Chris Bieneman [Sat, 16 Apr 2022 01:12:52 +0000 (20:12 -0500)]
Blind stab in the dark to fix a bot failure
*fingers crossed*
Mogball [Sat, 16 Apr 2022 00:56:38 +0000 (00:56 +0000)]
[NFC] fix cmake build
Mehdi Amini [Mon, 4 Apr 2022 00:28:26 +0000 (00:28 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in mlir-parser-fuzzer.cpp (NFC)
Mehdi Amini [Mon, 4 Apr 2022 00:27:44 +0000 (00:27 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in DummyParserFuzzer.cpp (NFC)
Craig Topper [Sat, 16 Apr 2022 00:32:42 +0000 (17:32 -0700)]
[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
Mogball [Sat, 16 Apr 2022 00:36:22 +0000 (00:36 +0000)]
[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.
Joseph Huber [Fri, 25 Mar 2022 15:03:02 +0000 (11:03 -0400)]
[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
Joseph Huber [Wed, 13 Apr 2022 17:43:47 +0000 (13:43 -0400)]
[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.
Matt Arsenault [Thu, 14 Apr 2022 14:59:37 +0000 (10:59 -0400)]
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.
Matt Arsenault [Thu, 14 Apr 2022 20:16:08 +0000 (16:16 -0400)]
MIR: Serialize a few bool function fields
Craig Topper [Sat, 16 Apr 2022 00:19:07 +0000 (17:19 -0700)]
[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.
Stella Stamenova [Sat, 16 Apr 2022 00:09:05 +0000 (17:09 -0700)]
Revert "[mlir] Refactor LICM into a utility"
This reverts commit
3131f808243abe3746280e016ab9459c14d9e53b.
This commit broke the Windows mlir bot:
https://lab.llvm.org/buildbot/#/builders/13/builds/19745
Craig Topper [Sat, 16 Apr 2022 00:01:40 +0000 (17:01 -0700)]
[DAGCombiner] Move call to hasOneUse after opcode checks. NFC
Checking the opcode is cheap, counting the number of uses is not.
Chris Bieneman [Thu, 14 Apr 2022 18:37:44 +0000 (13:37 -0500)]
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
Craig Topper [Fri, 15 Apr 2022 23:33:12 +0000 (16:33 -0700)]
[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.
Johannes Doerfert [Fri, 15 Apr 2022 23:29:22 +0000 (18:29 -0500)]
[Attributor][FIX] Use AttributorConfig in the unit tests too
Richard Smith [Fri, 15 Apr 2022 21:45:30 +0000 (14:45 -0700)]
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.
Peter Klausler [Wed, 13 Apr 2022 17:39:16 +0000 (10:39 -0700)]
[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
Johannes Doerfert [Fri, 15 Apr 2022 21:15:07 +0000 (16:15 -0500)]
[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.
Bill Wendling [Fri, 15 Apr 2022 22:11:29 +0000 (15:11 -0700)]
[randstruct] Force errors for all platforms
Mogball [Fri, 15 Apr 2022 17:52:34 +0000 (17:52 +0000)]
[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.
Richard Smith [Fri, 15 Apr 2022 21:51:30 +0000 (14:51 -0700)]
Update test to handle opaque pointers flag flip.
Pavel Kosov [Fri, 15 Apr 2022 21:48:38 +0000 (23:48 +0200)]
[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
Vitaly Buka [Fri, 15 Apr 2022 20:54:35 +0000 (13:54 -0700)]
[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
Peter Klausler [Fri, 15 Apr 2022 20:23:16 +0000 (13:23 -0700)]
[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
Richard Smith [Fri, 1 Apr 2022 01:40:40 +0000 (18:40 -0700)]
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
Florian Hahn [Fri, 15 Apr 2022 20:52:46 +0000 (22:52 +0200)]
[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.
Chih-Ping Chen [Wed, 6 Apr 2022 12:22:49 +0000 (08:22 -0400)]
[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
Johannes Doerfert [Fri, 15 Apr 2022 20:29:20 +0000 (15:29 -0500)]
Revert "[Attributor] CGSCC pass should not recompute results outside the SCC"
This reverts commit
0d7f81e31315f8cda56ce6fde5ff5145e0325c51, it caused
the AMDGPU tests that use the Attributor to fail.
Lang Hames [Fri, 15 Apr 2022 19:57:19 +0000 (12:57 -0700)]
[JITLink] Add missing moves from
43acef48d38e.
River Riddle [Fri, 15 Apr 2022 19:55:15 +0000 (12:55 -0700)]
[mlir][NFC] Cleanup the TestClone pass
Fix variable naming convention and cleanup a clang-tidy warning.
River Riddle [Fri, 8 Apr 2022 04:36:40 +0000 (21:36 -0700)]
[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
Johannes Doerfert [Tue, 12 Apr 2022 21:38:11 +0000 (16:38 -0500)]
[Attributor][NFC] Introduce a flag to distinguish the scope of a query
Johannes Doerfert [Tue, 12 Apr 2022 21:24:37 +0000 (16:24 -0500)]
[Attributor] CGSCC pass should not recompute results outside the SCC
When we run the CGSCC pass we should only invest time on the SCC. We can
initialize AAs with information from the module slice but we should not
update those AAs.
Johannes Doerfert [Tue, 12 Apr 2022 21:05:32 +0000 (16:05 -0500)]
[Attributor][NFC] Code cleanup to minimize follow up changes
Johannes Doerfert [Sat, 9 Apr 2022 16:45:32 +0000 (11:45 -0500)]
[Attributor][NFC] Rename AAPotentialValues to AAPotentialConstantValues
Lang Hames [Fri, 15 Apr 2022 18:22:26 +0000 (11:22 -0700)]
[JITLink] Refactor and expand DWARF pointer encoding support.
Adds support for pointer encodings commonly used in large/static models,
including non-pcrel, sdata/udata8, indirect, and omit.
Also refactors pointer-encoding handling to consolidate error generation inside
common functions, rather than callees of those functions.
Arthur Eubanks [Fri, 15 Apr 2022 19:38:11 +0000 (12:38 -0700)]
[test][LoopDeletion] Precommit test
Arjun P [Tue, 12 Apr 2022 12:07:25 +0000 (13:07 +0100)]
[MLIR][Presburger] addSymbolicCut: fix the integral symbols heuristic to match the docs
Previously this checked if the entire symbolic numerator was divisible by the
denominator, which is never the case when this function is called. Fixed this to
check only the non-const coefficients in the numerator, which was what was
intended and documented.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D123592
Bill Wendling [Fri, 15 Apr 2022 18:37:52 +0000 (11:37 -0700)]
[randstruct] Enforce using a designated init for a randomized struct
A randomized structure needs to use a designated or default initializer.
Using a non-designated initializer will result in values being assigned
to the wrong fields.
Differential Revision: https://reviews.llvm.org/D123763
LLVM GN Syncbot [Fri, 15 Apr 2022 19:23:18 +0000 (19:23 +0000)]
[gn build] Port
721651be246e
Thomas Raoux [Fri, 15 Apr 2022 18:44:43 +0000 (18:44 +0000)]
[mlir][vector] Fix bug in extractFromBroadcast folding
extract was incorrectly folded when the source was coming from a
broadcast that was both adding new rank and broadcasting the inner
dimension.
Differential Revision: https://reviews.llvm.org/D123867
Alexandre Ganea [Mon, 11 Apr 2022 21:22:53 +0000 (17:22 -0400)]
[Support][cmake] Fix snmalloc integration. NFC.
When using LLVM_INTEGRATED_CRT_ALLOC, fix compiling with the latest snmalloc at ToT (https://github.com/microsoft/snmalloc).
Xiang Li [Fri, 15 Apr 2022 19:09:10 +0000 (14:09 -0500)]
[HLSL][clang][Driver] Support target profile command line option.
The target profile option(/T) decide the shader model when compile hlsl.
The format is shaderKind_major_minor like ps_6_1.
The shader model is saved as llvm::Triple is clang/llvm like
dxil-unknown-shadermodel6.1-hull.
The main job to support the option is translating ps_6_1 into
shadermodel6.1-pixel.
That is done inside tryParseProfile at HLSL.cpp.
To integrate the option into clang Driver, a new DriverMode DxcMode is
created. When DxcMode is enabled, OSType for TargetTriple will be
forced into Triple::ShaderModel. And new ToolChain HLSLToolChain will
be created when OSType is Triple::ShaderModel.
In HLSLToolChain, ComputeEffectiveClangTriple is overridden to call
tryParseProfile when targetProfile option is set.
To make test work, Fo option is added and .hlsl is added for active
-xhlsl.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D122865
Patch by: Xiang Li <python3kgae@outlook.com>
Arjun P [Tue, 12 Apr 2022 13:20:32 +0000 (14:20 +0100)]
[MLIR][Presburger][Simplex] moveRowUnknownToColumn: support the row sample value being zero
When the sample value is zero, everything is the same except that failure to
pivot does not imply emptiness. So, leave it to the user to mark as empty if
necessary, if they know the sample value is strictly negative. This is needed
for an upcoming symbolic lexmin heuristic.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D123604
William S. Moses [Fri, 15 Apr 2022 19:14:06 +0000 (15:14 -0400)]
[MLIR][ClonePass] Attempt fix for anonymous pass name
Eli Friedman [Thu, 14 Apr 2022 22:20:37 +0000 (15:20 -0700)]
Fix size of flexible array initializers, and re-enable assertions.
In D123649, I got the formula for getFlexibleArrayInitChars slightly
wrong: the flexible array elements can be contained in the tail padding
of the struct. Fix the formula to account for that.
With the fixed formula, we run into another issue: in some cases, we
were emitting extra padding for flexible arrray initializers. Fix
CGExprConstant so it uses a packed struct when necessary, to avoid this
extra padding.
Differential Revision: https://reviews.llvm.org/D123826
Zequan Wu [Fri, 15 Apr 2022 19:08:38 +0000 (12:08 -0700)]
rdzhabarov [Fri, 15 Apr 2022 18:59:03 +0000 (18:59 +0000)]
[mlir] Fix BUILD issues and dependencies.
Differential Revision: https://reviews.llvm.org/D123868
Zequan Wu [Fri, 15 Apr 2022 18:59:00 +0000 (11:59 -0700)]
[LLDB][NativePDB] Don't create inlined function parameters when it's malformed.
Johannes Doerfert [Wed, 13 Apr 2022 19:39:15 +0000 (14:39 -0500)]
[DWARF][FIX] Handle the use of multiple registers gracefully
Certain applications crashed for us with the AMDGPU backend. While this
is not a proper fix it allows us to compile the code for now. I left a
TODO for someone that understands DWARF.
Differential Revision: https://reviews.llvm.org/D123717
Johannes Doerfert [Wed, 13 Apr 2022 17:35:34 +0000 (12:35 -0500)]
[AMDGPU][FIX] Proper load-store-vectorizer result with opaque pointers
The original code relied on the fact that we needed a bitcast
instruction (for non constant base objects). With opaque pointers there
might not be a bitcast. Always check if reordering is required instead.
Fixes: https://github.com/llvm/llvm-project/issues/54896
Differential Revision: https://reviews.llvm.org/D123694
William S. Moses [Fri, 15 Apr 2022 18:32:44 +0000 (14:32 -0400)]
[NFC] Update comments
Aaron Ballman [Fri, 15 Apr 2022 18:03:46 +0000 (14:03 -0400)]
Fix an edge case in determining is a function has a prototype
Given the declaration:
typedef void func_t(unsigned);
__attribute__((noreturn)) func_t func;
we would incorrectly determine that `func` had no prototype because the
`noreturn` attribute would convert the underlying type directly into a
FunctionProtoType, but the declarator for `func` itself was not one for
a function with a prototype. This adds an additional check for when the
declarator is a type representation for a function with a prototype.
Zequan Wu [Fri, 15 Apr 2022 17:36:06 +0000 (10:36 -0700)]
[LLDB][NativePDB] Fix subfield_register_simple_type.s test
Mogball [Tue, 12 Apr 2022 00:50:20 +0000 (00:50 +0000)]
[mlir] Update LICM to support Graph Regions
Changes the algorithm of LICM to support graph regions (no guarantee of topologically sorted order). Also fixes an issue where ops with recursive side effects and regions would not be hoisted if any nested ops used operands that were defined within the nested region.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D122465
Fangrui Song [Fri, 15 Apr 2022 17:26:43 +0000 (10:26 -0700)]
[PGO] Remove legacy PM passes
Legacy PM for optimization pipeline was deprecated in 13.0.0 and Clang dropped
legacy PM support in D123609. This change removes legacy PM passes for PGO so
that downstream projects won't be able to use it. It seems appropriate to start
removing such "add-on" features like instrumentations, before we remove more
stuff after 15.x is branched.
I have checked many LLVM users and only ldc[1] uses the legacy PGO pass.
[1]: https://github.com/ldc-developers/ldc/issues/3961
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D123834
William S. Moses [Sat, 26 Mar 2022 18:42:15 +0000 (14:42 -0400)]
[MLIR] Fix operation clone
Operation clone is currently faulty.
Suppose you have a block like as follows:
```
(%x0 : i32) {
%x1 = f(%x0)
return %x1
}
```
The test case we have is that we want to "unroll" this, in which we want to change this to compute `f(f(x0))` instead of just `f(x0)`. We do so by making a copy of the body at the end of the block and set the uses of the argument in the copy operations with the value returned from the original block.
This is implemented as follows:
1) map to the block arguments to the returned value (`map[x0] = x1`).
2) clone the body
Now for this small example, this works as intended and we get the following.
```
(%x0 : i32) {
%x1 = f(%x0)
%x2 = f(%x1)
return %x2
}
```
This is because the current logic to clone `x1 = f(x0)` first looks up the arguments in the map (which finds `x0` maps to `x1` from the initialization), and then sets the map of the result to the cloned result (`map[x1] = x2`).
However, this fails if `x0` is not an argument to the op, but instead used inside the region, like below.
```
(%x0 : i32) {
%x1 = f() {
yield %x0
}
return %x1
}
```
This is because cloning an op currently first looks up the args (none), sets the map of the result (`map[%x1] = %x2`), and then clones the regions. This results in the following, which is clearly illegal:
```
(%x0 : i32) {
%x1 = f() {
yield %x0
}
%x2 = f() {
yield %x2
}
return %x2
}
```
Diving deeper, this is partially due to the ordering (how this PR fixes it), as well as how region cloning works. Namely it will first clone with the mapping, and then it will remap all operands. Since the ordering above now has a map of `x0 -> x1` and `x1 -> x2`, we end up with the incorrect behavior here.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122531
Peter Klausler [Wed, 6 Apr 2022 22:55:53 +0000 (15:55 -0700)]
[flang] Fix Symbol::Rank for ProcEntityDetails
When a procedure pointer or procedure dummy argument has a
defined interface, the rank of the pointer (or dummy) is the
rank of the interface.
Also tweak code discovered in shape analysis when investigating
this problam so that it returns a vector of emptied extents rather
than std::nullopt when the extents are not scope-invariant, so that
the rank can at least be known.
Differential Revision: https://reviews.llvm.org/D123727
jfurtek [Fri, 15 Apr 2022 16:41:56 +0000 (16:41 +0000)]
[mlir][ods][NFC] Move enum attribute definitions from OpBase.td to EnumAttr.td
This diff moves `EnumAttr` tablegen definitions (specifically, `IntEnumAttr` and
`BitEnumAttr`-related classes) from `OpBase.td` to `EnumAttr.td`. No
functionality is changed.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123551
Alex Zinenko [Fri, 15 Apr 2022 10:00:55 +0000 (12:00 +0200)]
[mlir] Support opaque types in LLVM IR -> MLIR translation
LLVM IR is moving towards adoption of opaque pointer types. These require extra
information to be passed when constructing some operations, in particular GEP
and Alloca. Adapt the builders of said operations and modify the translation
code to handle both opaque and non-opaque pointers.
This incidentally adds the translation for Alloca alignment and fixes the translation
of struct-related GEP indices that must be constant.
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D123792
Aaron Ballman [Fri, 15 Apr 2022 15:45:52 +0000 (11:45 -0400)]
Properly identify builtins in a diagnostic note
When emitting a "conflicting types" warning for a function declaration,
it's more clear to diagnose the previous declaration specifically as
being a builtin if it one.
Shilei Tian [Fri, 15 Apr 2022 15:39:04 +0000 (11:39 -0400)]
Clean up `OMPAtomicDirective::Create`
Fraser Cormack [Fri, 15 Apr 2022 08:34:04 +0000 (09:34 +0100)]
[VP] Rename ISD::VP_FPROUND and ISD::VP_FPEXT
Rename them to be more closely related to their non-VP counterparts.
Reviewed By: jacquesguan, ym1813382441
Differential Revision: https://reviews.llvm.org/D123847
Daniil Kovalev [Fri, 15 Apr 2022 15:11:24 +0000 (18:11 +0300)]
[NFC][UpdateTestChecks] Fix whitespace in common.py and asm.py
While working on D122986, noticed that indentation size varies even within
one file. Fixed that - now indentation is 2 spaces everywhere. This indentation
Differential Revision: https://reviews.llvm.org/D123859
Corentin Jabot [Sun, 6 Feb 2022 21:58:43 +0000 (22:58 +0100)]
[clang] Implement Change scope of lambda trailing-return-type
Implement P2036R3.
Captured variables by copy (explicitely or not), are deduced
correctly at the point we know whether the lambda is mutable,
and ill-formed before that.
Up until now, the entire lambda declaration up to the start of the body would be parsed in the parent scope, such that capture would not be available to look up.
The scoping is changed to have an outer lambda scope, followed by the lambda prototype and body.
The lambda scope is necessary because there may be a template scope between the start of the lambda (to which we want to attach the captured variable) and the prototype scope.
We also need to introduce a declaration context to attach the captured variable to (and several parts of clang assume captures are handled from the call operator context), before we know the type of the call operator.
The order of operations is as follow:
* Parse the init capture in the lambda's parent scope
* Introduce a lambda scope
* Create the lambda class and call operator
* Add the init captures to the call operator context and the lambda scope. But the variables are not capured yet (because we don't know their type).
Instead, explicit captures are stored in a temporary map that conserves the order of capture (for the purpose of having a stable order in the ast dumps).
* A flag is set on LambdaScopeInfo to indicate that we have not yet injected the captures.
* The parameters are parsed (in the parent context, as lambda mangling recurses in the parent context, we couldn't mangle a lambda that is attached to the context of a lambda whose type is not yet known).
* The lambda qualifiers are parsed, at this point We can switch (for the second time) inside the lambda context, unset the flag indicating that we have not parsed the lambda qualifiers,
record the lambda is mutable and capture the explicit variables.
* We can parse the rest of the lambda type, transform the lambda and call operator's types and also transform the call operator to a template function decl where necessary.
At this point, both captures and parameters can be injected in the body's scope. When trying to capture an implicit variable, if we are before the qualifiers of a lambda, we need to remember that the variables are still in the parent's context (rather than in the call operator's).
Reviewed By: aaron.ballman, #clang-language-wg, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D119136
Roman Lebedev [Fri, 15 Apr 2022 13:24:46 +0000 (16:24 +0300)]
[NFC][Costmodel][LV][X86] Refresh one or two interleaved load/store tests
Jan Svoboda [Mon, 11 Apr 2022 08:20:38 +0000 (10:20 +0200)]
[clang][deps] NFC: Update documentation
Jan Svoboda [Mon, 11 Apr 2022 08:20:20 +0000 (10:20 +0200)]
[clang][deps] NFC: Inline function with single caller
Jun Zhang [Fri, 15 Apr 2022 07:14:38 +0000 (15:14 +0800)]
[Clang][Sema] Fix invalid redefinition error in if/switch/for statement
Clang should no longer incorrectly diagnose a variable declaration inside of a
lambda expression that shares the name of a variable in a containing
if/while/for/switch init statement as a redeclaration.
After this patch, clang is supposed to accept code below:
void foo() {
for (int x = [] { int x = 0; return x; }(); ;) ;
}
Fixes https://github.com/llvm/llvm-project/issues/54913
Differential Revision: https://reviews.llvm.org/D123840
Dmitri Gribenko [Fri, 15 Apr 2022 13:45:18 +0000 (15:45 +0200)]
Adjust Bazel BUILD files for
6d45558c1
Amir Ayupov [Fri, 15 Apr 2022 13:13:19 +0000 (06:13 -0700)]
[BOLT] Check if LLVM_REVISION is defined
Handle the case where LLVM_REVISION is undefined (due to LLVM_APPEND_VC_REV=OFF
or otherwise) by setting "<unknown>" value as before D123549.
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D123852
Aaron Ballman [Fri, 15 Apr 2022 13:19:25 +0000 (09:19 -0400)]
Fix failing test case found by bots:
https://lab.llvm.org/buildbot#builders/109/builds/36683
https://lab.llvm.org/buildbot#builders/164/builds/15456
(and others)
Jan Svoboda [Fri, 15 Apr 2022 12:48:34 +0000 (14:48 +0200)]
[clang][lex] NFC: Use FileEntryRef in PreprocessorLexer::getFileEntry()
This patch changes the return type of `PreprocessorLexer::getFileEntry()` so that its clients may stop using the deprecated APIs of `FileEntry`.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123772
Jan Svoboda [Fri, 15 Apr 2022 12:48:27 +0000 (14:48 +0200)]
[clang] NFCI: Use FileEntryRef in FileManagerTest
This patch removes use of the deprecated `{File,Directory}Entry::getName()` from `FileManager` unit tests by using `{File,Directory}EntryRef` instead.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123770
Jan Svoboda [Fri, 15 Apr 2022 12:48:19 +0000 (14:48 +0200)]
[clang] NFCI: Use DirectoryEntryRef in collectIncludePCH
This patch removes use of the deprecated `DirectoryEntry::getName()` from `collectIncludePCH` by using `{File,Directory}EntryRef` instead.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123769
Jan Svoboda [Fri, 15 Apr 2022 12:48:01 +0000 (14:48 +0200)]
[clang][CodeGen] NFCI: Use FileEntryRef
This patch removes use of the deprecated `DirectoryEntry::getName()` from clangCodeGen by using `{File,Directory}EntryRef` instead.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123768
Jan Svoboda [Fri, 15 Apr 2022 12:47:34 +0000 (14:47 +0200)]
[clang][parse] NFCI: Use FileEntryRef in Parser::ParseModuleImport()
This patch removes use of the deprecated `DirectoryEntry::getName()` from `Parser` by using `{File,Directory}EntryRef` instead.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123767
Aaron Ballman [Fri, 15 Apr 2022 13:07:28 +0000 (09:07 -0400)]
[C89/C2x] Diagnose calls to a function without a prototype but passes arguments
This catches places where a function without a prototype is
accidentally used, potentially passing an incorrect number of
arguments, and is a follow-up to the work done in
https://reviews.llvm.org/D122895 and described in the RFC
(https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c).
The diagnostic is grouped under the new -Wdeprecated-non-prototypes
warning group and is enabled by default.
The diagnostic is disabled if the function being called was implicitly
declared (the user already gets an on-by-default warning about the
creation of the implicit function declaration, so no need to warn them
twice on the same line). Additionally, the diagnostic is disabled if
the declaration of the function without a prototype was in a location
where the user explicitly disabled deprecation warnings for functions
without prototypes (this allows the provider of the API a way to
disable the diagnostic at call sites because the lack of prototype is
intentional).
Lei Zhang [Fri, 15 Apr 2022 12:57:24 +0000 (08:57 -0400)]
[mlir][vector] Reorder elementwise(transpose)
Similar to the existing pattern for reodering cast(transpose),
this makes transpose following transpose and increases the chance
of embedding the transposition inside contraction op. Actually
cast ops are just special instances of elementwise ops.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D123596
Momchil Velikov [Fri, 15 Apr 2022 11:19:02 +0000 (12:19 +0100)]
[AArch64] Async unwind - Fix MTE codegen emitting frame adjustments in a loop
When untagging the stack, the compiler may emit a sequence like:
```
.LBB0_1:
st2g sp, [sp], #32
sub x8, x8, #32
cbnz x8, .LBB0_1
stg sp, [sp], #16
```
These stack adjustments cannot be described by CFI instructions.
This patch disables merging of SP update with untagging, i.e. makes the
compiler use an additional scratch register (there should be plenty
available at this point as we are in the epilogue) and generate:
```
mov x9, sp
mov x8, #256
stg x9, [x9], #16
.LBB0_1:
sub x8, x8, #32
st2g x9, [x9], #32
cbnz x8, .LBB0_1
add sp, sp, #272
```
Merging is disabled only when we need to generate asynchronous unwind
tables.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D114548
Roman Lebedev [Fri, 15 Apr 2022 12:56:37 +0000 (15:56 +0300)]
Require asserts in newly added test
Roman Lebedev [Fri, 15 Apr 2022 12:37:29 +0000 (15:37 +0300)]
[UpdateTestChecks] Prevent rapid onset insanity when forced to write LoopVectorize-driven costmodel tests
Subj, or on other words, we have a lot of tests that are driven by
the LoopVectorizer's debug output, but we don't have
any meaningful way to autogenerate checklines in them,
which means that an insurmountable amount of manual work
is required when modifying the appropriate cost models.
That is not sustainable, so this presents a solution.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D121133
LLVM GN Syncbot [Fri, 15 Apr 2022 11:44:38 +0000 (11:44 +0000)]
[gn build] Port
1d83750f631d
Nikolas Klauser [Fri, 15 Apr 2022 11:43:40 +0000 (13:43 +0200)]
[libc++] Implement ranges::copy{, _n, _if, _backward}
Reviewed By: Mordante, var-const, #libc
Spies: sstefan1, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D122982
zhongyunde [Fri, 15 Apr 2022 01:44:11 +0000 (09:44 +0800)]
[AArch64][SelectionDAG] Refactor to support more scalable vector extending stores
Similar to D122281, we should firstly exclude all scalable vector extending
stores and then selectively enable those which we directly support.
Also merge integer and float scalable vector into scalable_vector_valuetypes.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D123449
Nico Weber [Fri, 15 Apr 2022 11:05:15 +0000 (07:05 -0400)]
[gn build] (manually) port
6d45558c1a05d (MipsGenPostLegalizeGICombiner)
Clement Courbet [Fri, 15 Apr 2022 09:11:26 +0000 (11:11 +0200)]
[ExpandMemCmp] Properly expand `bcmp` to an equality pattern.
Before that change, constant-size `bcmp` would miss an opportunity to generate
a more efficient equality pattern and would generate a -1/0-1 pattern
instead.
Differential Revision: https://reviews.llvm.org/D123849
Clement Courbet [Fri, 15 Apr 2022 09:08:52 +0000 (11:08 +0200)]
[NFC] Add test in preparation for D123849.
Brad Smith [Fri, 15 Apr 2022 08:24:49 +0000 (04:24 -0400)]
[WebAssembly] Remove TODO comment for IAS, NFC
IAS has been enabled on WebAssembly since commit
0a55d3f557a74cfb459b24e442072302d5444baf.
Daniil Kovalev [Fri, 15 Apr 2022 07:57:38 +0000 (10:57 +0300)]
[UpdateTestChecks] Add NVPTX support in update_llc_test_checks.py
This patch makes possible generating NVPTX assembly check lines with
update_llc_test_checks.py utility.
Differential Revision: https://reviews.llvm.org/D122986
Mehdi Amini [Mon, 4 Apr 2022 00:18:47 +0000 (00:18 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TestTypes.cpp (NFC)