Stanislav Gatev [Tue, 8 Mar 2022 09:55:00 +0000 (09:55 +0000)]
[clang][dataflow] Add analysis that detects unsafe accesses to optionals
Adds a dataflow analysis that detects unsafe accesses to values of type
`std::optional`, `absl::optional`, or `base::Optional`.
Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D121197
David Spickett [Tue, 8 Mar 2022 16:51:36 +0000 (16:51 +0000)]
[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64
This is a stop gap until I am able to update the usual bots
to clang-13.
Differential Revision: https://reviews.llvm.org/D121224
Jean Perier [Wed, 9 Mar 2022 08:41:55 +0000 (09:41 +0100)]
[flang] Use unix logical representation for fir.logical
The front-end and the runtime are currently using the unix logical
representation, but lowering was not. These inconsistencies could
caused issues.
The only place that defines what the logical representation is in
lowering is the translation from FIR to LLVM (FIR is agnostic to the
actual representation). More precisely, the LLVM implementation of
`fir.convert` between `i1` and `fir.logcial` is what defines the
representation:
- `fir.convert` from `i1` to `fir.logical` defines the `.true.` and `.false.`
canonical representations
- `fir.convert` from `fir.logical` to `i1` decides what the test for
truth is.
Unix representation is:
- .true. canonical integer representation is 1
- .false. canonical integer representation is 0
- the test for truth is "integer representation != 0"
For the record, the previous representation that was used was in
codegen was:
- .true. canonical integer representation is -1 (all bits 1)
- .false. canonical integer representation is 0
- the test for truth is "integer representation lowest bit == 1"
Differential Revision: https://reviews.llvm.org/D121200
Nikita Popov [Mon, 7 Mar 2022 11:37:55 +0000 (12:37 +0100)]
[SCEV] Verify all IR -> SCEV mappings
This extends SCEV verification to check not only backedge-taken
counts, but all entries in the IR -> SCEV cache. The restrictions
are the same as for the BECount case, i.e. we ignore expressions
based on undef, we only diagnose constant deltas (there are way
too many false positives otherwise) and we limit to reachable code.
Differential Revision: https://reviews.llvm.org/D121104
Nikita Popov [Fri, 4 Mar 2022 11:00:04 +0000 (12:00 +0100)]
[Attributor] Use byval type instead of pointer element type
For compatibility with opaque pointers, use the byval type rather
than the pointer element type.
Differential Review: https://reviews.llvm.org/D120983
Weining Lu [Wed, 9 Mar 2022 07:54:24 +0000 (15:54 +0800)]
[LoongArch] Add basic support to AsmParser
This patch adds basic support to AsmParser which can handle basic
instructions with register or immediate operands. With the addition of
the parser, now it's possible to test instructions encoding with `llvm-mc`.
Disassembler will be added later and then we can do `round-trip` test.
Reviewed By: xen0n, MaskRay, myhsu
Differential Revision: https://reviews.llvm.org/D120476
Martin Storsjö [Fri, 4 Mar 2022 08:53:32 +0000 (10:53 +0200)]
[libcxx] [test] XFAIL the get/put long_double_ru_RU tests on Glibc < 2.27
Those older versions used a different monetary decimal separator.
To avoid unnecessary churn to support that, just XFAIL the test
on those older versions. (Up until
df1e43c496b43e998f66c610b0e15a0951f316b3, the whole test was XFAILed
on all versions of glibc.)
Differential Revision: https://reviews.llvm.org/D120979
Martin Storsjö [Wed, 19 Jan 2022 11:07:13 +0000 (11:07 +0000)]
[libcxx] [test] Fix the classic_table test on Windows
On Windows, constants like F::alpha and F::print are bitmasks
consisting of multiple bits (e.g. F::alpha consisting of both the
bits F::upper and F::lower). In such a case, we can't check that
all the bits from all the expected constants are set. Instead,
check that (p[i] & mask) != 0 returns the expected value.
Differential Revision: https://reviews.llvm.org/D120802
Jonas Devlieghere [Wed, 9 Mar 2022 04:31:20 +0000 (20:31 -0800)]
[lldb] Add --exists flag to `settings set`
Add a --exists/-e flag to `settings set` that sets the setting if it
exists, but doesn't print an error otherwise. This is useful for example
when setting options in your ~/.lldbinit that might not exist in older
versions of lldb.
Differential revision: https://reviews.llvm.org/D121155
Venkata Ramanaiah Nalamothu [Mon, 7 Mar 2022 19:39:18 +0000 (01:09 +0530)]
[AMDGPU] Move call clobbered return address registers s[30:31] to callee saved range
Currently the return address ABI registers s[30:31], which fall in the call
clobbered register range, are added as a live-in on the function entry to
preserve its value when we have calls so that it gets saved and restored
around the calls.
But the DWARF unwind information (CFI) needs to track where the return address
resides in a frame and the above approach makes it difficult to track the
return address when the CFI information is emitted during the frame lowering,
due to the involvment of understanding the control flow.
This patch moves the return address ABI registers s[30:31] into callee saved
registers range and stops adding live-in for return address registers, so that
the CFI machinery will know where the return address resides when CSR
save/restore happen during the frame lowering.
And doing the above poses an issue that now the return instruction uses undefined
register `sgpr30_sgpr31`. This is resolved by hiding the return address register
use by the return instruction through the `SI_RETURN` pseudo instruction, which
doesn't take any input operands, until the `SI_RETURN` pseudo gets lowered to the
`S_SETPC_B64_return` during the `expandPostRAPseudo()`.
As an added benefit, this patch simplifies overall return instruction handling.
Note: The AMDGPU CFI changes are there only in the downstream code and another
version of this patch will be posted for review for the downstream code.
Reviewed By: arsenm, ronlieb
Differential Revision: https://reviews.llvm.org/D114652
Yevgeny Rouban [Wed, 9 Mar 2022 05:59:49 +0000 (12:59 +0700)]
[clangd] Make dexp command line options sticky
Preparing for the cl::opt reset fix proposed on D115433 this
patch fixes the dexp tool to preserve its three command line
options (IndexLocation, ExecCommand, ProjectRoot) from reset
that is done before parsing query options.
Tags: #clang
Yevgeny Rouban [Wed, 9 Mar 2022 05:59:49 +0000 (12:59 +0700)]
[clangd] Make dexp command line options sticky
Preparing for the cl::opt reset fix proposed on D115433 this
patch fixes the dexp tool to preserve its three command line
options (IndexLocation, ExecCommand, ProjectRoot) from reset
that is done before parsing query options.
Tags: #clang
Johannes Doerfert [Wed, 9 Mar 2022 05:45:43 +0000 (23:45 -0600)]
[OpenMP][FIX] Ensure the modules vector is filled as others are
The modules vector was for some reason special which could lead to it
not being of the same size (=num devices). Easiest solution is to treat
it like we do all the other vectors.
Jonas Devlieghere [Wed, 9 Mar 2022 04:15:54 +0000 (20:15 -0800)]
[lldb] A few small changes to HandleProgressEvent
Of course I only noticed these things *after* landing the original
patch...
- Flush the output after clearing the line.
- Move up the printing the carriage return to avoid duplication.
- Use hexadecimal instead of octal for escape codes.
Jonas Devlieghere [Wed, 9 Mar 2022 03:55:46 +0000 (19:55 -0800)]
[lldb] Undef GetMessage when including Windows.h
GetMessage is a define that can expand to GetMessageA (ANSI) or
GetMessageW (wide). Avoid the issue when including this header by
undef'ing the macro.
Chia-hung Duan [Tue, 8 Mar 2022 20:31:06 +0000 (20:31 +0000)]
[mlir] Make ShapedTypeComponents contructible from ShapeAdaptor
ValueShapeRange::getShape() returns ShapeAdaptor rather than ShapedType
and ShapeAdaptor allows implicit conversion to bool. It ends up that
ShapedTypeComponents can be constructed with ShapeAdaptor incorrectly.
The reason is that the type trait
std::is_constructible<ShapeStorageT, Arg>::value
is fulfilled because ShapeAdaptor can be converted to bool and it can be
used to construct ShapeStorageT. In the end, we won't give any warning
or error message when doing things like
inferredReturnShapes.emplace_back(valueShapeRange.getShape(0));
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D120845
Arthur O'Dwyer [Wed, 9 Mar 2022 02:56:25 +0000 (21:56 -0500)]
[libc++] Fix a use-after-move introduced in D118003.
Thanks to Eric Fiselier for catching this!
Jonas Devlieghere [Wed, 9 Mar 2022 02:35:06 +0000 (18:35 -0800)]
[lldb] Always move the cursor back after printing progress
This got lost while iterating on the patch. We need to always move the
cursor to the front of the line so that if something else
(asynchronously) prints to the debugger's output it overwrites the
progress message.
Jonas Devlieghere [Sun, 6 Mar 2022 01:52:01 +0000 (17:52 -0800)]
[lldb] Add a setting to change the progress color
Add a setting to change how progress is shown in a color enabled
terminal. This follows the existing -prefix, -suffix pattern
that's used elsewhere in lldb.
Differential revision: https://reviews.llvm.org/D121062
Jonas Devlieghere [Sat, 5 Mar 2022 23:45:52 +0000 (15:45 -0800)]
[lldb] Show progress events in the command line driver
This patch adds support for showing progress events when using lldb on
the command line. It spawns a separate thread that listens for progress
events and prints them to the debugger's output stream.
It's nothing fancy (yet), for now it just prints the progress message.
If we know the total number of items being processed, we prefix the
message with something like [1/100], similar to ninja's output.
This patch doesn't use any fancy terminal manipulation: it uses a simple
carriage return (\r) to bring the cursor to the front of the line and
vt100 escape codes to clear the (rest) of the line.
Differential revision: https://reviews.llvm.org/D120972
Jonas Devlieghere [Wed, 9 Mar 2022 02:22:56 +0000 (18:22 -0800)]
[lldb] Remove "(i.e. ANSI)" from several property descriptions.
Addresses Adrian's feedback from D121062.
Chuanqi Xu [Wed, 9 Mar 2022 02:14:35 +0000 (10:14 +0800)]
Revert "[clang][ABI] New C++20 module mangling scheme"
This reverts commit
21e16ab6b8ddaccb70d2344bb35419e214a32ec9.
It looks like it would break builds in mac. See
https://reviews.llvm.org/D118352.
Amy Zhuang [Wed, 9 Mar 2022 01:17:22 +0000 (17:17 -0800)]
[mlir] Extend AffineForEmptyLoopFolder
Currently when we fold an empty loop, we assume that any loop
with iterArgs returns its iterArgs in order, which is not always
the case. It may return values defined outside of the loop or
return its iterArgs out of order. This patch adds support to
those cases.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D120776
Aart Bik [Tue, 8 Mar 2022 21:24:45 +0000 (13:24 -0800)]
[mlir][sparse] index support in sparse compiler codegen
This revision adds support for the linalg.index to the sparse compiler
pipeline. In essence, this adds the ability to refer to indices in
the tensor index expression, as illustrated below:
Y[i, j, k, l, m] = T[i, j, k, l, m] * i * j
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121251
Peter Klausler [Mon, 7 Mar 2022 21:57:37 +0000 (13:57 -0800)]
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade
non-fatal messages to usage and portability warnings as
appropriate.
Differential Revision: https://reviews.llvm.org/D121246
River Riddle [Tue, 8 Mar 2022 03:07:30 +0000 (19:07 -0800)]
[mlir][NFC] Add various includes currently transitively found in
BuiltinOps.h
These includes are going to be removed from BuiltinOps.h in a followup
when FuncOp is moved out of the Builtin dialect. This commit
pre-emptively adds those includes to simplify the patch moving FuncOp.
Kevin Athey [Tue, 8 Mar 2022 23:17:30 +0000 (15:17 -0800)]
[MSAN] add interceptor for timer_create, timer_settime, timer_gettime
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D120602
Florian Mayer [Wed, 9 Mar 2022 00:41:52 +0000 (16:41 -0800)]
[NFC] [MTE] [HWASan] fixed orphaned comments.
Ryan Senanayake [Wed, 9 Mar 2022 00:27:27 +0000 (00:27 +0000)]
[clang] Fix CodeGenAction for LLVM IR MemBuffers
Replaces use of getCurrentFile with getCurrentFileOrBufferName
in CodeGenAction. This avoids an assertion error or an incorrect
name chosen for the output file when assertions are disabled.
This error previously occurred when the FrontendInputFile was a
MemoryBuffer instead of a file.
Reviewed By: jlebar
Differential Revision: https://reviews.llvm.org/D121259
Florian Mayer [Wed, 9 Mar 2022 00:26:23 +0000 (16:26 -0800)]
[NFC] [MTE] [HWASan] simply code.
Tom Stellard [Tue, 8 Mar 2022 23:49:32 +0000 (15:49 -0800)]
docs: Update instructions for requesting backports to the release branches
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D120974
River Riddle [Tue, 8 Mar 2022 23:06:53 +0000 (15:06 -0800)]
[mlir:toy][NFC] Add comment blocks for toy operations.
Vitaly Buka [Wed, 9 Mar 2022 00:15:21 +0000 (16:15 -0800)]
Revert "Attempt to fix linking issue on the bot"
The issue was fixed with
48c74bb2e2a72830f1068823bfc2f6fd4b53d427
This reverts commit
ac423a8c8aa87a128e51f3690afc1405d06b8c9d.
Florian Mayer [Tue, 8 Mar 2022 23:35:18 +0000 (15:35 -0800)]
[NFC] [HWASan] [MTE] Use function_ref over template.
Vitaly Buka [Tue, 8 Mar 2022 23:31:58 +0000 (15:31 -0800)]
Attempt to fix linking issue on the bot
Shoaib Meenai [Sat, 5 Mar 2022 01:53:21 +0000 (17:53 -0800)]
[cmake] Use CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
Now that our minimum required CMake version is past 3.6, we can use
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES instead of relying on environment
variable trickery. The two aren't entirely equivalent because
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES is only used for try_compiles of
source files and not whole projects, but I ran LLVM configures before
and after this change and the generated CMakeCache.txt files were
identical, so this should be NFC for us.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D121035
Tom Stellard [Tue, 8 Mar 2022 23:10:39 +0000 (15:10 -0800)]
SafeStack: Re-enable SafeStack coloring optimization
This was disabled in
2acea2786b9fd40e1aba018b165834168535e164 as a
work-around for Issue #31491. I've reduced the test case from that bug
and confirmed that it is now fixed.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D120866
Vladislav Khmelevsky [Wed, 2 Mar 2022 21:34:41 +0000 (00:34 +0300)]
[BOLT] Handle ifuncs trampolines for aarch64
The aarch64 uses the trampolines located in .iplt section, which
contains plt-like trampolines on the value stored in .got. In this case
we don't have JUMP_SLOT relocation, but we have a symbol that belongs to
ifunc trampoline, so use it and set set plt symbol for such functions.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D120850
Arthur Eubanks [Tue, 8 Mar 2022 22:33:19 +0000 (14:33 -0800)]
[test] Modify some tests to remove implicit -basic-aa in legacy PM RUN lines
Fangrui Song [Tue, 8 Mar 2022 22:34:53 +0000 (14:34 -0800)]
[SampleProfileInference] Work around odr-use of const non-inline static data member to fix -O0 builds after D120508
MinBaseDistance may be odr-used by std::max, leading to an undefined symbol linker error:
```
ld.lld: error: undefined symbol: (anonymous namespace)::MinCostMaxFlow::MinBaseDistance
>>> referenced by SampleProfileInference.cpp:744 (/home/ray/llvm-project/llvm/lib/Transforms/Utils/SampleProfileInference.cpp:744)
>>> lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SampleProfileInference.cpp.o:((anonymous namespace)::FlowAdjuster::jumpDistance(llvm::FlowJump*) const)
```
Since llvm-project is still using C++ 14, workaround it with a cast.
Andrew Browne [Tue, 8 Mar 2022 21:18:25 +0000 (13:18 -0800)]
[DFSan] Fix several bugs in dfsan custom callbacks test.
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D121249
LLVM GN Syncbot [Tue, 8 Mar 2022 22:21:17 +0000 (22:21 +0000)]
[gn build] Port
c2cd15a66531
Nikolas Klauser [Tue, 8 Mar 2022 22:12:35 +0000 (23:12 +0100)]
[libc++][ranges] Implement ranges::mismatch
Implement `ranges::mismatch`
Reviewed By: Quuxplusone, ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D117817
Arthur Eubanks [Tue, 8 Mar 2022 22:00:08 +0000 (14:00 -0800)]
[test] Use new PM for -aa-eval tests
Florian Hahn [Tue, 8 Mar 2022 22:01:53 +0000 (22:01 +0000)]
[ConstraintElimination] Remove over-eager assertion.
After moving the CanAdd check in
c60cdb44f7ecb4b02ed and using it for
the assume cases as well, the passed in block may not have a branch
instruction as terminator. This can trigger the assertion. Given the new
use case, it doesn't add value any longer and can be removed.
Fixes https://github.com/llvm/llvm-project/issues/54281
Joseph Huber [Tue, 8 Mar 2022 21:53:50 +0000 (16:53 -0500)]
[OpenMP][Docs] Make copy pasting remarks easier
Arthur Eubanks [Tue, 8 Mar 2022 21:37:22 +0000 (13:37 -0800)]
[test][LowerMatrixIntrinsics] Use new PM RUN lines
Louis Dionne [Tue, 8 Mar 2022 21:34:28 +0000 (16:34 -0500)]
[libc++] Remove stray #undef
I think that was left after we removed _CONSTEXPR_TERNARY based on a
review comment -- the #undef was never removed.
Valentin Clement [Tue, 8 Mar 2022 21:08:02 +0000 (22:08 +0100)]
[flang] Lower associate construct
This patch lowers the `associate` construct.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121239
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Amir Ayupov [Tue, 8 Mar 2022 17:17:41 +0000 (09:17 -0800)]
[BOLT][NFC] Handle "dynamic section sizes should match"
Address fuzzer crash on malformed input
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D121070
Lei Zhang [Tue, 8 Mar 2022 20:58:31 +0000 (15:58 -0500)]
[mlir][spirv] Define spv.VectorTimesScalar op
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121247
Lei Zhang [Tue, 8 Mar 2022 20:56:37 +0000 (15:56 -0500)]
[mlir][spirv] Fix spv.GLSL.{S|U}Clamp type checking
It's fine to use any integer (vector) values regardless of the
signedness. The opcode decides how to interpret the bits.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121238
Lei Zhang [Tue, 8 Mar 2022 20:53:22 +0000 (15:53 -0500)]
[mlir][spirv] Handle another form of folding comparsion into clamp
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121227
Tue Ly [Tue, 8 Mar 2022 18:36:39 +0000 (13:36 -0500)]
[libc] Add testing macros for errno and floating point exceptions.
Add testing macros for errno and floating point exceptions.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D121235
Mehdi Amini [Tue, 8 Mar 2022 20:39:51 +0000 (20:39 +0000)]
Revert "Fix link of libmlir.so by adding ExecutionEngine as dependency to GPUTransforms"
This reverts commit
b743850b736e4a89378be8bed61c1b3489b56d19.
This didn't produce the expected result.
spupyrev [Thu, 24 Feb 2022 19:29:37 +0000 (11:29 -0800)]
introducing some profi flags
Differential Revision: https://reviews.llvm.org/D120508
Mehdi Amini [Tue, 8 Mar 2022 20:31:16 +0000 (20:31 +0000)]
Fix link of libmlir.so by adding ExecutionEngine as dependency to GPUTransforms
This feels like a layering violation, but it fixes the build.
Fixes #54242
tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/SerializeToHsaco.cpp.o:SerializeToHsaco.cpp:function (anonymous namespace)::SerializeToHsacoPass::optimizeLlvm(llvm::Module&, llvm::TargetMachine&):
error: undefined reference to 'mlir::makeOptimizingTransformer(unsigned int, unsigned int, llvm::TargetMachine*)'
River Riddle [Tue, 8 Mar 2022 08:04:12 +0000 (00:04 -0800)]
[mlir][SCF] Replace use of FuncOp with FunctionOpInterface
There is nothing specific to FuncOp about the check, it can be changed
to be interface based.
Differential Revision: https://reviews.llvm.org/D121194
River Riddle [Tue, 8 Mar 2022 08:02:21 +0000 (00:02 -0800)]
[mlir][MemRef] Change memref-expand to be a generic operation pass
This pass doesn't rely on any specific characteristics of FuncOp, and
can just be a generic operation pass.
Differential Revision: https://reviews.llvm.org/D121193
River Riddle [Tue, 8 Mar 2022 02:29:59 +0000 (18:29 -0800)]
[mlir] Change ComplexToLLVM to be a generic pass
It is currently a module pass, but shouldn't be. All of the patterns
are local conversions, and don't require anything about
functions/modules.
Differential Revision: https://reviews.llvm.org/D121192
River Riddle [Mon, 7 Mar 2022 21:56:38 +0000 (13:56 -0800)]
[mlir] Update FuncOp conversion passes to Pass/InterfacePass<FunctionOpInterface>
These passes generally don't rely on any special aspects of FuncOp, and moving allows
for these passes to be used in many more situations. The passes that obviously weren't
relying on invariants guaranteed by a "function" were updated to be generic pass, the
rest were updated to be FunctionOpinterface InterfacePasses.
The test updates are NFC switching from implicit nesting (-pass -pass2) form to
the -pass-pipeline form (generic passes do not implicitly nest as op-specific passes do).
Differential Revision: https://reviews.llvm.org/D121190
River Riddle [Tue, 8 Mar 2022 03:13:02 +0000 (19:13 -0800)]
[mlir][NFC] Update the Builtin dialect to use "Both" accessors
Differential Revision: https://reviews.llvm.org/D121189
River Riddle [Tue, 8 Mar 2022 08:05:02 +0000 (00:05 -0800)]
[mlir][Vector] Drop use of FuncOp in transferOpflowOpt
FuncOp isn't really important to hardcode here, it is only used to act
as a root operation for the transformation.
Differential Revision: https://reviews.llvm.org/D121195
River Riddle [Tue, 8 Mar 2022 02:19:15 +0000 (18:19 -0800)]
[mlir][test] Generalize a bunch of FuncOp based passes to run on any operation/interfaces
A lot of test passes are currently anchored on FuncOp, but this
dependency
is generally just historical. A majority of these test passes can run on
any operation, or can operate on a specific interface
(FunctionOpInterface/SymbolOpInterface).
This allows for greatly reducing the API dependency on FuncOp, which
is slated to be moved out of the Builtin dialect.
Differential Revision: https://reviews.llvm.org/D121191
Louis Dionne [Fri, 4 Mar 2022 14:54:29 +0000 (09:54 -0500)]
[libc++] Remove extension to support allocator<const T>
This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.
This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.
This is a re-application of
dbc647643577, which was reverted in
9138666f5
because it broke std::shared_ptr<T const>. Tests have now been added and
we've made sure that std::shared_ptr<T const> wouldn't be broken in this
version.
Differential Revision: https://reviews.llvm.org/D120996
Michael Jones [Tue, 8 Mar 2022 18:19:31 +0000 (10:19 -0800)]
[libc][NFC] remove completed TODOs
There were some "TODO" messages that were for things that I have already
completed. This patch removes those.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D121232
Michael Jones [Tue, 8 Mar 2022 19:17:11 +0000 (11:17 -0800)]
[libc][NFC] split standalone_cpp into single headers
Previously, the entire support/CPP folder was in one header library,
which meant that a lot of headers were included where they shouldn't be.
This patch splits each header into its own target, as well as adjusting
each place they were included to only include what is used.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D121237
Louis Dionne [Tue, 8 Mar 2022 19:48:46 +0000 (14:48 -0500)]
[libc++][NFC] Rename ostreambuf_iterator test
Peter Klausler [Mon, 7 Mar 2022 17:23:21 +0000 (09:23 -0800)]
[flang] Add nonfatal message classes
F18 presently has fatal and non-fatal diagnostic messages. We'd like
to make non-fatal warnings stand out better in the output of the compiler.
This will turn out to be a large change that affects many files.
This patch is just the first part. It converts a Boolean isFatal_ data
member of the message classes into a severity code, and defines four
of these codes (Error, Warning, Portability, and a catch-all Other).
Later patches will result from sweeping over the parser and semantics,
changing most non-fatal diagnostic messages into warnings and portability
notes.
Differential Revision: https://reviews.llvm.org/D121228
Rong Xu [Tue, 8 Mar 2022 19:18:41 +0000 (11:18 -0800)]
[SampleFDO] Allow multiple of --enable-fs-discrimintor option [NFC]
Allow users to use multiple of --enable-fs-discriminator option.
When this option is specified multiple times, the last instance wins.
Fangrui Song [Tue, 8 Mar 2022 19:26:12 +0000 (11:26 -0800)]
[ELF] Inline InputSection::getParent. NFC
Combined with the previous change, lld executable is ~2K smaller and some code
paths using InputSection::getParent are more efficient.
The fragmented headers lead to a design limitation that OutputSection has to be
incomplete, so we cannot use static_cast.
Fangrui Song [Tue, 8 Mar 2022 19:23:41 +0000 (11:23 -0800)]
[ELF] Don't use multiple inheritance for OutputSection. NFC
Add an OutputDesc class inheriting from SectionCommand. An OutputDesc wraps an
OutputSection. This change allows InputSection::getParent to be inlined.
Differential Revision: https://reviews.llvm.org/D120650
Andrzej Warzynski [Tue, 8 Mar 2022 10:01:55 +0000 (10:01 +0000)]
[flang][driver] Add support for `-debug-dump-pft`
This patch adds support for dumping the pre-FIR tree in `flang-new
-fc1`, i.e. Flang's frontend driver. This flag is functionally identical
to `-pft-test` in `bbc` and semantically similar to
`-fdebug-dump-parse-tree` from `flang-new -fc1`.
Differential Revision: https://reviews.llvm.org/D121198
Valentin Clement [Tue, 8 Mar 2022 19:17:48 +0000 (20:17 +0100)]
[flang] Lower computed and assigned goto
This patch lowers the computed and assigned goto statements.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D121219
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Mahesh Ravishankar [Fri, 4 Mar 2022 04:28:47 +0000 (04:28 +0000)]
[mlir][Linalg] Modify `InferStaticShapeOfOperands` to work on Linalg Ops.
Commit rG1a2bb03edab9d7aa31beb587d0c863acc6715d27 introduced a pattern
to convert dynamic dimensions in operands of `GenericOp`s to static
values based on indexing maps and shapes of other operands. The logic
is directly usable to any `LinalgOp`. Move that pattern as an
`OpInterfaceRewritePattern`.
Differential Revision: https://reviews.llvm.org/D120968
Lei Zhang [Tue, 8 Mar 2022 18:45:19 +0000 (13:45 -0500)]
[mlir][spirv] NFC: Move GLSL canonicalization pass to Transforms/
This is a pass that can be used by downstream consumers directly
to avoid the boilerplate to wrap around the `populate*Patterns`.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D121222
Arthur O'Dwyer [Wed, 29 Dec 2021 19:11:46 +0000 (14:11 -0500)]
[libc++] "Bottom-up heapsort" improvement to sort_heap.
https://en.wikipedia.org/wiki/Heapsort#Bottom-up_heapsort
In `pop_heap` specifically, the item we insert at the top and
sift downward is guaranteed to be leaf-sized, so we expect it
to go pretty far down. Sift it down as if it were INT_MIN, and
then bubble it back up if needed.
Also known as "heapsort with bounce."
Numbers are here: https://godbolt.org/z/cvfnYW6fe
Fixes #10008.
Differential Revision: https://reviews.llvm.org/D118003
Arthur O'Dwyer [Mon, 7 Mar 2022 21:56:20 +0000 (16:56 -0500)]
[libc++] Complexity regression tests for make_heap and sort_heap.
Reviewed as part of D118003.
Amir Ayupov [Tue, 8 Feb 2022 04:16:13 +0000 (20:16 -0800)]
[BOLT] CMOVConversion pass
Convert simple hammocks into cmov based on misprediction rate.
Test Plan:
- Assembly test: `cmov-conversion.s`
- Testing on a binary:
# Bootstrap clang with `-x86-cmov-converter-force-all` and `-Wl,--emit-relocs`
(Release build)
# Collect perf.data:
- `clang++ <opts> bolt/lib/Core/BinaryFunction.cpp -E > bf.cpp`
- `perf record -e cycles:u -j any,u -- clang-15 bf.cpp -O2 -std=c++14 -c -o bf.o`
# Optimize clang-15 with and w/o -cmov-conversion:
- `llvm-bolt clang-15 -p perf.data -o clang-15.bolt`
- `llvm-bolt clang-15 -p perf.data -cmov-conversion -o clang-15.bolt.cmovconv`
# Run perf experiment:
- test: `clang-15.bolt.cmovconv`,
- control: `clang-15.bolt`,
- workload (clang options): `bf.cpp -O2 -std=c++14 -c -o bf.o`
Results:
```
task-clock [delta: -360.21 ± 356.75, delta(%): -1.7760 ± 1.7589, p-value: 0.047951, balance: -6]
instructions [delta:
44061118 ±
13246382, delta(%): 0.0690 ± 0.0207, p-value: 0.000001, balance: 50]
icache-misses [delta: -5534468 ± 2779620, delta(%): -0.4331 ± 0.2175, p-value: 0.028014, balance: -28]
branch-misses [delta: -1624270 ± 1113244, delta(%): -0.3456 ± 0.2368, p-value: 0.030300, balance: -22]
```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D120177
Lang Hames [Tue, 8 Mar 2022 18:22:17 +0000 (10:22 -0800)]
[JITLink] Demote symbol scope to local during external-to-absolute conversion.
When an external symbol is converted to an absolute it should be demoted to
local scope so that the symbol does not become a new definition within this
LinkGraph.
Mahesh Ravishankar [Tue, 8 Mar 2022 18:22:19 +0000 (18:22 +0000)]
[mlir] Add canonicalizations for op -> tensor.cast folding.
A `tensor.cast` consumer can be folded with its producer. This is
beneficial only if the result of the tensor cast is more static than
the source. This patch adds a utility function to check that this is
the case, and adds a couple of canonicalizations patterns that fold an
operation with `tensor.cast` conusmers.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D120950
Chia-hung Duan [Tue, 8 Mar 2022 17:48:08 +0000 (17:48 +0000)]
[mlir] Check nullity of MixedContainerType and TypedArrayAttrBase
It's valid to create a TypedArrayAttr or MixedContainerType with
nullptr, e.g.,
std::vector<mlir::Attribute> attrs = {mlir::StringAttr()};
builder.createArrayAttr(attrs);
The predicate didn't check if it's a nullptr and it ended up a crash in
the attribute static verifier. We always check if an attribute is null
so it's better to align the check for these two container type attr.
Reviewed By: rdzhabarov
Differential Revision: https://reviews.llvm.org/D121178
Simon Pilgrim [Tue, 8 Mar 2022 18:06:18 +0000 (18:06 +0000)]
[X86] convertIntLogicToFPLogic - enable fp-logic on pre-AVX targets for supported fp predicates (PR34563)
If the SETCC fp-condcode is supported on SSE as a single CMPPS/PD op then we can use convertIntLogicToFPLogic to reduce EFLAGS and XMM->GPR traffic like we do for AVX targets.
Differential Revision: https://reviews.llvm.org/D121210
Simon Pilgrim [Tue, 8 Mar 2022 18:01:58 +0000 (18:01 +0000)]
[X86] Add cheapX86FSETCC_SSE helper. NFC.
Identify FP CondCode that can be performed by a non-AVX SSE CMP op
Pulled out of D121210
Craig Topper [Tue, 8 Mar 2022 17:59:57 +0000 (09:59 -0800)]
[LegalizeTypes][VP] Add widening and splitting support for VP_FMA.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120854
Craig Topper [Tue, 8 Mar 2022 17:40:18 +0000 (09:40 -0800)]
[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120785
Nicolas Vasilache [Tue, 8 Mar 2022 17:40:12 +0000 (12:40 -0500)]
[mlir][Linalg] Add a polymorphic linalg.copy operation
With the recent improvements to OpDSL it is cheap to reintroduce a linalg.copy operation.
This operation is needed in at least 2 cases:
1. for copies that may want to change the elemental type (e.g. cast, truncate, quantize, etc)
2. to specify new tensors that should bufferize to a copy operation. The linalg.generic form
always folds away which is not always the right call.
Differential Revision: https://reviews.llvm.org/D121230
eopXD [Fri, 11 Feb 2022 09:49:19 +0000 (01:49 -0800)]
[RISCV] Add combination crypto extensions in ISAInfo
The crypto extension have several shorthand extensions that don't consist of any extra instructions.
Take `zk` for example, while the extension would imply `zkn, zkr, zkt`. The 3 extensions should also
combine back into `zk` to maintain the canonical order in isa strings.
This patch addresses the above.
Reviewed By: VincentWu
Differential Revision: https://reviews.llvm.org/D119530
Valentin Clement [Tue, 8 Mar 2022 17:47:28 +0000 (18:47 +0100)]
[flang] Lower sum intrinsic
This patch enables the lowering of the `sum` intrinsic. It adds
also infrastructure to deal with optional arguments in intrinsics and
implied loops.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121221
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Akira Hatanaka [Tue, 8 Mar 2022 17:45:15 +0000 (09:45 -0800)]
[NFC][Clang][OpaquePtr] Remove calls to Address::deprecated in
CGBuiltin.cpp
Differential Revision: https://reviews.llvm.org/D121153
Philip Reames [Tue, 8 Mar 2022 17:42:43 +0000 (09:42 -0800)]
[MSSA] Add clarifying comment for isOptimized on MemoryUse [nfc]
Sanjay Patel [Tue, 8 Mar 2022 15:17:50 +0000 (10:17 -0500)]
[InstCombine] fold fcmp with lossy casted constant
This is noted as a missing clang warning in #54222
(and we should still make that enhancement).
Alive2 proofs:
https://alive2.llvm.org/ce/z/Q8drDq
https://alive2.llvm.org/ce/z/pE6LRt
I don't see a single conversion for all predicates
using "getFCmpCode" logic, so other predicates are
left as a TODO item.
gysit [Tue, 8 Mar 2022 17:30:06 +0000 (17:30 +0000)]
[mlir][OpDSL] Support pointwise ops with rank zero inputs.
Allow pointwise operations to take rank zero input tensors similarly to scalar inputs. Use an empty indexing map to broadcast rank zero tensors to the iteration domain of the operation.
Depends On D120734
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120807
Philip Reames [Tue, 8 Mar 2022 17:38:01 +0000 (09:38 -0800)]
[MSSA] Add comments describing optimized uses for MemoryDefs [nfc]
As clarified by a recent email chain with Alina.
gysit [Tue, 8 Mar 2022 17:20:01 +0000 (17:20 +0000)]
[mlir][OpDSL] Remove unused SoftPlus2DOp operation.
The revision removes the SoftPlus2DOp operation that previously served as a test operation. It has been replaced by the elemwise_unary operation, which is now used to test unary log and exp functions.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120794
Andrzej Warzynski [Tue, 8 Mar 2022 15:19:36 +0000 (15:19 +0000)]
[flang][nfc] Update the CMake dependencies for `flangFrontend`
The "FrontendActions.cpp" file (which is one of the source files for the
`flangFrontend` library) includes "Passes.h.inc" (indirectly, via
"CLOptions.inc"). This file is generated alongside other TableGen
outputs from the `FIROptTransformsPassIncGen` CMake target. This patch
adds `FIROptTransformsPassIncGen` to the list of build dependencies for
`flangFrontend`.
The lack of this dependency might cause non-determinstic build failures,
e.g. https://lab.llvm.org/buildbot/#/builders/160/builds/6210.
Differential Revision: https://reviews.llvm.org/D121218
Amir Ayupov [Tue, 8 Mar 2022 17:12:19 +0000 (09:12 -0800)]
[BOLT][NFC] Check section contents before registering it
Address fuzzer crash on malformed input:
```
BOLT-ERROR: cannot get section contents for .dynsym: The end of the file was unexpectedly encountered.
```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D121068
gysit [Tue, 8 Mar 2022 17:06:50 +0000 (17:06 +0000)]
[mlir][OpDSL] Simplify index and constant tests.
Simplify tests that use `linalg.fill_rng_2d` to focus on testing the `const` and `index` functions. Additionally, cleanup emit_misc.py to use simpler test functions and fix an error message in config.py.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120734
Arnold Schwaighofer [Tue, 8 Mar 2022 15:19:58 +0000 (07:19 -0800)]
InstCombine: Can't fold a phi arg load into the phi if the load is from a swifterror address
`swifterror` addresses are only allowed as operands to load, store, and
calls.
The following transformation is not allowed. It would create a phi with a
`swifterror` address operand.
```
%addr = alloca swifterror i8*
br %cond, label %bb1, label %b22
bb1:
%val1 = load i8*, i8** %addr
br exit
bb2:
%val2 = load i8*, i8** %addr
br exit
exit:
%val = phi [%val1, %bb1] [%val2, %bb2]
```
=>
```
%addr = alloca swifterror i8*
br %cond, label %bb1, label %b22
bb1:
br exit
bb2:
br exit
exit:
%val_addr = phi [%addr, %bb1] [%addr, %bb2]
%val2 = load i8*, i8** %val_addr
```
rdar://
89865485
Differential Revision: https://reviews.llvm.org/D121217
Hongtao Yu [Mon, 28 Feb 2022 19:28:31 +0000 (11:28 -0800)]
[CSSPGO][SCCIterator] Fix a non-determinism in scc_member_iterator
Previously we initialed the work queue with MST roots based on NodeInfoMap which is an unordered map. This could cause a non-determinism. I'm fixing this by initializing the queue based on SortedEdges.
I don't see any performance move with this change. However this helps debugging.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D120670