Jan Korous [Sat, 22 Jan 2022 01:11:05 +0000 (17:11 -0800)]
[clang][dataflow] Avoid MaxIterations overflow
unsigned is technically guaranteed to be only 16 bits in which case 1 << 16 would wrap around to zero.
Differential Revision: https://reviews.llvm.org/D117938
Derek Schuff [Mon, 24 Jan 2022 22:59:54 +0000 (14:59 -0800)]
[clang][Driver] use DWARF4 for wasm
Opt into the old default of DWARF4 for now.
Differential Revision: https://reviews.llvm.org/D118082
Rob Suderman [Mon, 24 Jan 2022 23:38:30 +0000 (15:38 -0800)]
[mlir] Add support for ExpM1 to GLSL/OpenCL SPIRV Backends
Adding a similar decomposition for exponential minus one to the SPIRV
backends along with the necessary tests.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D118081
Mogball [Mon, 24 Jan 2022 23:31:00 +0000 (23:31 +0000)]
[mlir] NFC control-flow sink cleanup
Siva Chandra Reddy [Fri, 21 Jan 2022 06:23:59 +0000 (06:23 +0000)]
[libc] Let header generator generate the type header inclusion boiler plate.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D117855
Nikolas Klauser [Mon, 24 Jan 2022 18:44:34 +0000 (19:44 +0100)]
[libc++] Remove std::basic_string's base class in ABIv2
Remove `std::basic_string`'s base class in ABI version 2
Reviewed By: Quuxplusone, ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D116334
Nikolas Klauser [Tue, 28 Dec 2021 12:09:40 +0000 (13:09 +0100)]
[libc++][NFC] remove this-> when calling member functions in <string>
remove `this->` when calling member functions
Reviewed By: Quuxplusone, Mordante, ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D116324
Jonas Devlieghere [Mon, 24 Jan 2022 23:12:18 +0000 (15:12 -0800)]
[lldb] Add ConstString memory usage statistics
Add statistics about the memory usage of the string pool. I'm
particularly interested in the memory used by the allocator, i.e. the
number of bytes actually used by the allocator it self as well as the
number of bytes allocated through the allocator.
Differential revision: https://reviews.llvm.org/D117914
David Blaikie [Mon, 24 Jan 2022 23:02:49 +0000 (15:02 -0800)]
DWARFv5 default: Switch bolt tests to use DWARFv4 since Bolt doesn't support v5 yet
Rough attempt to fix these, since I don't have bolt building locally.
Will see how the buildbots go with it...
Mogball [Mon, 24 Jan 2022 23:00:39 +0000 (23:00 +0000)]
[mlir] Add a ControlFlowSink pass.
Control-Flow Sink moves operations whose only uses are in conditionally-executed regions into those regions so that paths in which their results are not needed do not perform unnecessary computation.
Depends on D115087
Reviewed By: jpienaar, rriddle, bondhugula
Differential Revision: https://reviews.llvm.org/D115088
Chaoshuai Lu [Mon, 24 Jan 2022 22:51:37 +0000 (14:51 -0800)]
[ObjC Availability] Add missing const to getVersion function of ObjCAvailabilityCheckExpr class
Add missing const to `getVersion` function of `ObjCAvailabilityCheckExpr` class.
This feels like a bug on the original change D22171. We cannot really call this function from a const object pointer because the function is not marked as const.
This diff adds the missing const specifier to fix the issue.
Reviewed By: manmanren
Differential Revision: https://reviews.llvm.org/D112119
Petr Hosek [Mon, 24 Jan 2022 21:31:58 +0000 (13:31 -0800)]
[Fuchsia] Remove i386 from iossim architectures
This is no longer supported in newer SDK versions.
Differential Revision: https://reviews.llvm.org/D118075
Arjun P [Mon, 24 Jan 2022 22:38:14 +0000 (04:08 +0530)]
[MLIR][Presburger] use braces for single-line loop when inner if uses braces [NFC]
Arjun P [Mon, 24 Jan 2022 22:17:02 +0000 (03:47 +0530)]
[MLIR][Presburger] LinearTransform: rename multiplication functions to be more intuitive
Nancy Wang [Mon, 24 Jan 2022 22:44:17 +0000 (17:44 -0500)]
[SystemZ][z/OS]: fix lit tmp_dir to use - instead of _
Latest upstream change in https://reviews.llvm.org/D117179 causes lit regressions on z/OS, when TMPDIR is exported and contains _, ld linker fails, it doesnt recognize _ specified in SYSLIN. this seems a limitation on z/OS. we need to fix lit.
Differential Revision: https://reviews.llvm.org/D118071
Simon Pilgrim [Mon, 24 Jan 2022 22:43:16 +0000 (22:43 +0000)]
[X86] combinePredicateReduction - split vXi16 allof(cmpeq()) to vXi8 allof(cmpeq())
vXi16 patterns allof(cmp()) reduction patterns will have to be pack the comparison results to vXi8 to use PMOVMSKB.
If we're reducing cmpeq(), then we can compare the vXi8 halves directly - similar to what we already do for vXi64 -> vXi32 for cases without PCMPEQQ.
Changpeng Fang [Mon, 24 Jan 2022 22:33:12 +0000 (14:33 -0800)]
[AMDGPU][NFC] Update to AMDGPUUsage for default Code Object Version
Summary:
Update the documentation for default code object version (from v3 to v4).
Reviewers:
kzhuravl
Differential Revision:
https://reviews.llvm.org/D117845
Yuanfang Chen [Mon, 24 Jan 2022 21:42:47 +0000 (13:42 -0800)]
[CMake] Pass CMAKE_C/CXX_COMPILER_LAUNCHER down to cross-compile and runtime build
Similar to D59032.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D117746
Yuanfang Chen [Mon, 24 Jan 2022 21:42:39 +0000 (13:42 -0800)]
[CMake] Fixes /INCREMENTAL detection when considering adding /Brepro
/INCREMENTAL is the linker default (lld-link and MSVC link). Specifying
"/INCREMENTAL:NO" is the only way to disable it. So checking for the
negative flag instead and check exe/module/shared link flags
independently.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D117381
Yuanfang Chen [Mon, 24 Jan 2022 21:42:04 +0000 (13:42 -0800)]
[NFC][clangd] Use table to collect option aliases
* Suppress a lot of `-Wtautological-compare` warning
* Speed up file build a little bit
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D98110
Simon Pilgrim [Mon, 24 Jan 2022 21:41:57 +0000 (21:41 +0000)]
[X86] combineSetCCMOVMSK - detect and(pcmpeq(),pcmpeq()) ptest pattern.
Handle cases where we've split an allof(cmpeq()) pattern to a legal vector type
Rahul Joshi [Sat, 22 Jan 2022 14:00:29 +0000 (06:00 -0800)]
[MLIR] Add generic walk support to OpState
- This allows calling the generic walkers on specific operation instances.
Differential Revision: https://reviews.llvm.org/D117949
Igor Kirillov [Thu, 13 Jan 2022 12:57:50 +0000 (12:57 +0000)]
[LoopVectorize] Add tests with reductions that are stored in invariant address
This patch adds tests for functionality that is to be implemented in D110235.
Differential Revision: https://reviews.llvm.org/D117213
Quinn Pham [Mon, 29 Nov 2021 15:12:51 +0000 (09:12 -0600)]
[PowerPC] Emit warning when SP is clobbered by asm
This patch emits a warning when the stack pointer register (`R1`) is found in
the clobber list of an inline asm statement. Clobbering the stack pointer is
not supported.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D112073
Casey Carter [Thu, 30 Dec 2021 01:21:52 +0000 (17:21 -0800)]
[libcxx][test] the domain of == for forward iterators is iterator values from the same range
* Default-initialized `basic_string` iterators are not portably in the domain of `==`.
* Avoid comparing iterators from non-equal string_views which MSVCSTL considers not to be in the domain of equality.
* Don't test invalid range `[in, out + N)`.
Also silence some truncation warnings by testing with a non-narrowing conversion.
Differential Revision: https://reviews.llvm.org/D118049
Med Ismail Bennani [Mon, 24 Jan 2022 20:45:00 +0000 (21:45 +0100)]
[lldb/test] Fix `TestScriptedProcess.test_scripted_process_and_scripted_thread`
This patch updates `dummy_scripted_process.py` to report the dummy
thread correctly to reflect the changes introduced by `d3e0f7e`.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Louis Dionne [Sun, 9 Jan 2022 14:36:08 +0000 (09:36 -0500)]
[libc++][CI] Re-enable all CI jobs
This essentially reverts commit
89f4a18f371d8 now that our CI is back
online at full capacity.
Differential Revision: https://reviews.llvm.org/D116891
Louis Dionne [Fri, 14 Jan 2022 17:30:22 +0000 (12:30 -0500)]
[libc++] Make sure basic_string::reserve(n) never shrinks in all Standard modes
Since basic_string::reserve(n) is instantiated in the shared library but also
available to the compiler for inlining, its definition should not depend on
things like the Standard mode in use. Indeed, that flag may not match between
how the shared library is compiled and how users are compiling their own code,
resulting in ODR violations.
However, note that we retain the behavior of basic_string::reserve() to
shrink the string for backwards compatibility reasons. While it would
technically be conforming to not shrink, we believe user expectation is
for it to shrink, and so existing code might have been written based on
that assumption. We prefer to not break such code, even though that makes
basic_string::reserve() and basic_string::reserve(0) not equivalent anymore.
Fixes llvm-project#53170
Differential Revision: https://reviews.llvm.org/D117332
Amir Ayupov [Mon, 24 Jan 2022 20:03:35 +0000 (12:03 -0800)]
[BOLT] Add missing <memory> in InstrumentationRuntimeLibrary.h
<memory> is no longer included as a result of
5f290c090a24
("Move STLFunctionalExtras out of STLExtras").
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D118064
Sanjay Patel [Mon, 24 Jan 2022 19:16:23 +0000 (14:16 -0500)]
[InstCombine] add tests for icmp with masked mul operand; NFC
More coverage for D114272
Jordan Rupprecht [Mon, 24 Jan 2022 20:01:25 +0000 (12:01 -0800)]
[test] Fix no-undef-type-md.ll.
There are two test issues:
- The test assumes the current directory is writeable, but it may not be. Use `%t.o`-like paths instead of implicit `a.out`.
- The `RUN llvm-nm` line is missing a colon, so the test was not being exercised.
Paweł Bylica [Mon, 24 Jan 2022 18:22:56 +0000 (19:22 +0100)]
[DAGCombine] Remove unused param in combineCarryDiamond(). NFC
Stanislav Mekhanoshin [Wed, 19 Jan 2022 20:51:04 +0000 (12:51 -0800)]
[AMDGPU] Make v8i16/v8f16 legal
Differential Revision: https://reviews.llvm.org/D117721
Med Ismail Bennani [Tue, 18 Jan 2022 11:56:42 +0000 (12:56 +0100)]
[lldb/Interpreter] Make `ScriptedInterface::ErrorWithMessage` static (NFC)
This patch changes the `ScriptedInterface::ErrorWithMessage` method to
make it `static` which makes it easier to call.
The patch also updates its various call sites to reflect this change.
Differential Revision: https://reviews.llvm.org/D117374
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 18 Jan 2022 11:52:24 +0000 (12:52 +0100)]
[lldb/Plugins] Fix ScriptedThread IndexID reporting
When listing all the Scripted Threads of a ScriptedProcess, we can see that all
have the thread index set to 1. This is caused by the lldb_private::Thread
constructor, which sets the m_index_id member using the provided thread id `tid`.
Because the call to the super constructor is done before instantiating
the `ScriptedThreadInterface`, lldb can't fetch the thread id from the
script instance, so it uses `LLDB_INVALID_THREAD_ID` instead.
To mitigate this, this patch takes advantage of the `ScriptedThread::Create`
fallible constructor idiom to defer calling the `ScriptedThread` constructor
(and the `Thread` super constructor with it), until we can fetch a valid
thread id `tid` from the `ScriptedThreadInterface`.
rdar://
87432065
Differential Revision: https://reviews.llvm.org/D117076
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 18 Jan 2022 11:46:17 +0000 (12:46 +0100)]
[lldb/Plugins] Enrich ScriptedThreads Stop Reasons with Exceptions
This patch adds Exceptions to the list of supported stop reasons for
Scripted Threads.
The main motivation for this is that breakpoints are triggered as a
special exception class on ARM platforms, so adding it as a stop reason
allows the ScriptedProcess to selected the ScriptedThread that stopped at
a breakpoint (or crashed :p).
rdar://
87430376
Differential Revision: https://reviews.llvm.org/D117074
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 18 Jan 2022 11:45:57 +0000 (12:45 +0100)]
[lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess
This patch adds support of multiple Scripted Threads in a ScriptedProcess.
This is done by fetching the Scripted Threads info dictionary at every
ScriptedProcess::DoUpdateThreadList and iterate over each element to
create a new ScriptedThread using the object instance, if it was not
already available.
This patch also adds the ability to pass a pointer of a script interpreter
object instance to initialize a ScriptedInterface instead of having to call
the script object initializer in the ScriptedInterface constructor.
This is used to instantiate the ScriptedThreadInterface from the
ScriptedThread constructor, to be able to perform call on that script
interpreter object instance.
Finally, the patch also updates the scripted process test to check for
multiple threads.
rdar://
84507704
Differential Revision: https://reviews.llvm.org/D117071
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 18 Jan 2022 11:45:27 +0000 (12:45 +0100)]
[lldb/Plugins] Move ScriptedThreadInterface to ScriptedThread
Since we can have multiple Scripted Threads per Scripted Process, having
only a single ScriptedThreadInterface (with a single object instance)
will cause the method calls to be done on the wrong object.
Instead, this patch creates a separate ScriptedThreadInterface for each
new lldb_private::ScriptedThread to make sure we interact with the right
instance.
rdar://
87427911
Differential Revision: https://reviews.llvm.org/D117070
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 18 Jan 2022 11:44:48 +0000 (12:44 +0100)]
[lldb/Plugins] Add ScriptedProcess::GetThreadsInfo interface
This patch adds a new method to the Scripted Process interface to
retrive a dictionary of Scripted Threads. It uses the thread ID as a key
and the Scripted Thread instance as the value.
This dictionary will be used to create Scripted Threads in lldb and
perform calls to the python scripted thread object.
rdar://
87427126
Differential Revision: https://reviews.llvm.org/D117068
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Stanislav Mekhanoshin [Fri, 21 Jan 2022 17:55:34 +0000 (09:55 -0800)]
[AMDGPU] Remove cndmask from readsExecAsData
Differential Revision: https://reviews.llvm.org/D117909
Mircea Trofin [Mon, 24 Jan 2022 19:18:02 +0000 (11:18 -0800)]
[NFC][MLGO] Simplify conditional compilation
Most of the code that's shared between 'release' and 'development'
modes doesn't depend on anything special.
Mark de Wever [Sat, 18 Dec 2021 14:03:26 +0000 (15:03 +0100)]
[libc++][format] Finish P0645 Text Formatting.
This adjust the version macro and sets it as completed. All parts of the paper
have been implemented, except for the parts replaced by later papers and
LWG-issues.
Adjusted the synopsis to match the synopsis in the Standard. Not yet
implemented parts of P2216 and P2418 still use the P0645 wording.
Completes:
- P0645 Text Formatting
Depends on D115991
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D115999
Arthur O'Dwyer [Sat, 15 Jan 2022 18:29:26 +0000 (13:29 -0500)]
[libc++] Fix bugs in common_iterator; add test coverage.
Differential Revision: https://reviews.llvm.org/D117400
John Ericson [Sun, 23 Jan 2022 05:30:32 +0000 (05:30 +0000)]
[libc][cmake] Make `add_tablegen` calls match others
in all the other `add_tablegen` calls, the project name is so transformed so it
can be a prefix of a CMake variable. I think it is better to do do that here
too for consistency.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D117979
Florian Hahn [Mon, 24 Jan 2022 18:32:32 +0000 (18:32 +0000)]
[ConstraintElimination] Fix sign of sub decomposition.
Update the decomposition code to make sure the right coefficient (-1) is
used for the second operand of the subtract.
Fixes PR53123.
Florian Hahn [Mon, 24 Jan 2022 18:21:52 +0000 (18:21 +0000)]
[ConstraintElimination] Add test from PR53123.
Jeremy Morse [Mon, 24 Jan 2022 17:52:52 +0000 (17:52 +0000)]
[NFC][DebugInfo] Strip out an undesired #if 0 block
As mentioned in discussion of D116821, it's better to just delete this
block than keep it hanging around.
Hans Wennborg [Mon, 24 Jan 2022 18:01:38 +0000 (19:01 +0100)]
Use -gdwarf-4 in compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
otherwise the test fails after the recent DWARF 4 -> 5 default change,
see https://github.com/llvm/llvm-project/issues/53387
Clint Caywood [Mon, 24 Jan 2022 17:40:38 +0000 (09:40 -0800)]
[libc] Add bazel definition for hypot/hypotf.
Patch by Clint Caywood.
Differential Revision: https://reviews.llvm.org/D118053
Sander de Smalen [Fri, 21 Jan 2022 11:28:16 +0000 (11:28 +0000)]
[AArch64] NFC: Clarify and auto-generate some CodeGen tests.
* For ext-narrow-index.ll, move vscale_range attribute closer to the
function definition, rather than through indirect #<num> attribute. This
makes the test a bit easier to read.
* auto-generated CHECK lines for sve-cmp-select.ll and
named-vector-shuffles-sve.ll.
* re-generated CHECK lines for tests that had a mention they were
auto-generated, but where the CHECK lines were out of date.
Stephen Tozer [Tue, 18 Jan 2022 11:11:57 +0000 (11:11 +0000)]
[llvm] Do not replace dead constant references in metadata with undef
This patch removes an incorrect behaviour in Constants.cpp, which would
replace dead constant references in metadata with an undef value. This
blanket replacement resulted in undef values being inserted into
metadata that would not accept them. The replacement was intended for
debug info metadata, but this is now instead handled in the RAUW
handler.
Differential Revision: https://reviews.llvm.org/D117300
LLVM GN Syncbot [Mon, 24 Jan 2022 17:15:34 +0000 (17:15 +0000)]
[gn build] Port
db2944e34b16
LLVM GN Syncbot [Mon, 24 Jan 2022 17:15:33 +0000 (17:15 +0000)]
[gn build] Port
787ccd345cbb
Mark de Wever [Thu, 16 Dec 2021 17:17:47 +0000 (18:17 +0100)]
[libc++][format] Adds formatter handle.
This implements the handler according to P0645. P2418 changes the wording
in the Standard. That isn't implemented and requires changes in more
places. LWG3631 applies modifications to P2418, but is currently
unresolved.
Implements parts of:
* P0645 Text Formatting
Depends on D115989
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D115991
Mark de Wever [Tue, 14 Dec 2021 18:46:10 +0000 (19:46 +0100)]
[libc++][format] Disable default formatter.
[format.formatter.spec]/5 lists the requirements for the default
formatter. The original implementation didn't implement this. This
implements the default formatter according to the Standard.
This adds additional test to validate the default formatter is disabled
and the required standard formatters are enabled.
While adding the tests it seems the formatters needed a constraint for the
character types they were valid for.
Implements parts of:
- P0645 Text Formatting
Depends on D115988
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D115989
Mark de Wever [Sun, 28 Nov 2021 13:43:43 +0000 (14:43 +0100)]
[libc++][format] Adds formatter pointer.
This implements the last required formatter specialization.
Completes:
- LWG 3251 Are std::format alignment specifiers applied to string arguments?
- LWG 3340 Formatting functions should throw on argument/format string mismatch in §[format.functions]
- LWG 3540 §[format.arg] There should be no const in basic_format_arg(const T* p)
Implements parts of:
- P0645 Text Formatting
Depends on D114001
Reviewed By: ldionne, vitaut, #libc
Differential Revision: https://reviews.llvm.org/D115988
Mark de Wever [Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)]
[libc++][format] Adds formatter floating-point.
This properly implements the formatter for floating-point types.
Completes:
- P1652R1 Printf corner cases in std::format
- LWG 3250 std::format: # (alternate form) for NaN and inf
- LWG 3243 std::format and negative zeroes
Implements parts of:
- P0645 Text Formatting
Reviewed By: #libc, ldionne, vitaut
Differential Revision: https://reviews.llvm.org/D114001
Marek Kurdej [Mon, 24 Jan 2022 16:57:21 +0000 (17:57 +0100)]
[clang-format] Space between attribute closing parenthesis and qualified type colon.
Fixes https://github.com/llvm/llvm-project/issues/35711.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D117894
Jeremy Morse [Mon, 24 Jan 2022 17:04:13 +0000 (17:04 +0000)]
Revert rG6a605b97a200 due to excessive memory use
Over in the comments for D116821, some use-cases have cropped up where
there's a substantial increase in memory usage. A quick inspection
shows that a) it's a lot of memory and b) there are several things to
be done to reduce it. Reverting (via disabling this feature by default)
to avoid bothering people in the meantime.
Sebastian Neubauer [Mon, 24 Jan 2022 17:06:33 +0000 (18:06 +0100)]
[AMDGPU][InstCombine] Remove zero image offset
Remove the offset parameter if it is zero.
Differential Revision: https://reviews.llvm.org/D117876
Owen Pan [Mon, 24 Jan 2022 16:44:54 +0000 (08:44 -0800)]
[clang][NFC] Wrap TYPE_SWITCH in "do while (0)" in the interpreter
Wraps the expansions of TYPE_SWITCH and COMPOSITE_TYPE_SWITCH in
the constexpr interpreter with "do { ... } while (0)" so that these
macros can be used like this:
if (llvm::Optional<PrimType> T = Ctx.classify(FieldTy))
TYPE_SWITCH(*T, Ok &= ReturnValue<T>(FP.deref<T>(), Value));
else
Ok &= Composite(FieldTy, FP, Value);
This bug was found while testing D116316. See also review comment:
https://reviews.llvm.org/D64146?id=208520#inline-584131
Also cleaned up the macro definitions by removing the superfluous
do-while statements and removed the unused INT_TPYE_SWITCH macro.
Differential Revision: https://reviews.llvm.org/D117301
eopXD [Sun, 23 Jan 2022 07:19:01 +0000 (23:19 -0800)]
[SLP][NFC] Add debug logs for entry.
Tell the users they are specifying something without vector register.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D117980
Louis Dionne [Mon, 24 Jan 2022 17:05:09 +0000 (12:05 -0500)]
[libc++] Fix benchmark failure
Fangrui Song [Mon, 24 Jan 2022 17:03:21 +0000 (09:03 -0800)]
[ELF] Fix the branch range computation when reusing a thunk
Notation: dst is `t->getThunkTargetSym()->getVA()`
On AArch64, when `src-0x8000000-r_addend <= dst < src-0x8000000`, the condition
`target->inBranchRange(rel.type, src, rel.sym->getVA(rel.addend))` may
incorrectly consider a thunk reusable.
`rel.addend = -getPCBias(rel.type)` resets the addend to 0 for AArch64/PPC
and the zero addend is used by `rel.sym->getVA(rel.addend)` to check
out-of-range relocations.
See the test for a case this computation is wrong:
`error: a.o:(.text_high+0x4): relocation R_AARCH64_JUMP26 out of range: -
134217732 is not in [-
134217728,
134217727]`
I have seen a real world case with r_addend=19960.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D117734
Simon Pilgrim [Mon, 24 Jan 2022 16:44:27 +0000 (16:44 +0000)]
[X86] combineSetCCMOVMSK - fold allof(cmpeq(x,y)) -> ptest(sub(x,y)) (PR53379)
As suggested on PR53379, for all-of icmp-eq patterns, we can use ptest(sub(x,y)) on SSE41+ targets
This is a generalization of the existing allof(cmpeq(x,0)) -> ptest(x) pattern
We can probably extend this further, in particularly to handle 256-bit cases on pre-AVX2 targets, but this part of the generalization is pretty trivial
Fixes Issue #53379
Sander de Smalen [Mon, 24 Jan 2022 09:39:31 +0000 (09:39 +0000)]
[ISEL] Move trivial step_vector folds to FoldConstantArithmetic.
Given that step_vector is practically a constant, doing this early
helps with DAGCombine folds that happen before type legalization.
There is currently no way to test this happens earlier, although existing
tests for step_vector folds continue protect the folds happening at all.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D117863
Casey Carter [Wed, 29 Dec 2021 22:30:52 +0000 (14:30 -0800)]
[libcxx][test] {move,reverse}_iterator cannot be instantiated for a type with no `operator*`
Since their nested reference types are defined in terms of `iter_reference_t<T>`, which examines `decltype(*declval<T>())`.
Differential Revision: https://reviews.llvm.org/D117371
gysit [Mon, 24 Jan 2022 16:25:42 +0000 (16:25 +0000)]
[mlir][linalg] Add transpose support to hoist padding.
Add a transpose option to hoist padding to transpose the padded tensor before storing it into the packed tensor. The early transpose improves the memory access patterns of the actual compute kernel. The patch introduces a transpose right after the hoisted pad tensor and a second transpose inside the compute loop. The second transpose can either be fused into the compute operation or will canonicalize away when lowering to vector instructions.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D117893
Craig Topper [Mon, 24 Jan 2022 16:23:58 +0000 (08:23 -0800)]
[DAGCombiner][RISCV] Canonicalize (bswap(bitreverse(x))->bitreverse(bswap(x)).
If the bitreverse gets expanded, it will introduce a new bswap. By
putting a bswap before the bitreverse, we can ensure it gets cancelled
out when this happens.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D118012
Matthias Springer [Mon, 24 Jan 2022 15:51:41 +0000 (00:51 +0900)]
[mlir][bufferize][NFC] Implement BufferizableOpInterface on bufferization ops directly
No longer go through an external model. Also put BufferizableOpInterface into the same build target as the BufferizationDialect. This allows for some code reuse between BufferizationOps canonicalizers and BufferizableOpInterface implementations.
Differential Revision: https://reviews.llvm.org/D117987
Craig Topper [Mon, 24 Jan 2022 16:17:45 +0000 (08:17 -0800)]
[SelectionDAG][RISCV] Teach getNode to fold bswap(bswap(x))->x.
This can show up during when bitreverse is expanded to bswap and
swap of bits within a byte. If the input is already a bswap, we
should cancel them out before we further transform them in a way
that makes it harder to see the redundancy.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D118007
Craig Topper [Mon, 24 Jan 2022 15:54:59 +0000 (07:54 -0800)]
[RISCV] Select int_riscv_vsll with shift of 1 to vadd.vv.
Add might be faster than shift. We can't do this earlier without
using a Freeze instruction.
This is the intrinsic version of D106689.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D118013
Hans Wennborg [Mon, 24 Jan 2022 15:50:49 +0000 (16:50 +0100)]
Don't run test/ClangScanDeps/modules-symlink.c on Windows
'ln -s' isn't Windows friendly.
Lorenzo Chelini [Sun, 23 Jan 2022 15:13:46 +0000 (16:13 +0100)]
[MLIR][OpenMP] Suppress -Wreturn-type warnings (NFC)
Matthias Springer [Mon, 24 Jan 2022 15:34:11 +0000 (00:34 +0900)]
[mlir][bufferize] Change insertion point for ToTensorOps
Both insertion points are valid. This is to make BufferizableOpInteface-based bufferization compatible with existing partial bufferization test cases. (So less changes are necessary to unit tests.)
Differential Revision: https://reviews.llvm.org/D117986
Kristóf Umann [Wed, 10 Nov 2021 14:03:06 +0000 (15:03 +0100)]
[Templight] Don't display empty strings for names of unnamed template parameters
Patch originally by oktal3000: https://github.com/mikael-s-persson/templight/pull/40
When a template parameter is unnamed, the name of -templight-dump might return
an empty string. This is fine, they are unnamed after all, but it might be more
user friendly to at least describe what entity is unnamed.
Differential Revision: https://reviews.llvm.org/D115521
Valentin Clement [Mon, 24 Jan 2022 15:32:04 +0000 (16:32 +0100)]
[flang] Add MemoryAllocation pass to the pipeline
Add the MemoryAllocation pass into the pipeline. Add
the possibilty to pass the options directly within the tool (tco).
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D117886
Matthias Springer [Mon, 24 Jan 2022 15:09:36 +0000 (00:09 +0900)]
[mlir][tensor][bufferize] Support tensor.rank in BufferizableOpInterfaceImpl
This is the only op that is not supported via BufferizableOpInterfaceImpl bufferization. Once this op is supported we can switch `tensor-bufferize` over to the new unified bufferization.
Differential Revision: https://reviews.llvm.org/D117985
Sean Fertile [Fri, 21 Jan 2022 16:05:31 +0000 (11:05 -0500)]
[libc++][AIX] Do not assert chmod return value is non-zero.
A number of the filesystem tests create a directory that contains a bad
symlink. On AIX recursively setting permissions on said directory will
return a non-zero value because of the bad symlink, however the
following rm -r still completes successfully. Avoid the assertion on
AIX, and rely on the return value of the remove command to detect
problems.
Differential Revision: https://reviews.llvm.org/D112086
Denys Shabalin [Mon, 24 Jan 2022 11:44:47 +0000 (12:44 +0100)]
[mlir] Fix broken __repr__ implementation in Linalg OpDSL
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D118027
David Spickett [Mon, 24 Jan 2022 14:55:06 +0000 (14:55 +0000)]
[llvm][docs] Fix code-block in the testing guide
Without a langauge name it's an error (with some verisons of Sphinx
it seems) or the block is simply missing in the output.
Matthias Springer [Mon, 24 Jan 2022 14:16:29 +0000 (23:16 +0900)]
[mlir][tensor] Move BufferizableOpInterface impl to tensor dialect
This is in preparation of unifying the existing bufferization with One-Shot bufferization.
A subsequent commit will replace `tensor-bufferize`'s implementation with the BufferizableOpInterface-based implementation and move over missing test cases.
Differential Revision: https://reviews.llvm.org/D117984
Matt Arsenault [Thu, 20 Jan 2022 19:57:23 +0000 (14:57 -0500)]
AMDGPU: Fix assertion on fixed stack objects with VGPR->AGPR spills
These have negative / out of bounds frame index values and would
assert when trying to set the BitVector. Fixed stack objects can't be
colored away so ignore them.
Bjorn Pettersson [Mon, 10 Jan 2022 10:32:08 +0000 (11:32 +0100)]
Pre-commit test cases for (sra (load)) -> (sextload) folds. NFC
Add test case to show missing folds for (sra (load)) -> (sextload).
Differential Revision: https://reviews.llvm.org/D116929
Matt Arsenault [Fri, 14 Jan 2022 23:18:26 +0000 (18:18 -0500)]
Reapply "Revert "GlobalISel: Add G_ASSERT_ALIGN hint instruction"
This reverts commit
a97e20a3a8a58be751f023e610758310d5664562.
Matt Arsenault [Sat, 15 Jan 2022 02:02:15 +0000 (21:02 -0500)]
Reapply "IR: Make getRetAlign check callee function attributes"
Reapply
3d2d208f6a0a421b23937c39b9d371183a5913a3, reverted in
a97e20a3a8a58be751f023e610758310d5664562
ksyx [Mon, 17 Jan 2022 23:43:49 +0000 (18:43 -0500)]
[clang-format] Fix SeparateDefinitionBlocks issues
- Fixes https://github.com/llvm/llvm-project/issues/53227 that wrongly
indents multiline comments
- Fixes wrong detection of single-line opening braces when used along
with those only opening scopes, causing crashes due to duplicated
replacements on the same token:
void foo()
{
{
int x;
}
}
- Fixes wrong recognition of first line of definition when the line
starts with block comment, causing crashes due to duplicated
replacements on the same token for this leads toward skipping the line
starting with inline block comment:
/*
Some descriptions about function
*/
/*inline*/ void bar() {
}
- Fixes wrong recognition of enum when used as a type name rather than
starting definition block, causing crashes due to duplicated
replacements on the same token since both actions for enum and for
definition blocks were taken place:
void foobar(const enum EnumType e) {
}
- Change to use function keyword for JavaScript instead of comparing
strings
- Resolves formatting conflict with options EmptyLineAfterAccessModifier
and EmptyLineBeforeAccessModifier (prompts with --dry-run (-n) or
--output-replacement-xml but no observable change)
- Recognize long (len>=5) uppercased name taking a single line as return
type and fix the problem of adding newline below it, with adding new
token type FunctionLikeOrFreestandingMacro and marking tokens in
UnwrappedLineParser:
void
afunc(int x) {
return;
}
TYPENAME
func(int x, int y) {
// ...
}
- Remove redundant and repeated initialization
- Do no change to newlines before EOF
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D117520
Paul Walker [Mon, 24 Jan 2022 12:03:16 +0000 (12:03 +0000)]
[AArch64] Regenerate CHECK lines for llvm/test/CodeGen/AArch64/sve2-int-mul.ll
Simon Pilgrim [Mon, 24 Jan 2022 14:04:42 +0000 (14:04 +0000)]
[X86] Add cmp-equality bool reductions
PR53379 test coverage
Simon Pilgrim [Mon, 24 Jan 2022 13:44:08 +0000 (13:44 +0000)]
[X86] Rename cmp-with-zero bool reductions
Explicitly name them icmp0_* - I'm intending to add PR53379 test coverage shortly
Simon Pilgrim [Mon, 24 Jan 2022 13:36:22 +0000 (13:36 +0000)]
[X86] Fix v8i8 -> v8i16 typo in bool reductions
We were supposed to be testing <8 x i16> reductions
serge-sans-paille [Mon, 24 Jan 2022 14:02:44 +0000 (15:02 +0100)]
Add missing STLExtras.h include from lldb/unittests/TestingSupport/MockTildeExpressionResolver.cpp
Fraser Cormack [Fri, 21 Jan 2022 17:58:39 +0000 (17:58 +0000)]
[RISCV] Add side-effect-free vsetvli intrinsics
This patch introduces new intrinsics that enable the use of vsetvli in
contexts where only the returned vector length is of interest. The
pre-existing intrinsics are marked with side-effects, which prevents
even trivial optimizations on/across them.
These intrinsics are intended to be used in situations where the vector
length is fed in turn to RVV intrinsics or to vector-predication
intrinsics during loop vectorization, for example. Those codegen paths
ensure that instructions are generated with their own implicit vsetvli,
so the vector length and vtype can be relied upon to be correct.
No corresponding C builtins are planned at this stage, though that is a
possibility for the future if the need arises.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117910
Sjoerd Meijer [Mon, 24 Jan 2022 12:54:16 +0000 (12:54 +0000)]
[LoopFlatten] Address FIXME about getTripCountFromExitCount. NFC.
Together with the previous commit which mainly documents better LoopFlatten's
overall strategy, this addresses a concern added as a FIXME comment in D110587;
the code refactoring (NFC) introduces functions (also for the SCEV usage) to
make this clearer.
Sjoerd Meijer [Mon, 24 Jan 2022 11:41:06 +0000 (11:41 +0000)]
[LoopFlatten] Added comments about usage of various Loop APIs. NFC.
serge-sans-paille [Mon, 24 Jan 2022 13:40:51 +0000 (14:40 +0100)]
Add missing include llvm/ADT/STLExtras
Evgeny Shulgin [Mon, 24 Jan 2022 13:35:42 +0000 (08:35 -0500)]
Add `isConstinit` matcher
Support C++20 constinit variables for AST Matchers.
Nathan Sidwell [Mon, 24 Jan 2022 12:28:09 +0000 (04:28 -0800)]
[demangler][NFC] Refactor some parsing
There's some unnecessary code duplication in the parser. This
refactors that and deploys boolean variables to avoid the duplication.
These also happen to help adding module demangling (with an updated
mangling scheme).
1a) The grammar requires some lookahead concerning <template-args>. We
may discover an <unscoped-name> is actually <unscoped-template-name>
<template-args>. (When <unscoped-name> was a substitution, there must
be a following <template-args>.) Refactor parseName to only have one
code path looking for the 'I' indicating <template-args>.
1b) While there I altered the control flow to hold the result in a
variable, rather than tail call. Made it easier to debug (and of
course an optimizer will DTRT here anyway).
2a) An <unscoped-name> can have an St or StL prefix. No need for
completely separate code paths handling the following unqualified-name
though.
2b) Also no need to look for both 'St' and 'StL' separately. Look for
'St' and then conditionally swallow an 'L'.
3) We get a similar issue as #1a when parsing a typeName. Here I just
change the control flow slightly to bring the 'break' out to the end
of the 'S' block and embed the early return inside an if. That's more
in keeping with the code style.
4) Although NFC, there's a new testcase as that's not covered by the
existing demangler tests and is significant in the #1a case above.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D117879
Nathan Sidwell [Mon, 24 Jan 2022 12:14:47 +0000 (04:14 -0800)]
[demangler] write-protect non-canonical source
To try and avoid undesired changes to the non-canonical demangler
sources, change the cp-to-llvm script to (a) write-protect the target
files and (b) prepend 'do not edit' comments that are significant to
emacs[*], and hopefully humans.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118008
Nathan Sidwell [Mon, 24 Jan 2022 12:11:59 +0000 (04:11 -0800)]
[demangler] Resync demangler sources
Recent commits changed llvm/include/llvm/Demangle without also
changing libcxxabi/src/Demangle, which is the canonical source
location. This resyncs those commits to the libcxxabi directory.
Commits:
*
1f9e18b6565fd1bb69c4b649b9efd3467b3c7c7d
*
f53d359816e66a107195e1e4b581e2a33bbafaa4
*
065044c443f4041f32e0a8d6e633f9d92580fbca
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D117990.diff