Mehdi Amini [Sun, 3 Apr 2022 23:14:19 +0000 (23:14 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in OpenMPDialect.cpp (NFC)
Damian Rouson [Thu, 17 Mar 2022 18:05:25 +0000 (11:05 -0700)]
[flang] expand the num_images test coverage
Add a test with a range of num_images() intrinsic function
invocations, including the standard-conforming but previously
untested 'team' argument. Also test that several non-conforming
num_images() invocations generate the correct error messages.
Differential Revision: https://reviews.llvm.org/D121938
Peter Klausler [Thu, 31 Mar 2022 19:55:45 +0000 (12:55 -0700)]
[flang] Emit a portability warning for padding in COMMON
When padding is required in a COMMON block to ensure alignment
of a component, emit a portability warning.
Differential Revision: https://reviews.llvm.org/D123706
Christopher Bate [Wed, 13 Apr 2022 22:40:22 +0000 (22:40 +0000)]
[MLIR][GPU] Add GPU ops nvvm.mma.sync, nvvm.mma.ldmatrix, lane_id
This change adds three new operations to the GPU dialect: gpu.mma.sync,
gpu.mma.ldmatrix, and gpu.lane_id. The former two are meant to target
the lower level nvvm.mma.sync and nvvm.ldmatrix instructions, respectively.
Lowerings are added for the new GPU operations for conversion to
NVVM.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D123647
Julian Lettner [Tue, 12 Apr 2022 20:58:33 +0000 (13:58 -0700)]
Adapt "cross compile?" check for Apple Silicon
This piece of code tries to implement the semantics "cross compile?" to
determine CFLAGS used for test binary compilation.
```
if(ANDROID OR ${arch} MATCHES "arm|aarch64|riscv32|riscv64")
```
Since Apple Silicon, macOS runs on arm64e, so we take the wrong branch
when compiling and running tests locally "on the host" on an AS machine.
Furthermore, for Apple code, we use the separate
`get_test_cflags_for_apple_platform` function to determine these test
compiliation flags and `get_test_cc_for_arch` is only ever used in the
"compile & run on host" case, so we can short-curcuit the "cross
compile?" check here.
rdar://
91446703
Differential Revision: https://reviews.llvm.org/D123633
Jonas Devlieghere [Wed, 13 Apr 2022 22:02:39 +0000 (15:02 -0700)]
[lldb] Fix a bug in the decorator matching logic.
This changes the decorator helper `_match_decorator_property` to
consider `None` as the actual value as not a match. Using `None` for the
pattern continues to be considered a match.
I discovered the issue because marking a test as NO_DEBUG_INFO_TESTCASE
will cause the call to `self.getDebugInfo()` to return `None` and
incorrectly skip or XFAIL the corresponding test.
I used the above scenario to create a test for the decorators.
Differential revision: https://reviews.llvm.org/D123401
Martin Sebor [Wed, 13 Apr 2022 21:58:07 +0000 (15:58 -0600)]
Run update_test_checks.py after parameter renaming in r03b807d3f2999888bbe395945987af06f201c142 (NFC).
Jonas Devlieghere [Wed, 13 Apr 2022 21:35:28 +0000 (14:35 -0700)]
[debugserver ] Un-conditionalize use of libcompression
Jason removed the include guards in
681f6c2f552f. This patch removes the
corresponding CMake logic as well.
Differential revision: https://reviews.llvm.org/D123616
Stanislav Mekhanoshin [Wed, 13 Apr 2022 16:27:09 +0000 (09:27 -0700)]
[AMDGPU] Increate hazard for store dwordx3/4 to 2 waitstates on gfx940
Fixes: SWDEV-327053
Differential Revision: https://reviews.llvm.org/D123687
Sanjay Patel [Wed, 13 Apr 2022 21:01:14 +0000 (17:01 -0400)]
[SimplifyCFG] improve readability in switch-to-select; NFC
Sanjay Patel [Wed, 13 Apr 2022 18:26:59 +0000 (14:26 -0400)]
[SimplifyCFG] add more tests for switch to select transform; NFC
Also, make test names more descriptive -
additional coverage for D122485
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
captures 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).
This is a recommit of
adff142dc2 after a fix in
d8d793f29b4
Reviewed By: aaron.ballman, #clang-language-wg, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D119136
Martin Sebor [Wed, 13 Apr 2022 20:59:03 +0000 (14:59 -0600)]
Replace numbered function arguments with descriptive names.
Corentin Jabot [Wed, 13 Apr 2022 20:47:44 +0000 (22:47 +0200)]
Fix compatibility with retroactive C++23 change [NFC]
Referring to capture in parameter list is now ill-formed.
This change is made to prepare for https://reviews.llvm.org/D119136
Nikolas Klauser [Sat, 9 Apr 2022 07:48:21 +0000 (09:48 +0200)]
[libc++] `bitset::operator[] const` should return bool
Fixes https://github.com/llvm/llvm-project/issues/10686
Reviewed By: Mordante, ldionne, var-const, #libc
Spies: jloser, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D122092
Matt Arsenault [Sat, 26 Mar 2022 15:01:53 +0000 (11:01 -0400)]
RegAlloc: Fix remaining virtual registers after allocation failure
This testcase fails register allocation, but at the failure point
there were also new split virtual registers. Previously this was
assigning the failing register and not enqueueing the newly created
split virtual registers. These would then never be allocated and
assert in VirtRegRewriter.
Jez Ng [Wed, 13 Apr 2022 20:17:29 +0000 (16:17 -0400)]
[lld-macho][nfc] De-templatize UnwindInfoSection
Follow-on to {D123276}. Now that we work with an internal
representation of compact unwind entries, we no longer need to template
our UnwindInfoSectionImpl code based on the pointer size of the target
architecture.
I've still kept the split between `UnwindInfoSectionImpl` and
`UnwindInfoSection`. I'd introduced that split in order to do type
erasure, but I think it's still useful to have in order to keep
`UnwindInfoSection`'s definition in the header file clean.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D123277
Vitaly Buka [Wed, 13 Apr 2022 20:12:27 +0000 (13:12 -0700)]
Revert "[sanitizer] Don't run malloc hooks for stacktraces"
Breaks android and iOS bots.
https://green.lab.llvm.org/green/job/clang-san-iossim/5229/consoleFull#
711521816a1ca8a51-895e-46c6-af87-
ce24fa4cd561
https://lab.llvm.org/buildbot/#/builders/77/builds/16456
This reverts commit
6345d7f2a829faea56ad522a7d5180043f862a5c.
Jonas Devlieghere [Wed, 13 Apr 2022 16:42:56 +0000 (09:42 -0700)]
[lldb] Expand $ when using tcsh
Unlike for any of the other shells, we were escaping $ when using tcsh.
There's nothing special about $ in tcsh and this prevents you from
expanding shell variables, one of the main reasons this functionality
exists in the first place.
Differential revision: https://reviews.llvm.org/D123690
Vladislav Khmelevsky [Thu, 7 Apr 2022 19:33:41 +0000 (22:33 +0300)]
[BOLT] Update skipRelocation for aarch64
The ld might relax ADRP+ADD or ADRP+LDR sequences to the ADR+NOP, add
the new case to the skipRelocation for aarch64.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D123334
Martin Sebor [Wed, 13 Apr 2022 19:49:28 +0000 (13:49 -0600)]
Replace %0 in function arguments with descriptive names.
Yitzhak Mandelbaum [Tue, 5 Apr 2022 19:23:13 +0000 (19:23 +0000)]
[clang][dataflow] Weaken abstract comparison to enable loop termination.
Currently, when the framework is used with an analysis that does not override
`compareEquivalent`, it does not terminate for most loops. The root cause is the
interaction of (the default implementation of) environment comparison
(`compareEquivalent`) and the means by which locations and values are
allocated. Specifically, the creation of certain values (including: reference
and pointer values; merged values) results in allocations of fresh locations in
the environment. As a result, analysis of even trivial loop bodies produces
different (if isomorphic) environments, on identical inputs. At the same time,
the default analysis relies on strict equality (versus some relaxed notion of
equivalence). Together, when the analysis compares these isomorphic, yet
unequal, environments, to determine whether the successors of the given block
need to be (re)processed, the result is invariably "yes", thus preventing loop
analysis from reaching a fixed point.
There are many possible solutions to this problem, including equivalence that is
less than strict pointer equality (like structural equivalence) and/or the
introduction of an explicit widening operation. However, these solutions will
require care to be implemented correctly. While a high priority, it seems more
urgent that we fix the current default implentation to allow
termination. Therefore, this patch proposes, essentially, to change the default
comparison to trivally equate any two values. As a result, we can say precisely
that the analysis will process the loop exactly twice -- once to establish an
initial result state and the second to produce an updated result which will
(always) compare equal to the previous. While clearly unsound -- we are not
reaching a fix point of the transfer function, in practice, this level of
analysis will find many practical issues where a single iteration of the loop
impacts abstract program state.
Note, however, that the change to the default `merge` operation does not affect
soundness, because the framework already produces a fresh (sound) abstraction of
the value when the two values are distinct. The previous setting was overly
conservative.
Differential Revision: https://reviews.llvm.org/D123586
Thomas Raoux [Wed, 13 Apr 2022 16:48:36 +0000 (16:48 +0000)]
[mlir][vector] Add unrolling pattern for TransposeOp
Support unrolling for vector.transpose following the same interface as
other vector unrolling ops.
Differential Revision: https://reviews.llvm.org/D123688
Mehdi Amini [Wed, 13 Apr 2022 19:34:21 +0000 (19:34 +0000)]
Revert "[clang] Implement Change scope of lambda trailing-return-type"
This reverts commit
adff142dc253d65b6560e420bba6b858d88d4a98.
This broke clang bootstrap: it made existing C++ code in LLVM invalid:
llvm/include/llvm/CodeGen/LiveInterval.h:630:53: error: captured variable 'Idx' cannot appear here
[=](std::remove_reference_t<decltype(*Idx)> V,
^
Eli Friedman [Wed, 13 Apr 2022 00:13:06 +0000 (17:13 -0700)]
Restrict lvalue-to-rvalue conversions in CGExprConstant.
We were generating wrong code for cxx20-consteval-crash.cpp: instead of
loading a value of a variable, we were using its address as the
initializer.
Found while adding code to verify the size of constant initializers.
Differential Revision: https://reviews.llvm.org/D123648
Matt Arsenault [Sat, 26 Mar 2022 21:25:34 +0000 (17:25 -0400)]
RegAllocGreedy: Remove redundant check for virtual registers
The set of interfering virtual registers obviously only includes
virtual registers.
Matt Arsenault [Wed, 13 Apr 2022 18:31:39 +0000 (14:31 -0400)]
AMDGPU: Relax test check on tablegen debug output
Try to match tN and pointer for asserts and non-assert builds.
serge-sans-paille [Wed, 13 Apr 2022 16:39:26 +0000 (12:39 -0400)]
[iwyu] Handle regressions in libLLVM header include
Running iwyu-diff on LLVM codebase since
a96638e50ef5 detected a few
regressions, fixing them.
Congzhe Cao [Wed, 13 Apr 2022 18:45:48 +0000 (14:45 -0400)]
[DA] Refactor with a better API
Refactor from iteratively using BitCastInst::getOperand()
to using stripPointerCasts() instead. This is an improvement
since now we are able to analyze more cases, please refer
to test cases added in this patch.
Reviewed By: Meinersbur, #loopoptwg
Differential Revision: https://reviews.llvm.org/D123559
Amir Ayupov [Wed, 13 Apr 2022 18:46:59 +0000 (11:46 -0700)]
[BOLT][TEST] Add -no-pie to two tests
Missed these two tests in D123329 in a rebase.
Vitaly Buka [Sat, 9 Apr 2022 02:53:41 +0000 (19:53 -0700)]
[sanitizer] Don't run malloc hooks for stacktraces
Usually when we generated stacktraces the process is in error state, so
running hooks may crash the process and prevent meaningfull error report.
Symbolizer, unwinder and pthread are potential source of mallocs.
https://b.corp.google.com/issues/
228110771
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D123566
Aaron Ballman [Wed, 13 Apr 2022 18:42:52 +0000 (14:42 -0400)]
Fix a typo with this test function name
The call and the function name don't line up correctly, so this was
accidentally using an implicit function declaration when it didn't
intend to.
Amir Ayupov [Thu, 7 Apr 2022 18:23:20 +0000 (11:23 -0700)]
[BOLT][TEST] Remove -no-pie from cflags/cxxflags
Align with an upstream change D120305 to make PIE the default on linux-gnu.
Add `-no-pie` to tests that require it.
Reviewed By: maksfb, yota9
Differential Revision: https://reviews.llvm.org/D123329
Corentin Jabot [Wed, 13 Apr 2022 18:26:40 +0000 (20:26 +0200)]
[Clang] Fix html error in cxx_status.html [NFC]
Florian Hahn [Wed, 13 Apr 2022 18:24:28 +0000 (20:24 +0200)]
Revert "[LICM] Only create load in pre-header when promoting load."
This reverts commit
4bf3b7dc929c8288e9e5631978ef060d9140b251.
This might be causing another buildbot failure.
Maksim Panchenko [Wed, 13 Apr 2022 01:42:19 +0000 (18:42 -0700)]
[BOLT] Ignore PC-relative relocations from data to data
BOLT expects PC-relative relocations in data sections to reference code
and the relocated data to form a jump table. However, there are cases
where PC-relative addressing is used for data-to-data references
(e.g. clang-15 can generate such code). BOLT should recognize and ignore
such relocations. Otherwise, they will be considered relocations not
claimed by any jump table and cause a failure in the strict mode.
Reviewed By: yota9, Amir
Differential Revision: https://reviews.llvm.org/D123650
Amir Ayupov [Wed, 13 Apr 2022 18:09:25 +0000 (11:09 -0700)]
[BOLT] Fix data race in shortenInstructions
Address ThreadSanitizer warning
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D121338
Erich Keane [Wed, 13 Apr 2022 17:57:05 +0000 (10:57 -0700)]
Fix Werror build issue from
6f20744b7ff875
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
Mogball [Wed, 2 Mar 2022 18:00:05 +0000 (18:00 +0000)]
[mlir][ods] Remove StrEnumAttr
StrEnumAttr has been deprecated in favour of EnumAttr, a solution based on AttrDef (https://reviews.llvm.org/D115181). This patch removes StrEnumAttr, along with all the custom ODS logic required to handle it.
See https://discourse.llvm.org/t/psa-stop-using-strenumattr-do-use-enumattr/5710 on how to transition to EnumAttr. In short,
```
// Before
def MyEnumAttr : StrEnumAttr<"MyEnum", "", [
StrEnumAttrCase<"A">,
StrEnumAttrCase<"B">
]>;
// After (pick an integer enum of your choice)
def MyEnum : I32EnumAttr<"MyEnum", "", [
I32EnumAttrCase<"A", 0>,
I32EnumAttrCase<"B", 1>
]> {
// Don't generate a C++ class! We want to use the AttrDef
let genSpecializedAttr = 0;
}
// Define the AttrDef
def MyEnum : EnumAttr<MyDialect, MyEnum, "my_enum">;
```
Reviewed By: rriddle, jpienaar
Differential Revision: https://reviews.llvm.org/D120834
Aleksandr Platonov [Wed, 13 Apr 2022 17:38:59 +0000 (20:38 +0300)]
[Sema] Don't check bounds for function pointer
Currently, clang crashes with i386 target on the following code:
```
void f() {
f + 0xdead000000000000UL;
}
```
This problem is similar to the problem fixed in D104424, but that fix can't handle function pointer case, because `getTypeSizeInCharsIfKnown()` says that size is known and equal to 0 for function type.
This patch prevents bounds checking for function pointer, thus fixes the crash.
Fixes https://github.com/llvm/llvm-project/issues/50463
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D122748
Erich Keane [Wed, 13 Apr 2022 13:46:42 +0000 (06:46 -0700)]
Add support for ignored bitfield conditional codegen.
Currently we emit an error in just about every case of conditionals
with a 'non simple' branch if treated as an LValue. This patch adds
support for the special case where this is an 'ignored' lvalue, which
permits the side effects from happening.
It also splits up the emit for conditional LValue in a way that should
be usable to handle simple assignment expressions in similar situations.
Differential Revision: https://reviews.llvm.org/D123680
Jacques Pienaar [Wed, 13 Apr 2022 17:31:06 +0000 (10:31 -0700)]
[mlir][pdll] Include string in PDLLServer.h
Xing Xue [Wed, 13 Apr 2022 17:18:10 +0000 (13:18 -0400)]
[libunwind][AIX] implementation of the unwinder for AIX
NFC - revert identation changes in AddressSpace.hpp from the previous commit
Differential Revision: https://reviews.llvm.org/D100132
serge-sans-paille [Wed, 13 Apr 2022 08:31:44 +0000 (10:31 +0200)]
Revert "[ValueTracking] Make getStringLenth aware of strdup"
This reverts commit
e810d558093cff40caaa1aff24d289c76c59916d.
The commit was not taken into account the fact that strduped string could be
modified. Checking if such modification happens would make the function very
costly, without a test case in mind it's not worth the effort.
David Green [Wed, 13 Apr 2022 17:10:49 +0000 (18:10 +0100)]
[AArch64] Add new shuffles tests, and regenerate aarch64-wide-shuffle.ll and neon-wide-splat.ll. NFC
Jacques Pienaar [Wed, 13 Apr 2022 17:00:10 +0000 (10:00 -0700)]
[mlir][pdll] Rename extra dir flag
Not sure why this is overlapping, need to repro locally, but just rename
to something more explicit instead.
chenglin.bi [Wed, 13 Apr 2022 16:48:28 +0000 (00:48 +0800)]
[AArch64][SelectionDAG] stick all the power-of-two tests in a separate file; NFC
Baseline tests for D122968 (issue #54649).
Evgeny Mandrikov [Wed, 13 Apr 2022 16:42:29 +0000 (09:42 -0700)]
[NFC] Fix build failure with GCC 11 in C++20 mode
This was already fixed in
https://github.com/llvm/llvm-project/commit/
2ccf0b76bcaf0895e04f14e3ff53c59dd96f9f0f
but then regressed in
https://github.com/llvm/llvm-project/commit/
79a1f3e7c6d338b953b4dfe8cd7cb13ba60fe4e7
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D123589
Jacques Pienaar [Wed, 13 Apr 2022 16:41:45 +0000 (09:41 -0700)]
[mlir][pdll] Add extra-dirs for LSP includes.
Enable specifying additional include directories to search. This is
consistent with what one can do with clangd (although there it is more
general compilation options) and Python LSP. We would in general expect
these to be provided by compilation database equivalent.
Differential Revision: https://reviews.llvm.org/D123474
Anna Thomas [Wed, 13 Apr 2022 16:08:53 +0000 (12:08 -0400)]
Check users of instrinsics instead of traversing entire function.NFC
Updated LowerGuardIntrinsic and LowerWidenableCondition to check for
users of the respective intrinsic, instead of checking for guards and
widenable conditions by traversing the entire function.
This is an NFC. Should save some compile time.
Chris Bieneman [Wed, 13 Apr 2022 16:25:08 +0000 (11:25 -0500)]
[NFC] Add CMake cache file for HLSL
This just adds a trivial CMake cache file (which will grow over time)
to handle the common build configuration for the HLSL compiler.
Momchil Velikov [Wed, 13 Apr 2022 15:21:33 +0000 (16:21 +0100)]
[AArch64] Async unwind - Adjust unwind info in AArch64LoadStoreOptimizer
The AArch64LoadStoreOptimnizer pass may merge a register
increment/decrement with a following memory operation. In doing so, it
may break CFI by moving a stack pointer adjustment past the CFI
instruction that described *that* adjustment.
This patch fixes this issue by moving said CFI instruction after the
merged instruction, where the SP increment/decrement actually takes
place.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D114547
Nathan Sidwell [Fri, 8 Apr 2022 17:13:41 +0000 (10:13 -0700)]
[demangler] Rust demangler buffer return
The rust demangler has some odd buffer handling code, which will copy
the demangled string into the provided buffer, if it will fit.
Otherwise it uses the allocated buffer it made. But the length of the
incoming buffer will have come from a previous call, which was the
length of the demangled string -- not the buffer size. And of course,
we're unconditionally allocating a temporary buffer in the first
place. So we don't actually get buffer reuse, and we get a memcpy in
somecases.
However, nothing in LLVM ever passes in a non-null pointer. Neither
does anything pass in a status pointer that is then made use of. The
only exercise these have is in the test suite.
So let's just make the rust demangler have the same API as the dlang
demangler.
Reviewed By: tmiasko
Differential Revision: https://reviews.llvm.org/D123420
Jay Foad [Wed, 13 Apr 2022 15:24:31 +0000 (16:24 +0100)]
[AMDGPU] Initialize a couple more Subtarget fields
This is just for consistency. The fields are never actually used
so it is NFC.
Xing Xue [Wed, 13 Apr 2022 15:29:37 +0000 (11:29 -0400)]
[libunwind][AIX] implementation of the unwinder for AIX
Summary:
This is an add-on patch to address comments.
- Replace #elif in file <assembly.h> with #else as suggested;
- Reversed the indentation changes in the main patch.
Differential Revision: https://reviews.llvm.org/D100132
Florian Hahn [Wed, 13 Apr 2022 15:20:39 +0000 (17:20 +0200)]
Recommit "[LICM] Only create load in pre-header when promoting load."
This reverts the revert commit
1ddc719680c21f3.
This version of the patch sets the initial available value to poison,
which resolves an issue with the SSAUpdater breaking LCSSA form.
LLVM GN Syncbot [Wed, 13 Apr 2022 15:05:20 +0000 (15:05 +0000)]
[gn build] Port
a85da649b9ac
Xing Xue [Wed, 13 Apr 2022 15:01:59 +0000 (11:01 -0400)]
[libunwind][AIX] implementation of the unwinder for AIX
Summary:
This patch contains the implementation of the unwinder for IBM AIX.
AIX does not support the eh_frame section. Instead, the traceback table located at the end of each function provides the information for stack unwinding and EH. In this patch macro _LIBUNWIND_SUPPORT_TBTAB_UNWIND is used to guard code for AIX traceback table based unwinding. Function getInfoFromTBTable() and stepWithTBTable() are added to get the EH information from the traceback table and to step up the stack respectively.
There are two kinds of LSDA information for EH on AIX, the state table and the range table. The state table is used by the previous version of the IBM XL compiler, i.e., xlC and xlclang++. The DWARF based range table is used by AIX clang++. The traceback table has flags to differentiate these cases. For the range table, relative addresses are calculated using a base of DW_EH_PE_datarel, which is the TOC base of the module where the function of the current frame belongs.
Two personality routines are employed to handle these two different LSDAs, __xlcxx_personality_v0() for the state table and __xlcxx_personality_v1() for the range table. Since the traceback table does not have the information of the personality for the state table approach, its personality __xlcxx_personality_v0() is dynamically resolved as the handler for the state table. For the range table, the locations of the LSDA and its associated personality routine are found in the traceback table.
Assembly code for 32- and 64-bit PowerPC in UnwindRegistersRestore.S and UnwindRegistersSave.S are modified so that it can be consumed by the GNU flavor assembler and the AIX assembler. The restoration of vector registers does not check VRSAVE on AIX because VRSAVE is not used in the AIX ABI.
Reviewed by: MaskRay, compnerd, cebowleratibm, sfertile, libunwind
Differential Revision: https://reviews.llvm.org/D100132
Yaxun (Sam) Liu [Sat, 9 Apr 2022 03:56:07 +0000 (23:56 -0400)]
[CUDA][HIP] Fix host used external kernel in archive
For -fgpu-rdc, a host function may call an external kernel
which is defined in an archive of bitcode. Since this external
kernel is only referenced in host function, the device
bitcode does not contain reference to this external
kernel, then the linker will not try to resolve this external
kernel in the archive.
To fix this issue, host-used external kernels and device
variables are tracked. A global array containing pointers
to these external kernels and variables is emitted which
serves as an artificial references to the external kernels
and variables used by host.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D123441
Nikita Popov [Wed, 13 Apr 2022 09:28:45 +0000 (11:28 +0200)]
[SimplifyLibCalls] Don't mark memchr() memory as fully dereferenceable
C11 specifies memchr() as follows:
> The memchr function locates the first occurrence of c (converted
> to an unsigned char) in the initial n characters (each interpreted
> as unsigned char) of the object pointed to by s. The implementation
> shall behave as if it reads the characters sequentially and stops
> as soon as a matching character is found.
In particular, it is well-defined to specify a memchr size larger
than the underlying object, as long as the character is found before
the end of the object.
Differential Revision: https://reviews.llvm.org/D123665
Marek Kurdej [Fri, 25 Mar 2022 10:01:40 +0000 (11:01 +0100)]
[clang-format] Fix SeparateDefinitionBlocks breaking up function-try-block.
Fixes https://github.com/llvm/llvm-project/issues/54536.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D122468
Tobias Hieta [Wed, 13 Apr 2022 14:39:22 +0000 (16:39 +0200)]
[NFC] Simplify /noimplib argument logic
Tobias Hieta [Tue, 12 Apr 2022 11:59:45 +0000 (13:59 +0200)]
[LLD][COFF] Add support for /noimplib
Mostly for compatibility reasons with link.exe this flag
makes sure we don't write a implib - not even when /implib
is also passed, that's how link.exe works.
Differential Revision: https://reviews.llvm.org/D123591
chenglin.bi [Wed, 13 Apr 2022 14:34:30 +0000 (22:34 +0800)]
[SimplifyCFG] add tests for switch to select; NFC
Baseline tests for D122485 (issue #39957)
chenglin.bi [Wed, 13 Apr 2022 14:32:22 +0000 (22:32 +0800)]
Revert "[SimplifyCFG] add tests for switch to select; NFC"
This reverts commit
e2d77a160c5b8141eca3db1fca6dafd97e78288d.
PeixinQiao [Wed, 13 Apr 2022 14:30:52 +0000 (22:30 +0800)]
[OpenMP] Lowering to MLIR of ordered threads directive
This patch supports lowering parse-tree to MLIR of ordered threads
directive following Section 2.19.9 of the OpenMP 5.1 standard.
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Reviewed By: shraiysh
Differential Revision: https://reviews.llvm.org/D123590
PeixinQiao [Wed, 13 Apr 2022 14:27:58 +0000 (22:27 +0800)]
[flang][OpenMP] Add semantic checks of nesting of region about ordered construct
This patch supports the following checks for ORDERED construct:
```
[5.1] 2.19.9 ORDERED Construct
The worksharing-loop or worksharing-loop SIMD region to which an ordered
region corresponding to an ordered construct without a depend clause
binds must have an ordered clause without the parameter specified on the
corresponding worksharing-loop or worksharing-loop SIMD directive.
The worksharing-loop region to which an ordered region that corresponds
to an ordered construct with any depend clauses binds must have an
ordered clause with the parameter specified on the corresponding
worksharing-loop directive.
An ordered construct with the depend clause specified must be closely
nested inside a worksharing-loop (or parallel worksharing-loop)
construct.
An ordered region that corresponds to an ordered construct with the simd
clause specified must be closely nested inside a simd or
worksharing-loop SIMD region.
```
Reviewed By: kiranchandramohan, shraiysh, NimishMishra
Differential Revision: https://reviews.llvm.org/D113399
Marius Brehler [Wed, 13 Apr 2022 14:17:52 +0000 (16:17 +0200)]
[mlir][docs] Fix broken links
Louis Dionne [Wed, 13 Apr 2022 14:16:39 +0000 (10:16 -0400)]
[libc++] Mark completed paper as complete
LLVM GN Syncbot [Wed, 13 Apr 2022 13:52:22 +0000 (13:52 +0000)]
[gn build] Port
2fb026ee4d1a
Louis Dionne [Tue, 12 Apr 2022 22:56:40 +0000 (18:56 -0400)]
[libc++] Post-commit adjustments after rebasing D117656
Arthur O'Dwyer [Wed, 19 Jan 2022 11:26:52 +0000 (06:26 -0500)]
Implement move_sentinel and C++20 move_iterator.
Differential Revision: https://reviews.llvm.org/D117656
Pavel Labath [Wed, 13 Apr 2022 13:37:44 +0000 (15:37 +0200)]
[lldb] Fixup
af921006d3792f for non-linux platforms
chenglin.bi [Wed, 13 Apr 2022 13:27:06 +0000 (21:27 +0800)]
[SimplifyCFG] add tests for switch to select; NFC
Baseline tests for D122968(issue #54649)
LLVM GN Syncbot [Wed, 13 Apr 2022 13:04:50 +0000 (13:04 +0000)]
[gn build] Port
2b424f4ea82e
Louis Dionne [Wed, 14 Jul 2021 21:01:25 +0000 (17:01 -0400)]
[libc++] Implement ranges::filter_view
Differential Revision: https://reviews.llvm.org/D109086
Jonas Paulsson [Fri, 14 Jan 2022 00:52:16 +0000 (18:52 -0600)]
[SystemZ] Implement adjustInliningThreshold().
This patch boosts the inlining threshold for a particular type of functions
that are using an incoming argument only as a memcpy source.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D121341
Sam McCall [Wed, 13 Apr 2022 12:02:19 +0000 (14:02 +0200)]
[clangd] Export preamble AST and serialized size as metrics
Differential Revision: https://reviews.llvm.org/D123672
Pavel Labath [Fri, 25 Feb 2022 13:47:27 +0000 (14:47 +0100)]
[lldb] Remove the global platform list
This patch moves the platform creation and selection logic into the
per-debugger platform lists. I've tried to keep functional changes to a
minimum -- the main (only) observable difference in this change is that
APIs, which select a platform by name (e.g.,
Debugger::SetCurrentPlatform) will not automatically pick up a platform
associated with another debugger (or no debugger at all).
I've also added several tests for this functionality -- one of the
pleasant consequences of the debugger isolation is that it is now
possible to test the platform selection and creation logic.
This is a product of the discussion at
<https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594>.
Differential Revision: https://reviews.llvm.org/D120810
Nico Weber [Mon, 11 Apr 2022 01:28:29 +0000 (21:28 -0400)]
[compiler-rt] Don't explictly ad-hoc sign dylibs on APPLE if ld is new enough
ld64 implicitly ad-hoc code-signs as of Xcode 12, and `strip` and friends know
how keep this special ad-hoc signature valid.
So this should have no effective behavior change, except that you can now strip
libclang_rt.asan_osx_dynamic.dylib and it'll still have a valid ad-hoc
signature, instead of strip printing "warning: changes being made to the file
will invalidate the code signature in:" and making the ad-hoc code signature
invalid.
Differential Revision: https://reviews.llvm.org/D123475
Adrian Kuegel [Wed, 13 Apr 2022 12:30:01 +0000 (14:30 +0200)]
[mlir][Tensor] Fix wrong comment (NFC)
Aaron Ballman [Wed, 13 Apr 2022 12:20:19 +0000 (08:20 -0400)]
Correctly diagnose prototype redeclaration errors in C
We did not implement C99 6.7.5.3p15 fully in that we missed the rule
for compatible function types where a prior declaration has a prototype
and a subsequent definition (not just declaration) has an empty
identifier list or an identifier list with a mismatch in parameter
arity. This addresses that situation by issuing an error on code like:
void f(int);
void f() {} // type conflicts with previous declaration
(Note: we already diagnose the other type conflict situations
appropriately, this was the only situation we hadn't covered that I
could find.)
Liu, Chen3 [Wed, 13 Apr 2022 07:25:12 +0000 (15:25 +0800)]
[X86] Covert unsigned int 0 to float-point with FILD instruction.
unsinged int 0 will be convert to float/double -0.0 when the rounding
mode is set to 'FE_DOWNWARD'. Using FILD instruction instead of SSE
instructions on 32-bit target if the strictfp is enabled.
Differential Revision: https://reviews.llvm.org/D123660
Simon Pilgrim [Wed, 13 Apr 2022 11:53:15 +0000 (12:53 +0100)]
[DAG] Enable SimplifyVBinOp folds on add/sub sat intrinsics
Dmitry Preobrazhensky [Wed, 13 Apr 2022 11:16:40 +0000 (14:16 +0300)]
[AMDGPU][MC][GFX10] Removed unsupported 64bit DPP opcodes
Removed 64bit DPP opcodes from asm matcher tables.
Differential Revision: https://reviews.llvm.org/D123611
Simon Pilgrim [Wed, 13 Apr 2022 11:35:38 +0000 (12:35 +0100)]
[X86] Add tests showing failure to pull common shuffles through add/sub sat intrinsics
Sanjay Patel [Wed, 13 Apr 2022 10:54:08 +0000 (06:54 -0400)]
[SimplifyCFG] make a debug option for case max when converting switch to select
This should be "NFC" as written, but it will make D122485 smaller
and give us more flexibility to experiment with optimization level
vs. compile-time.
Differential Revision: https://reviews.llvm.org/D123625
Jonas Paulsson [Tue, 22 Mar 2022 09:39:07 +0000 (10:39 +0100)]
[InlineAsm] Add support for address operands ("p").
This patch adds support for inline assembly address operands using the "p"
constraint on X86 and SystemZ.
This was in fact broken on X86 (see example at
https://reviews.llvm.org/D110267, Nov 23).
These operands should probably be treated the same as memory operands by
CodeGenPrepare, which have been commented with "TODO" there.
Review: Xiang Zhang and Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D122220
Andrzej Warzynski [Wed, 13 Apr 2022 10:28:49 +0000 (10:28 +0000)]
[flang][nfc] Simplify TargetMachine initialisation
Dmitry Preobrazhensky [Wed, 13 Apr 2022 10:09:11 +0000 (13:09 +0300)]
[AMDGPU][GFX10] Enabled op_sel for v_add_nc_u16 and v_sub_nc_u16
Differential Revision: https://reviews.llvm.org/D123594
Vladislav Khmelevsky [Thu, 7 Apr 2022 18:56:05 +0000 (21:56 +0300)]
[BOLT] Fix two aarch64 tests
tls-lld test might be broken since compiler might optimize plt function
call and use address directly from got table. The test is removed since
plt-gnu-ld checks the same functionality + versioning symbol matching,
no need to keep both of the tests.
The toolchain might optimize relocations in runtime-relocs test, replace
the test compilation with yaml files.
Differential Revision: https://reviews.llvm.org/D123332
Simon Pilgrim [Wed, 13 Apr 2022 10:37:24 +0000 (11:37 +0100)]
[DAG] Add non-uniform vector support to (shl (srl x, c1), c2) -> (and (shift x, c3))
Another part of D77804 yak shaving
Differential Revision: https://reviews.llvm.org/D123523
Andrzej Warzynski [Wed, 6 Apr 2022 11:59:28 +0000 (11:59 +0000)]
[flang][driver] Add support for generating LLVM bytecode files
Support for generating LLVM BC files is added in Flang's compiler and
frontend drivers. This requires the `BitcodeWriterPass` pass to be run
on the input LLVM IR module and is implemented as a dedicated frontend
aciton. The new functionality as seen by the user (compiler driver):
```
flang-new -c -emit-llvm file.90
```
or (frontend driver):
```
flang-new -fc1 -emit-llvm-bc file.f90
```
The new behaviour is consistent with `clang` and `clang -cc1`.
Differential Revision: https://reviews.llvm.org/D123211
Ping Deng [Wed, 13 Apr 2022 09:55:07 +0000 (09:55 +0000)]
[RISCV][NFC] Reorganize check prefixes in some tests to reduce redundant lines
Reviewed By: benshi001, craig.topper, frasercrmck
Differential Revision: https://reviews.llvm.org/D123176
Alex Richardson [Tue, 12 Apr 2022 20:59:41 +0000 (20:59 +0000)]
[AArch64] Add missing HasNEON predicate in scalar FABD patterns
I was trying to compile with -march=+nosimd and hit the following assertion:
`Attempting to emit FABD64 instruction but the Feature_HasNEON predicate(s) are not met`.
This adds a HasNEON predicate to the patterns which was omitted in commit
21d9b33d62772c58267cc0aa725e35ac9a4661db for some reason.
The new code generation matches GCC with -mcpu=<cpu>+nosimd:
https://godbolt.org/z/n1Y7xh5jo
Differential Revision: https://reviews.llvm.org/D123491
Alex Richardson [Mon, 11 Apr 2022 08:01:05 +0000 (08:01 +0000)]
[AArch64] Baseline test for D123491
Alex Richardson [Thu, 17 Mar 2022 23:28:11 +0000 (23:28 +0000)]
[AutoUpgrade] Don't lose attributes when upgrading mem intrinsics
The original AutoUpgrade code from
1e68724d24ba38de7c7cdb2e1939d78c8b37cc0d
did not retain existing attributes. I noticed this in some downstream test
cases, but it turns out there are also two affected testcase upstream.
Differential Revision: https://reviews.llvm.org/D121971
David Sherwood [Thu, 17 Mar 2022 11:51:59 +0000 (11:51 +0000)]
[AArch64][SVE] Fix lowering of "fcmp ueq/one" when using SVE
We were previously lowering to the incorrect instructions for the
setcc DAG node when using the SETUEQ and SETONE floating point
condition codes. I have fixed this by marking the SETONE code
as Expand and letting the SETUNE code be legal. I have also
fixed up the patterns for FCMNE_PPzZZ and FCMNE_PPzZ0 to use
the correct opcode.
Differential Revision: https://reviews.llvm.org/D121905
Liqin Weng [Wed, 13 Apr 2022 02:45:28 +0000 (02:45 +0000)]
[RISCV][NFC] Refactor the type promotion of fsl/fsr/becompress/bdecompress/bfp
Reviewed By: asb, jrtc27, craig.topper, frasercrmck
Differential Revision: https://reviews.llvm.org/D123181