joker881 [Wed, 13 Apr 2022 12:38:36 +0000 (20:38 +0800)]
RISCV] Add clang builtins for CLZ instruction.
add intrinsic for CLZ
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121915
Blue Gaston [Wed, 13 Apr 2022 20:17:05 +0000 (13:17 -0700)]
[Darwin][ASan][Sanitizer] Fixes Sanitizer NonUnique Identifier to Account for Mac arm64 architectures.
Current check assumes iOS as the only Apple devices running arm64.
```#if SANITIZER_MAC && !(defined(__arm64__) && SANITIZER_IOS)```
Stops Apple Silicon from being flagged as requiring unique RTTI.
This introduced unexpected behavior within the sanitizer.
rdar://
91446703
Differential Revision: https://reviews.llvm.org/D123736
Stella Laurenzo [Thu, 14 Apr 2022 03:13:18 +0000 (20:13 -0700)]
[NFC] Generically resolve body in FunctionOpInterface verifyBody.
Since the actual implementation class can arbitrarily shadow parts of the FunctionOpInterface exported API, access the body generically instead of via the use of the interface being defined.
Fixes https://github.com/llvm/llvm-project/issues/54807
Differential Revision: https://reviews.llvm.org/D123757
Brad Smith [Thu, 14 Apr 2022 03:53:25 +0000 (23:53 -0400)]
[Clang] Move Hexagon / VE IAS enabling to Generic_GCC::IsIntegratedAssemblerDefault, NFC
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D123438
Shoaib Meenai [Thu, 14 Apr 2022 01:28:27 +0000 (18:28 -0700)]
[cmake] Loosen multi-distribution restrictions
We've found that there are cases where it's useful to be able to include
the same target in multiple distributions (e.g. if you want a
distribution that's a superset of another distribution, for convenience
purposes), and that there are cases where the distribution of a target
and its umbrella can legitimately differ (e.g. the LTO library would
commonly be distributed alongside your tools, but it also falls under
the llvm-libraries umbrella, which would commonly be distributed
separately). Relax the restrictions while providing an option to restore
them (which is mostly useful to ensure you aren't accidentally placing
targets in the wrong distributions).
There could be further refinements here (e.g. excluding a target from an
umbrella if it's explicitly included in some other distribution, or
having variables to control which targets are allowed to be duplicated
or placed in a separate distribution than their umbrellas), but we can
punt on those until there's an actual need.
Arjun P [Thu, 14 Apr 2022 02:20:17 +0000 (03:20 +0100)]
[MLIR][Presburger] change some `push_back`s to `emplace_back`s
Arjun P [Thu, 14 Apr 2022 02:19:03 +0000 (03:19 +0100)]
[MLIR][Presburger] change some post-increments/decrements to pre-increments/decrements
wangpc [Thu, 14 Apr 2022 02:47:08 +0000 (10:47 +0800)]
[RISCV][NFC] Use addExpr() instead of createExpr()
It seems to be neater.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D123675
Florian Mayer [Tue, 12 Apr 2022 23:25:40 +0000 (16:25 -0700)]
[HWASan] symbolize: use buildid index for locals.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D123644
Peter Klausler [Thu, 31 Mar 2022 22:59:27 +0000 (15:59 -0700)]
[flang] Error handling for out-of-range CASE values
Catch and nicely describe errors in CASE range values
that are out of range for the type of the SELECT CASE.
Differential Revision: https://reviews.llvm.org/D123708
Vitaly Buka [Thu, 14 Apr 2022 01:33:27 +0000 (18:33 -0700)]
[sanitizer] Disable malloc_hook_skip on Darwin
Followup to D123566
Nico Weber [Thu, 14 Apr 2022 00:58:10 +0000 (20:58 -0400)]
[gn build] (manually) port
ab8abeaf48ab
Fangrui Song [Thu, 14 Apr 2022 00:09:30 +0000 (17:09 -0700)]
[randstruct] Fix -Wunused-but-set-variable with Clang>=D122271 in -DLLVM_ENABLE_ASSERTIONS=off builds
Peter Klausler [Thu, 31 Mar 2022 20:36:09 +0000 (13:36 -0700)]
[flang] Fold IBITS() intrinsic function
Implement constant folding of IBITS(); add test.
Differential Revision: https://reviews.llvm.org/D123707
Okwan Kwon [Wed, 13 Apr 2022 23:55:43 +0000 (23:55 +0000)]
[mlir] Fix a typo to load lsp-mode correctly.
Differential Revision: https://reviews.llvm.org/D123745
Fangrui Song [Wed, 13 Apr 2022 23:58:00 +0000 (16:58 -0700)]
[Driver] Change CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL to affect driver default instead of cc1 default
The current cc1 CLANG_ENABLE_OPAQUE_POINTERS=on default difference is not ideal
in that people contribute %clang_cc1 tests may assume the default ON behavior,
which will cause failures on systems set to OFF.
cc1 option default dependent on CMake options should be used prudently
(generally avoided). We prefer to limit target differences to Driver.
Change the CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL mechanism introduced in D123122
to use a driver default instead. This is similar to the mechanism used for the
-flegacy-pass-manager transition to new PM transition.
Reviewed By: #opaque-pointers, rsmith, aeubanks
Differential Revision: https://reviews.llvm.org/D123744
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
Arthur Eubanks [Wed, 13 Apr 2022 23:31:03 +0000 (16:31 -0700)]
[bazel] Set CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL to 1
Matches official cmake build.
Arthur Eubanks [Wed, 13 Apr 2022 23:26:21 +0000 (16:26 -0700)]
[gn build] Set CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL=1
Matches official cmake build.
Jonas Devlieghere [Wed, 13 Apr 2022 22:29:21 +0000 (15:29 -0700)]
[lldb] Remove reproducer logic from LocateSymbolFileMacOSX
Jonas Devlieghere [Wed, 13 Apr 2022 22:27:36 +0000 (15:27 -0700)]
[lldb] Format LocateSymbolFileMacOSX (NFC)
Mehdi Amini [Sun, 3 Apr 2022 23:18:19 +0000 (23:18 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in SCF.cpp (NFC)
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