Joshua Batista [Thu, 8 Dec 2022 21:03:47 +0000 (13:03 -0800)]
add floor library function
This change exposes the floor library function for HLSL,
excluding long, int, and long long doubles.
Floor is supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the floor function only works on floating type arguments.
The full documentation of the HLSL floor function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-floor
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D139137
Peiming Liu [Thu, 8 Dec 2022 20:03:18 +0000 (20:03 +0000)]
[mlir][sparse] reject kernels with non-sparsfiable reduction expression.
To address https://github.com/llvm/llvm-project/issues/59394.
Reduction on negation of the output tensor is a non-sparsifiable kernel, it creates cyclic dependency.
This patch reject those cases instead of crashing.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D139659
David Green [Thu, 8 Dec 2022 23:08:06 +0000 (23:08 +0000)]
[ARM][AArch64] Some additional for bitcast splats. NFC
Roman Lebedev [Thu, 8 Dec 2022 23:06:33 +0000 (02:06 +0300)]
[NFC] Port one more codegen WinEH test to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 23:04:45 +0000 (02:04 +0300)]
[NFC] Port last few Transforms tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 23:04:06 +0000 (02:04 +0300)]
[NFC] Port last few Other tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 23:03:37 +0000 (02:03 +0300)]
[NFC] Port all Verifier tests to `-passes=` syntax
Vitaly Buka [Thu, 8 Dec 2022 22:52:00 +0000 (14:52 -0800)]
[NFC][asan] Guard implemetation with ASAN_INTERCEPT_SWAPCONTEXT
Yaxun (Sam) Liu [Thu, 8 Dec 2022 21:56:25 +0000 (16:56 -0500)]
Revert "[AMDGPU] Disable bool range metadata to workaround backend issue"
This reverts commit
107ee2613063183cb643cef97f0fad403508c9f0 to facilitate
investigating and fixing the root cause.
Differential Revision: https://reviews.llvm.org/D135269
Roman Lebedev [Thu, 8 Dec 2022 21:54:41 +0000 (00:54 +0300)]
[NFC] Port codegen X86 tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:41 +0000 (00:54 +0300)]
[NFC] Port codegen WinEH tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:40 +0000 (00:54 +0300)]
[NFC] Port codegen Thumb2 tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:40 +0000 (00:54 +0300)]
[NFC] Port codegen Thumb tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:40 +0000 (00:54 +0300)]
[NFC] Port codegen SystemZ tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:39 +0000 (00:54 +0300)]
[NFC] Port codegen PowerPC tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:39 +0000 (00:54 +0300)]
[NFC] Port codegen NVPTX tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:36 +0000 (00:54 +0300)]
[NFC] Port codegen Generic tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:35 +0000 (00:54 +0300)]
[NFC] Port codegen ARM tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:35 +0000 (00:54 +0300)]
[NFC] Port codegen AMDGPU tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:54:35 +0000 (00:54 +0300)]
[NFC] Port codegen AArch64 tests that invoke opt to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:52:21 +0000 (00:52 +0300)]
[NFC] Port all tools tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:52:21 +0000 (00:52 +0300)]
[NFC] Port all Verifier tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:51:45 +0000 (00:51 +0300)]
[NFC] Port all Other tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:51:45 +0000 (00:51 +0300)]
[NFC] Port all LTO tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:51:45 +0000 (00:51 +0300)]
[NFC] Port all Feature tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:51:01 +0000 (00:51 +0300)]
[NFC] Port all DebugInfo tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:50:33 +0000 (00:50 +0300)]
[NFC] Port all Bitcode tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:43 +0000 (00:49 +0300)]
[NFC] Port all Analysis/ScalarEvolution tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:42 +0000 (00:49 +0300)]
[NFC] Port all Analysis/MustExecute tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:41 +0000 (00:49 +0300)]
[NFC] Port all Analysis/MemorySSA tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:40 +0000 (00:49 +0300)]
[NFC] Port all Analysis/LoopAccessAnalysis tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:40 +0000 (00:49 +0300)]
[NFC] Port all Analysis/LazyValueAnalysis tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:39 +0000 (00:49 +0300)]
[NFC] Port all Analysis/GlobalsModRef tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:38 +0000 (00:49 +0300)]
[NFC] Port all Analysis/Dominators tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:36 +0000 (00:49 +0300)]
[NFC] Port all Analysis/CallGraph tests to `-passes=` syntax
Roman Lebedev [Thu, 8 Dec 2022 21:49:35 +0000 (00:49 +0300)]
[NFC] Port all Analysis/AliasSet tests to `-passes=` syntax
Keith Smiley [Thu, 8 Dec 2022 20:33:41 +0000 (12:33 -0800)]
[lld-macho] Update -adhoc_codesign default
With newer versions of ld64 it generates an adhoc signature by default
for all arm64 simulator targets. This default is especially important
for unit test targets that rarely have custom codesigning requirements
but otherwise won't run on arm64 macs.
Differential Revision: https://reviews.llvm.org/D139672
Nikolas Klauser [Tue, 1 Nov 2022 21:29:57 +0000 (22:29 +0100)]
[libc++][math.h] Add double overloads
This allows libc++ to work with libcs that don't provide a proper math.h implementation.
Reviewed By: ldionne, #libc
Spies: aaron.ballman, fhahn, bcain, Izaron, libcxx-commits
Differential Revision: https://reviews.llvm.org/D138629
Bastian Kersting [Thu, 8 Dec 2022 20:22:42 +0000 (12:22 -0800)]
scudo-standalone: Add GetRSS method on Linux
This change adds a GetRSS method on Linux that parses
the number from /proc/self/statm. This change is part
of splitting up https://reviews.llvm.org/D126752.
Reviewed By: vitalybuka, cryptoad
Differential Revision: https://reviews.llvm.org/D139430
Nikolas Klauser [Sun, 4 Dec 2022 14:55:27 +0000 (15:55 +0100)]
[libc++] Move filter_view::iterator and sentinel out of filter_view
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D139273
Jennifer Yu [Thu, 1 Dec 2022 23:54:35 +0000 (15:54 -0800)]
[OPENMP51]Codegen for error directive.
Added codegen for `omp error` directive.
This is to generate IR to call:
void __kmpc_error(ident_t *loc, int severity, const char *message);
Differential Revision: https://reviews.llvm.org/D139166
Paul Kirth [Thu, 8 Dec 2022 18:30:14 +0000 (18:30 +0000)]
Reland "[pgo] Avoid introducing relocations by using private alias"
In many cases, we can use an alias to avoid a symbolic relocations,
instead of using the public, interposable symbol. When the instrumented
function is in a COMDAT, we can use a hidden alias, and still avoid
references to discarded sections.
This disables the failing runtime test on Windows, since the compiler
options (-fPIC) are unsupported on that platform.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D137982
Gaëtan Bossu [Thu, 8 Dec 2022 20:50:02 +0000 (21:50 +0100)]
utils/update_mir_test_checks.py: support UTC_ARGS
As a reminder, UTC_ARGS is used by lit test cases to specify which
arguments need to be passed to update_XXXX_test_checks.py to be
auto-updated properly.
The support is achieved by relying on common.itertests, which is what
other test
updaters use to iterate over test files.
This commit also changes how the --llc-binary option is saved in args.
It used to be saved as "llc", but it is here changed to the standard
"llc_binary" to make use of an existing ignore mechanism for specific
arguments. Without that change, the option would not be ignored and
would appear in UTC_ARGS. This would be different from what e.g.
update_llc_test_checks does. As update_mir_test_checks.py now supports
UTC_ARGS, it became important to ensure the option is ignored.
Differential Revision: https://reviews.llvm.org/D135580
Roman Lebedev [Thu, 8 Dec 2022 20:35:26 +0000 (23:35 +0300)]
[opt] Disincentivize new tests from using old pass syntax
Over the past day or so, i've took a large swing at our tests,
and reduced the number of tests that were still using the old syntax
from ~1800 to just 200.
Left to handle: (as it is seen in this patch)
* Transforms/LSR
* Transforms/CGP
* Transforms/TypePromotion
* Transforms/HardwareLoops
* Analysis/*
* some misc.
I think this is the right point to start actively refusing
to honor the old syntax, except for the old tests,
to prevent the old syntax from creeping back in.
Thus, let's add temporary default-off flag,
and if it is not passed refuse to accept old syntax.
The tests that still need porting are annotated with this flag.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D139647
Martin Storsjö [Fri, 25 Nov 2022 12:23:38 +0000 (14:23 +0200)]
[openmp] Provide an assembly implementation of __kmp_invoke_microtask on ARM
This fixes passing an arbitrarily large number of arguments to
microtasks, fixing the misc_bugs/many-microtask-args.c testcase on
ARM.
Differential Revision: https://reviews.llvm.org/D138704
Alex Richardson [Thu, 8 Dec 2022 20:31:44 +0000 (20:31 +0000)]
[LLParser] Support symbolic address space numbers
This allows the LLParser to also accept "A", "G", and "P" in `addrspace`
usages. "A" will be replaced by the alloca address space defined in the
globals, "G" by the default globals address space and "P" by the program
address space. This makes it easier to write tests that use different
address space and only only vary the RUN: lines. Currently, the only
alternative is to pre-process the sources with a tool such as `sed`
Importantly, these new string values are only accepted in .ll files and
not stored in the bitcode format, so it does not round-trip via llvm-as
and llvm-dis (see newly added test).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D138789
Alex Richardson [Thu, 8 Dec 2022 10:47:22 +0000 (10:47 +0000)]
Simplify clang/test/CodeGen/annotations-global.c CHECK lines
There is no need to run FileCheck 5 times, we can use CHECK-DAG instead.
Alex Richardson [Thu, 8 Dec 2022 10:38:53 +0000 (10:38 +0000)]
Fix annotations-field.c CHECK lines being ignored
Pointed out by @jrtc27 in https://reviews.llvm.org/D138722.
Sunil K [Thu, 8 Dec 2022 18:26:17 +0000 (10:26 -0800)]
[OpenMP] Clang Support for taskwait nowait clause
Support for taskwait nowait clause with placeholder for runtime changes.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D131830
Gaëtan Bossu [Thu, 8 Dec 2022 19:49:04 +0000 (20:49 +0100)]
utils/update_mir_test_checks.py: allow checking fixedStack in .mir files
Generation of CHECK lines for fixedStack can be enabled with --print-fixed-stack.
This is particularly useful for tests which need to inspect how the
stack looks, e.g. for ABI tests.
See the other stacked revision building on top of this one which enables UTC_ARGS (in a similar fashion to other test updaters in utils/).
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D135579
Jeff Niu [Thu, 8 Dec 2022 19:45:18 +0000 (11:45 -0800)]
[mlir][ods] BitEnumAttr: Actually use the 'str' for the all unset case
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139657
Haojian Wu [Thu, 8 Dec 2022 20:07:58 +0000 (21:07 +0100)]
[Attributor] Fix a break in relase build caused by
61318fa5c764d6af60baeb1c00d793f1bd95f5ea.
Kirill Stoimenov [Thu, 8 Dec 2022 19:10:19 +0000 (19:10 +0000)]
[HWASAN] Removed right_aligned from HWASAN allocator Metadata.
This came up during review of D139464. Looks like this filed is always set to false to it is basically unused.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D139654
Nicolai Hähnle [Mon, 5 Dec 2022 17:21:59 +0000 (18:21 +0100)]
Scalarizer: fix an opaque pointer bug
With opaque pointers, it's possible for the same pointer value to be
used to store different vector types (both number and type of elements),
so we need to take that into account when caching the scattering.
Differential Revision: https://reviews.llvm.org/D139359
Nicolai Hähnle [Fri, 2 Dec 2022 15:07:30 +0000 (16:07 +0100)]
Scalarizer: explicitly exclude scalable vectors
They are unsupported and would previously crash, now we just skip them.
Hypothetically, one could consider "scalarizing" a <vscale x n x T> into
n copies of <vscale x 1 x T>. But (1) it's unclear how to do that
because insertelement etc. don't work with scalable vectors in the
required way, and (2) there is no user of such functionality.
Differential Revision: https://reviews.llvm.org/D139358
Dhruva Chakrabarti [Thu, 8 Dec 2022 18:57:11 +0000 (10:57 -0800)]
[OpenMP] [OMPT] [3/8] Implemented callback registration in libomptarget
The purpose of this patch is to have tool-provided callbacks registered
in libomptarget. The overall design document is in
https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc
Defined a class OmptDeviceCallbacksTy that will be used by libomptarget
and a plugin for callbacks registered by a tool. Once the callbacks are
registered in libomp, a lookup function is passed to libomptarget that is
used to retrieve the callbacks and register them in libomptarget.
Patch from John Mellor-Crummey <johnmc@rice.edu>
(With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>)
Reviewed By: jplehr, tianshilei1992
Differential Revision: https://reviews.llvm.org/D123974
Nicolai Hähnle [Tue, 6 Dec 2022 20:58:26 +0000 (21:58 +0100)]
update_mir_test_checks.py: match dead vreg definitions
Differential Revision: https://reviews.llvm.org/D139466
zijunzhao [Thu, 8 Dec 2022 19:35:44 +0000 (19:35 +0000)]
[tsan] re-exec when ASLR is enabled for x86_64 as well
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D136897
Richard Smith [Wed, 7 Dec 2022 23:20:49 +0000 (15:20 -0800)]
When merging lambdas, keep track of the capture lists from each version.
Different versions of a lambda will in general refer to different
enclosing variable declarations, because we do not merge most
block-scope declarations, such as local variables. Keep track of all the
declarations that correspond to a lambda's capture fields so that we can
rewrite the name of any of those variables to the lambda capture,
regardless of which copy of the body of `operator()` we look at.
Jeff Niu [Tue, 6 Dec 2022 20:55:43 +0000 (12:55 -0800)]
[mlir] FunctionOpInterface: arg and result attrs dispatch to interface
This patch removes the `arg_attrs` and `res_attrs` named attributes as a
requirement for FunctionOpInterface and replaces them with interface
methods for the getters, setters, and removers of the relevent
attributes. This allows operations to use their own storage for the
argument and result attributes.
Depends on D139471
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139472
Jeff Niu [Tue, 6 Dec 2022 21:09:24 +0000 (13:09 -0800)]
[mlir][ods] Generate remover methods with camelcase
The remove*Attr methods were not being generated with the correct
camelcase method.
Depends on D139470
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139471
Jeff Niu [Tue, 6 Dec 2022 21:00:01 +0000 (13:00 -0800)]
[mlir][ods] Make Operator.h comments triple forward slash (NFC)Depends on D139447
Depends on D139447
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139470
Jeff Niu [Tue, 6 Dec 2022 19:28:47 +0000 (11:28 -0800)]
[mlir] FunctionOpInterface: make get/setFunctionType interface methods
This patch removes the concept of a `function_type`-named type attribute
as a requirement for implementors of FunctionOpInterface. Instead, this
type should be provided through two interface methods, `getFunctionType`
and `setFunctionTypeAttr` (*Attr because functions may use different
concrete function types), which should be automatically implemented by
ODS for ops that define a `$function_type` attribute.
This also allows FunctionOpInterface to materialize function types if
they don't carry them in an attribute, for example.
Importantly, all the function "helper" still accept an attribute name to
use in parsing and printing functions, for example.
Reviewed By: rriddle, lattner
Differential Revision: https://reviews.llvm.org/D139447
Leonard Chan [Thu, 8 Dec 2022 19:29:28 +0000 (19:29 +0000)]
[compiler-rt] Add opt-in -ftrivial-auto-var-init flag for writing over uninitialized stack variiables
This might allow lsan to find more leaks that would have gone
undetected. When lsan searches for leaked pointers on the stack, if a
leaked pointer that was pushed to the stack in a prior function call
would not be scrubbed on a future function call, then the scan will see
the pointer on the stack and not mark it as leaked. Such holes can exist
in the lsan runtime where there may be uninitialized data. Adding
auto-var-init can scrub some of that data and might be able to catch
more leaks that would've gone undetected this way.
See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=111351 for more
details.
Differential Revision: https://reviews.llvm.org/D135716
Sanjay Patel [Thu, 8 Dec 2022 18:42:21 +0000 (13:42 -0500)]
[InstCombine] add tests for insertelts of truncs; NFC
Sanjay Patel [Thu, 8 Dec 2022 15:47:53 +0000 (10:47 -0500)]
Revert "[InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 1 (2nd try)"
This reverts commit
e71b81cab09bf33e3b08ed600418b72cc4117461.
As discussed in the planned follow-on to this patch (D138874),
this and the subsequent patches in this set can cause trouble for
the backend, and there's probably no quick fix. We may even
want to canonicalize in the opposite direction (towards insertelt).
Sanjay Patel [Thu, 8 Dec 2022 15:46:49 +0000 (10:46 -0500)]
Revert "[InstCombine] improve efficiency of bool logic; NFC"
This reverts commit
b7c7fe3d0779b6e332fe6db64e87561deba2e56a.
As discussed in the planned follow-on to this patch (D138874),
this and the previous patch in this set can cause trouble for
the backend, and there's probably no quick fix. We may even
want to canonicalize in the opposite direction (towards insertelt).
Corentin Jabot [Thu, 8 Dec 2022 18:57:02 +0000 (19:57 +0100)]
Revert "Implement CWG2631"
This patch causes another link error,
reverting until I can investigate.
This reverts commit
a96a6ed83230265f3eab09a94f0e9525d05f8a74.
Vlad Serebrennikov [Thu, 8 Dec 2022 18:03:42 +0000 (21:03 +0300)]
[clang] Add test for CWG418
P1787: //[[ https://cplusplus.github.io/CWG/issues/418.html | CWG418 ]] is resolved by trivial rephrasing along with that necessary for the new using-declaration interpretation.//
Wording: see changes to [dcl.fct.default]/9 and [over.match.best]/4.
[over.match.best]/4 includes [[ https://eel.is/c++draft/over.match.best#general-example-8 | an example ]] that is not properly diagnosed by Clang.
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D139429
Joseph Huber [Thu, 8 Dec 2022 18:34:38 +0000 (13:34 -0500)]
[OpenMP][libomp] Fix version scripts after undefined version script changes
Summary:
Building with `lld` now errors on undefined symbols by default now. This
was causing `libomp` to think that the compiler didn't support version
scripts when checking linker features. This patch adds a new script that
exports all symbols to be used for testing. We also remove the old
workarounds for undefined versions now that it's no longer necessary.
Paul Walker [Thu, 8 Dec 2022 17:54:08 +0000 (17:54 +0000)]
[MC][AArch64] Remove bogus whitespace of markup'd immediate.
Aaron Ballman [Thu, 8 Dec 2022 18:16:29 +0000 (13:16 -0500)]
Update the status of a few more C DRs
This includes tests for DR085 and DR259.
Alexander Belyaev [Thu, 8 Dec 2022 18:06:19 +0000 (19:06 +0100)]
[mlir][linalg] Print broadcast, map, reduce, transpose ins/outs on one line.
Differential Revision: https://reviews.llvm.org/D139650
Paul Kirth [Thu, 8 Dec 2022 18:14:48 +0000 (18:14 +0000)]
Revert "Reland "[pgo] Avoid introducing relocations by using private alias"""
This reverts commit
071c39df8632561b599f7b1debd81b3cf6b5b396.
One of the new runtimes tests causes a failure with MSVC, so I'm
reverting until the test can be fixed.
Philip Reames [Thu, 8 Dec 2022 18:12:00 +0000 (10:12 -0800)]
[RISCV][InsertVSETVLI] vmv.s.x and fvmv.s.f do not depend on LMUL
We already have this rule encoded elsewhere in the file - which is why we don't see any test changes. I'm adding it here for completionism.
This is not technically NFC since there could be a test case which isn't caught by the specific rules, but is handled by the generic logic. I don't have such an example.
Kazu Hirata [Thu, 8 Dec 2022 18:07:43 +0000 (10:07 -0800)]
[ADT] Use std::nullopt instead of llvm::None in OptionalTest.cpp
This patch updates the test for the streaming operator for
llvm::Optional to use std::nullopt instead of llvm::None.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D139513
Arthur Eubanks [Wed, 23 Nov 2022 22:13:49 +0000 (14:13 -0800)]
[lldb] Fix simple template names interaction with debug info declarations
Without checking template parameters, we would sometimes lookup the
wrong type definition for a type declaration because different
instantiations of the same template class had the same debug info name.
The added GetForwardDeclarationDIETemplateParams() shouldn't need a
cache because we'll cache the results of the declaration -> definition
lookup anyway. (DWARFASTParserClang::ParseStructureLikeDIE()
is_forward_declaration branch)
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D138834
Paul Kirth [Fri, 2 Dec 2022 00:21:20 +0000 (00:21 +0000)]
Reland "[pgo] Avoid introducing relocations by using private alias""
In many cases, we can use an alias to avoid a symbolic relocations,
instead of using the public, interposable symbol. When the instrumented
function is in a COMDAT, we can use a hidden alias, and still avoid
references to discarded sections.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D137982
Roman Lebedev [Thu, 8 Dec 2022 16:51:30 +0000 (19:51 +0300)]
[SROA] For non-speculatable `load`s of `select`s -- split block, insert then/else blocks, form two-entry PHI node, take 2
Currently, SROA is CFG-preserving.
Not doing so does not affect any pipeline test. (???)
Internally, SROA requires Dominator Tree, and uses it solely for the final `-mem2reg` call.
By design, we can't really SROA alloca if their address escapes somehow,
but we have logic to deal with `load` of `select`/`PHI`,
where at least one of the possible addresses prevents promotion,
by speculating the `load`s and `select`ing between loaded values.
As one would expect, that requires ensuring that the speculation is actually legal.
Even ignoring complexity bailouts, that logic does not deal with everything,
e.g. `isSafeToLoadUnconditionally()` does not recurse into hands of `select`.
There can also be cases where the load is genuinely non-speculate.
So if we can't prove that the load can be speculated,
unfold the select, produce two-entry phi node, and perform predicated load.
Now, that transformation must obviously update Dominator Tree,
since we require it later on. Doing so is trivial.
Additionally, we don't want to do this for the final SROA invocation (D136806).
In the end, this ends up having negative (!) compile-time cost:
https://llvm-compile-time-tracker.com/compare.php?from=
c6d7e80ec4c17a415673b1cfd25924f98ac83608&to=
ddf9600365093ea50d7e278696cbfa01641c959d&stat=instructions:u
Though indeed, this only deals with `select`s, `PHI`s are still using speculation.
Should we update some more analysis?
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D138238
This reverts commit
739611870d3b06605afe25cc07833f6a62de9545,
and recommits
03e6d9d9d1d48e43f3efc35eb75369b90d4510d5
with a fixed assertion - we should check that DTU is there,
not just assert false...
Michael Buch [Thu, 8 Dec 2022 17:08:00 +0000 (17:08 +0000)]
[lldb][Test] TestRerunAndExpr.py: explicitly delete a.out before rebuilding it
**Summary**
Older versions of `make` would occasionally fail to realize
that a pre-requisite for the `a.out` target has changed. This
resulted in roughly 1 out of 10 test runs to fail. Instead of
relying on `make` to resolve this dependency simply remove the
file before rebuilding; this will give make no option but to
remake `a.out`.
**Testing**
* Confirmed that the test passes on the host for 100 runs where
without the patch it would fail after ~10
**Details**
Adding `-d` to lldbtest's `make` invocation and running the
test without this patch sometimes yielded:
```
Removing child 0x600000308ff0 PID 19915 from chain.
Successfully remade target file `rebuild.o'.
Finished prerequisites of target file `a.out'.
Prerequisite `rebuild.o' is newer than target `a.out'.
No need to remake target `a.out'.
```
Differential Revision: https://reviews.llvm.org/D139643
Roman Lebedev [Thu, 8 Dec 2022 16:49:24 +0000 (19:49 +0300)]
Revert "[SROA] For non-speculatable `load`s of `select`s -- split block, insert then/else blocks, form two-entry PHI node"
The assertion about not modifying the CFG seems to not hold,
will recommit in a bit.
https://lab.llvm.org/buildbot#builders/139/builds/32412
This reverts commit
03e6d9d9d1d48e43f3efc35eb75369b90d4510d5.
This reverts commit
4f90f4ada33718f9025d0870a4fe3fe88276b3da.
bixia1 [Thu, 8 Dec 2022 16:22:37 +0000 (08:22 -0800)]
[mlir][sparse] Fix checks in a test.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D139636
Roman Lebedev [Thu, 8 Dec 2022 16:40:35 +0000 (19:40 +0300)]
[NFCI][SROA] `rewriteSelectInstLoads()`: add forgotten false into assertion
Peter Klausler [Tue, 6 Dec 2022 22:00:21 +0000 (14:00 -0800)]
[flang] Restore old unit locking behavior
Rework the recursive I/O error check on I/O units so that
threads again hold a lock on a unit throughout an I/O statement.
Add an API to the runtime's Lock class implementation for pthreads
to allow detection of solf-deadlock without depending on EDEADLK
or recursive mutexes.
This should fix I/O from OpenMP threads.
Differential Revision: https://reviews.llvm.org/D139477
Jakub Kuderski [Thu, 8 Dec 2022 16:22:46 +0000 (11:22 -0500)]
[mlir][arith] Add missing heading comment. NFC.
Brett Wilson [Wed, 7 Dec 2022 18:26:04 +0000 (10:26 -0800)]
[clang-doc] Add template support.
Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.
Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").
In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.
Convert llvm::Optional to std::optional (YAML library requires this for
the new usage, and this makes everything consistent according to the
llvm::Optional -> std::optional transition).
Differential Revision: https://reviews.llvm.org/D139154
bixia1 [Thu, 8 Dec 2022 00:14:22 +0000 (16:14 -0800)]
[mlir][sparse] Fix problems in creating complex zero for initialization.
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D139591
Haojian Wu [Thu, 8 Dec 2022 15:15:34 +0000 (16:15 +0100)]
Add distinguished content to the empty test headers.
To make the lit test print-header-json.c passed on a file-content-hash
file system.
Sanjay Patel [Thu, 8 Dec 2022 14:58:17 +0000 (09:58 -0500)]
Revert "[InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 2"
This reverts commit
dd8d0d21ce6d0665ef5d426372096aaed85b479a.
As discussed in the planned follow-on to this patch (D138874),
this and the previous patch in this set can cause trouble for
the backend, and there's probably no quick fix. We may even
want to canonicalize in the opposite direction (towards insertelt).
Krzysztof Parzyszek [Thu, 8 Dec 2022 01:34:42 +0000 (19:34 -0600)]
[SCEV] Convert Optional to std::optional
Guillaume Chatelet [Thu, 8 Dec 2022 14:33:20 +0000 (14:33 +0000)]
[NFC] Simplify documentation about alignment in MCStreamer
Roman Lebedev [Thu, 8 Dec 2022 13:50:19 +0000 (16:50 +0300)]
[SROA] For non-speculatable `load`s of `select`s -- split block, insert then/else blocks, form two-entry PHI node
Currently, SROA is CFG-preserving.
Not doing so does not affect any pipeline test. (???)
Internally, SROA requires Dominator Tree, and uses it solely for the final `-mem2reg` call.
By design, we can't really SROA alloca if their address escapes somehow,
but we have logic to deal with `load` of `select`/`PHI`,
where at least one of the possible addresses prevents promotion,
by speculating the `load`s and `select`ing between loaded values.
As one would expect, that requires ensuring that the speculation is actually legal.
Even ignoring complexity bailouts, that logic does not deal with everything,
e.g. `isSafeToLoadUnconditionally()` does not recurse into hands of `select`.
There can also be cases where the load is genuinely non-speculate.
So if we can't prove that the load can be speculated,
unfold the select, produce two-entry phi node, and perform predicated load.
Now, that transformation must obviously update Dominator Tree,
since we require it later on. Doing so is trivial.
Additionally, we don't want to do this for the final SROA invocation (D136806).
In the end, this ends up having negative (!) compile-time cost:
https://llvm-compile-time-tracker.com/compare.php?from=
c6d7e80ec4c17a415673b1cfd25924f98ac83608&to=
ddf9600365093ea50d7e278696cbfa01641c959d&stat=instructions:u
Though indeed, this only deals with `select`s, `PHI`s are still using speculation.
Should we update some more analysis?
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D138238
Simon Pilgrim [Thu, 8 Dec 2022 13:51:08 +0000 (13:51 +0000)]
[X86] Add HasCLFLUSH pseudo-predicate (Issue #19039)
Similar to what we've done for HasMFence - this puts into place a pseudo-predicate for CLFLUSH instructions that separates it from HasSSE2 to make it easier to use CLFLUSH even when SSE/fpmath has been disabled - technically CLFLUSH has its own CPUID bit, so could be available on x86 cores entirely without SSE, but I don't think thats ever happened or likely to happen.
Nico Weber [Wed, 7 Dec 2022 18:48:08 +0000 (13:48 -0500)]
[lld/mac] Abort link immediately on invalid -undefined argument
I tried `-undefined suppress` without `-flat_namespace`.
lld printed `'-undefined suppress' only valid with '-flat_namespace'`
followed by many many screenfuls of error messages about undefined
symbols, making the original diag hard to see.
This is probably the common case when using `-undefined`, so let's
just abort the link immediately when there's an invalid `-undefined`
arg.
Differential Revision: https://reviews.llvm.org/D139559
Sebastian Neubauer [Wed, 13 Jul 2022 16:42:40 +0000 (18:42 +0200)]
[AMDGPU] Add test that spills WWM CSRs twice
Add a test to show a deficit in the current wwm/spilling code that
creates double saves and restores for v40 and v41.
This case came up in D124193.
Differential Revision: https://reviews.llvm.org/D139626
Luke Lau [Thu, 8 Dec 2022 12:56:15 +0000 (12:56 +0000)]
[WebAssembly] Initialize missing passes in WebAssemblyTargetMachine
These passes were lying around but weren't initialized, so they weren't
showing up in -print-after-all.
Differential Revision: https://reviews.llvm.org/D139440
Haojian Wu [Thu, 8 Dec 2022 12:36:33 +0000 (13:36 +0100)]
[tooling] use std::optional in tooling StandardLibrary.h/.cpp, NFC
Alexandros Lamprineas [Thu, 8 Dec 2022 12:42:34 +0000 (12:42 +0000)]
Revert "[IPSCCP] Move the IPSCCP run function under the IPO directory."
This reverts commit
42c2dc401742266da3e0251b6c1ca491f4779963.
This broke some buildbots:
undefined reference to `llvm::createBitTrackingDCEPass()'
undefined reference to `llvm::createAlignmentFromAssumptionsPass()'
undefined reference to `llvm::createLoopUnrollPass(int, bool, bool, int, int, int, int, int, int)'
undefined reference to `llvm::createLICMPass(unsigned int, unsigned int, bool)'
undefined reference to `llvm::createWarnMissedTransformationsPass()'
undefined reference to `llvm::createAlignmentFromAssumptionsPass()'
undefined reference to `llvm::createCallSiteSplittingPass()'
undefined reference to `llvm::createCFGSimplificationPass(llvm::SimplifyCFGOptions, std::function<bool (llvm::Function const&)>)'
undefined reference to `llvm::createFloat2IntPass()'
undefined reference to `llvm::createLowerConstantIntrinsicsPass()'
undefined reference to `llvm::createLoopRotatePass(int, bool)'
undefined reference to `llvm::createLoopDistributePass()'
undefined reference to `llvm::createLoopSinkPass()'
undefined reference to `llvm::createInstSimplifyLegacyPass()'
undefined reference to `llvm::createDivRemPairsPass()'
undefined reference to `llvm::createCFGSimplificationPass(llvm::SimplifyCFGOptions, std::function<bool (llvm::Function const&)>)'
undefined reference to `llvm::SetLicmMssaOptCap'
undefined reference to `llvm::SetLicmMssaNoAccForPromotionCap'
undefined reference to `llvm::ForgetSCEVInLoopUnroll'
Alexandros Lamprineas [Thu, 8 Dec 2022 12:38:24 +0000 (12:38 +0000)]
Revert "[FuncSpec] Make the Function Specializer part of the IPSCCP pass."
This reverts commit
877a9f9abec61f06e39f1cd872e37b828139c2d1.
It depends on the parent revision
42c2dc401742266da3e0251b6c1ca491f4779963
which needs to be reverted as it broke some buildbots, so reverting both.
Aaron Ballman [Thu, 8 Dec 2022 12:33:42 +0000 (07:33 -0500)]
[C2x] Relaxing requirements for va_start
This implements WG14 N2975 relaxing requirements for va_start
(https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf), which
does two things:
1) Allows the declaration of a variadic function without any named
arguments. e.g., void f(...) is now valid, as in C++.
2) Modified the signature of the va_start macro to be a variadic macro
that accepts one or more arguments; the second (and later) arguments
are not expanded or evaluated.
I followed the GCC implementation in terms of not modifying the
behavior of `__builtin_va_start` (it still requires exactly two
arguments), but this approach has led to several QoI issues that I've
documented with FIXME comments in the test. Specifically, the
requirement that we do not evaluate *or expand* the second and later
arguments means it's no longer possible to issue diagnostics for
compatibility with older C versions and C++. I am reaching out to
folks in WG14 to see if we can get an NB comment to address these
concerns (the US comment period has already closed, so I cannot file
the comment myself), so the diagnostic behavior may change in the
future.
I took this opportunity to add some documentation for all the related
builtins in this area, since there was no documentation for them yet.
Differential Revision: https://reviews.llvm.org/D139436