platform/upstream/llvm.git
19 months ago[OPENMP51]Codegen for error directive.
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

19 months agoReland "[pgo] Avoid introducing relocations by using private alias"
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

19 months agoutils/update_mir_test_checks.py: support UTC_ARGS
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

19 months ago[opt] Disincentivize new tests from using old pass syntax
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

19 months ago[openmp] Provide an assembly implementation of __kmp_invoke_microtask on ARM
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

19 months ago[LLParser] Support symbolic address space numbers
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

19 months agoSimplify clang/test/CodeGen/annotations-global.c CHECK lines
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.

19 months agoFix annotations-field.c CHECK lines being ignored
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.

19 months ago[OpenMP] Clang Support for taskwait nowait clause
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

19 months agoutils/update_mir_test_checks.py: allow checking fixedStack in .mir files
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

19 months ago[mlir][ods] BitEnumAttr: Actually use the 'str' for the all unset case
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

19 months ago[Attributor] Fix a break in relase build caused by
Haojian Wu [Thu, 8 Dec 2022 20:07:58 +0000 (21:07 +0100)]
[Attributor] Fix a break in relase build caused by
61318fa5c764d6af60baeb1c00d793f1bd95f5ea.

19 months ago[HWASAN] Removed right_aligned from HWASAN allocator Metadata.
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

19 months agoScalarizer: fix an opaque pointer bug
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

19 months agoScalarizer: explicitly exclude scalable vectors
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

19 months ago[OpenMP] [OMPT] [3/8] Implemented callback registration in libomptarget
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

19 months agoupdate_mir_test_checks.py: match dead vreg definitions
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

19 months ago[tsan] re-exec when ASLR is enabled for x86_64 as well
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

19 months agoWhen merging lambdas, keep track of the capture lists from each version.
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.

19 months ago[mlir] FunctionOpInterface: arg and result attrs dispatch to interface
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

19 months ago[mlir][ods] Generate remover methods with camelcase
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

19 months ago[mlir][ods] Make Operator.h comments triple forward slash (NFC)Depends on D139447
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

19 months ago[mlir] FunctionOpInterface: make get/setFunctionType interface methods
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

19 months ago[compiler-rt] Add opt-in -ftrivial-auto-var-init flag for writing over uninitialized...
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

19 months ago[InstCombine] add tests for insertelts of truncs; NFC
Sanjay Patel [Thu, 8 Dec 2022 18:42:21 +0000 (13:42 -0500)]
[InstCombine] add tests for insertelts of truncs; NFC

19 months agoRevert "[InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 1 (2nd...
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).

19 months agoRevert "[InstCombine] improve efficiency of bool logic; NFC"
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).

19 months agoRevert "Implement CWG2631"
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.

19 months ago[clang] Add test for CWG418
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

19 months ago[OpenMP][libomp] Fix version scripts after undefined version script changes
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.

19 months ago[MC][AArch64] Remove bogus whitespace of markup'd immediate.
Paul Walker [Thu, 8 Dec 2022 17:54:08 +0000 (17:54 +0000)]
[MC][AArch64] Remove bogus whitespace of markup'd immediate.

19 months agoUpdate the status of a few more C DRs
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.

19 months ago[mlir][linalg] Print broadcast, map, reduce, transpose ins/outs on one line.
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

19 months agoRevert "Reland "[pgo] Avoid introducing relocations by using private alias"""
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.

19 months ago[RISCV][InsertVSETVLI] vmv.s.x and fvmv.s.f do not depend on LMUL
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.

19 months ago[ADT] Use std::nullopt instead of llvm::None in OptionalTest.cpp
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

19 months ago[lldb] Fix simple template names interaction with debug info declarations
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

19 months agoReland "[pgo] Avoid introducing relocations by using private alias""
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

19 months ago[SROA] For non-speculatable `load`s of `select`s -- split block, insert then/else...
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...

19 months ago[lldb][Test] TestRerunAndExpr.py: explicitly delete a.out before rebuilding it
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

19 months agoRevert "[SROA] For non-speculatable `load`s of `select`s -- split block, insert then...
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.

19 months ago[mlir][sparse] Fix checks in a test.
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

19 months ago[NFCI][SROA] `rewriteSelectInstLoads()`: add forgotten false into assertion
Roman Lebedev [Thu, 8 Dec 2022 16:40:35 +0000 (19:40 +0300)]
[NFCI][SROA] `rewriteSelectInstLoads()`: add forgotten false into assertion

19 months ago[flang] Restore old unit locking behavior
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

19 months ago[mlir][arith] Add missing heading comment. NFC.
Jakub Kuderski [Thu, 8 Dec 2022 16:22:46 +0000 (11:22 -0500)]
[mlir][arith] Add missing heading comment. NFC.

19 months ago[clang-doc] Add template support.
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

19 months ago[mlir][sparse] Fix problems in creating complex zero for initialization.
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

19 months agoAdd distinguished content to the empty test headers.
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.

19 months agoRevert "[InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 2"
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).

19 months ago[SCEV] Convert Optional to std::optional
Krzysztof Parzyszek [Thu, 8 Dec 2022 01:34:42 +0000 (19:34 -0600)]
[SCEV] Convert Optional to std::optional

19 months ago[NFC] Simplify documentation about alignment in MCStreamer
Guillaume Chatelet [Thu, 8 Dec 2022 14:33:20 +0000 (14:33 +0000)]
[NFC] Simplify documentation about alignment in MCStreamer

19 months ago[SROA] For non-speculatable `load`s of `select`s -- split block, insert then/else...
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

19 months ago[X86] Add HasCLFLUSH pseudo-predicate (Issue #19039)
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.

19 months ago[lld/mac] Abort link immediately on invalid -undefined argument
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

19 months ago[AMDGPU] Add test that spills WWM CSRs twice
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

19 months ago[WebAssembly] Initialize missing passes in WebAssemblyTargetMachine
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

19 months ago[tooling] use std::optional in tooling StandardLibrary.h/.cpp, NFC
Haojian Wu [Thu, 8 Dec 2022 12:36:33 +0000 (13:36 +0100)]
[tooling] use std::optional in tooling StandardLibrary.h/.cpp, NFC

19 months agoRevert "[IPSCCP] Move the IPSCCP run function under the IPO directory."
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'

19 months agoRevert "[FuncSpec] Make the Function Specializer part of the IPSCCP pass."
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.

19 months ago[C2x] Relaxing requirements for va_start
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

19 months ago[gn build] port eeee51e4bb (dsymutil no longer driver_executable for a while)
Nico Weber [Thu, 8 Dec 2022 12:29:31 +0000 (07:29 -0500)]
[gn build] port eeee51e4bb (dsymutil no longer driver_executable for a while)

19 months ago[FuncSpec] Make the Function Specializer part of the IPSCCP pass.
Alexandros Lamprineas [Mon, 28 Nov 2022 21:47:59 +0000 (21:47 +0000)]
[FuncSpec] Make the Function Specializer part of the IPSCCP pass.

The aim of this patch is to minimize the compilation time overhead of
running Function Specialization. It is about 40% slower to run as a
standalone pass (IPSCCP + FuncSpec vs IPSCCP with FuncSpec) according
to my measurements. I compiled the llvm testsuite with NewPM-O3 + LTO
and measured single threaded [user + system] time of IPSCCP and FuncSpec
by passing the '-time-passes' option to lld. Then I compared the two
configurations in terms of Instruction Count of the total compilation
(not of the individual passes) as in https://llvm-compile-time-tracker.com.
Geomean for non-LTO builds is -0.25% and LTO is -0.5% approximately.

You can find more info below:

https://discourse.llvm.org/t/rfc-should-we-enable-function-specialization/61518

Differential Revision: https://reviews.llvm.org/D126455

19 months ago[IPSCCP] Move the IPSCCP run function under the IPO directory.
Alexandros Lamprineas [Mon, 28 Nov 2022 13:01:29 +0000 (13:01 +0000)]
[IPSCCP] Move the IPSCCP run function under the IPO directory.

The LLVMipo library no longer depends on the Scalar component.
The shared functions between IPSCCP and SCCP have been moved
under Utils, in the SCCPSolver.

This is preliminary work for D126455, in order to break a cyclic
dependency between LLVM libraries.

Differential Revision: https://reviews.llvm.org/D138654

19 months ago[LLDB][LoongArch] Make software single stepping work
Hui Li [Thu, 8 Dec 2022 11:59:11 +0000 (19:59 +0800)]
[LLDB][LoongArch] Make software single stepping work

Hardware single stepping is not currently supported by the linux kernel.
In order to support single step debugging, add EmulateInstructionLoongArch
to implement the software Single Stepping. This patch only support the
simplest single step execution of non-jump instructions.

Reviewed By: SixWeining, DavidSpickett

Differential Revision: https://reviews.llvm.org/D139158

19 months agoRevert "[LLDB][LoongArch] Make software single stepping work"
Weining Lu [Thu, 8 Dec 2022 11:55:05 +0000 (19:55 +0800)]
Revert "[LLDB][LoongArch] Make software single stepping work"

This reverts commit 3a9e07b1e7f4718a0e117f3a732f1679c4bf2e30.

Reason to revert: author name is wrong.

19 months ago[DAG] Teach isConstOrConstSplat about SPLAT_VECTORs
David Green [Thu, 8 Dec 2022 11:53:25 +0000 (11:53 +0000)]
[DAG] Teach isConstOrConstSplat about SPLAT_VECTORs

This teaches the DemandedElts version of isConstOrConstSplat about
SPLAT_VECTORS, in the same way as the non-DemandedElts version by
calling the demanded-bits version from the non-demanded-bits version.

Differential Revision: https://reviews.llvm.org/D128919

19 months ago[clangd] Add a newline-eof to the system-include-extractor.test
Haojian Wu [Thu, 8 Dec 2022 11:43:15 +0000 (12:43 +0100)]
[clangd] Add a newline-eof to the system-include-extractor.test

This test is executed with config enabled, and it fails if there is an
extra (-Wnewline-eof) compile flag from the user config.

19 months ago[test] Remove duplicate RUN lines
Bjorn Pettersson [Thu, 8 Dec 2022 11:23:49 +0000 (12:23 +0100)]
[test] Remove duplicate RUN lines

A few more that I missed in commit 3528e63d89305907b3d6e.

There could be more duplicates remaining, since I've only focused
on exactly duplicated "RUN: opt" lines (ignoring multi line RUN
lines ending with '\').

19 months agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Thu, 8 Dec 2022 11:44:07 +0000 (11:44 +0000)]
Fix MSVC "not all control paths return a value" warning. NFC.

19 months ago[clang-tidy] Do not warn about redundant static in misc-use-anonymous-namespace
Carlos Galvez [Fri, 2 Dec 2022 12:48:16 +0000 (12:48 +0000)]
[clang-tidy] Do not warn about redundant static in misc-use-anonymous-namespace

The same functionality is already implemented in the
readability-static-definition-in-anonymous-namespace
check, including automatic fixes.

Differential Revision: https://reviews.llvm.org/D139197

19 months agoRevert "[llvm] Replace llvm::Any with std::any"
Sebastian Neubauer [Thu, 8 Dec 2022 11:06:44 +0000 (12:06 +0100)]
Revert "[llvm] Replace llvm::Any with std::any"

msvc fails to link when using any_cast. This seems to be fixed recently
only.

https://developercommunity.visualstudio.com/t/stdany-doesnt-link-when-exceptions-are-disabled/376072

This reverts commit aeac2e4884a3ce62c920cd51806a9396da64d9f7.

19 months ago[LLDB][LoongArch] Make software single stepping work
Weining Lu [Thu, 8 Dec 2022 11:06:07 +0000 (19:06 +0800)]
[LLDB][LoongArch] Make software single stepping work

Hardware single stepping is not currently supported by the linux kernel.
In order to support single step debugging, add EmulateInstructionLoongArch
to implement the software Single Stepping. This patch only support the
simplest single step execution of non-jump instructions.

Reviewed By: SixWeining, DavidSpickett

Differential Revision: https://reviews.llvm.org/D139158

19 months ago[llvm] Replace llvm::Any with std::any
Sebastian Neubauer [Thu, 8 Dec 2022 10:48:00 +0000 (11:48 +0100)]
[llvm] Replace llvm::Any with std::any

llvm::Any had several bugs in the past, due to being sensitive to symbol
visibility. (See D101972 and D108943)

Even with these fixes applied, I still encounter the same issue on
Windows.

Similar to llvm::Optional going away in favor of std::optional, we can
use std::any from C++17.

Using std::any fixes the problem and puts the burden to do it correctly
on the standard library.

Differential Revision: https://reviews.llvm.org/D139532

19 months ago[test] Remove duplicate RUN lines in Transform tests
Bjorn Pettersson [Thu, 8 Dec 2022 10:28:30 +0000 (11:28 +0100)]
[test] Remove duplicate RUN lines in Transform tests

19 months ago[LoongArch] Allow writing unaligned nop sequences
wanglei [Thu, 8 Dec 2022 10:08:51 +0000 (18:08 +0800)]
[LoongArch] Allow writing unaligned nop sequences

In case of unaligned nop sequences, pad to the nearest 4-byte boundary
with zeros before filling with `nop` instructions. This is consistent
with gas behavior, and is necessary to compile the Linux kernel with
LLVM IAS.

Replace `support::endian::write` with `OS.write` while at it. This is
simpler and correct because we only have little endian.

Reviewed By: SixWeining, xen0n

Differential Revision: https://reviews.llvm.org/D139285

19 months ago[include-cleaner] Handle base class member access from derived class.
Viktoriia Bakalova [Thu, 1 Dec 2022 10:28:06 +0000 (10:28 +0000)]
[include-cleaner] Handle base class member access from derived class.

Fix: https://github.com/llvm/llvm-project/issues/59251
Differential Revision: https://reviews.llvm.org/D139087

19 months ago[InstSimplify] Do not remove insertvalue of undef into poison
Nikita Popov [Thu, 8 Dec 2022 10:12:26 +0000 (11:12 +0100)]
[InstSimplify] Do not remove insertvalue of undef into poison

We cannot remove an insertvalue of undef if it inserts into a
potentially poison value. The new implementation matches that of
insertelement.

See https://alive2.llvm.org/ce/z/pCcFsW for the previously
incorrect transform.

19 months agoRevert "[AArch64] Select SMULL for zero extended vectors when top bit is zero"
Florian Hahn [Thu, 8 Dec 2022 10:28:33 +0000 (10:28 +0000)]
Revert "[AArch64] Select SMULL for zero extended vectors when top bit is zero"

This reverts commit f9e0390751cb5eefbbbc191f851c52422acacab1.

The patch causes a crash for the IR below:

target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx"

define void @test(ptr %data, <8 x i16> %v) {
entry:
  %0 = sext <8 x i16> %v to <8 x i32>
  %1 = mul <8 x i32> %0, <i32 35584, i32 35584, i32 35584, i32 35584, i32 35584, i32 35584, i32 35584, i32 35584>
  %2 = lshr <8 x i32> %1, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
  %3 = trunc <8 x i32> %2 to <8 x i16>
  store <8 x i16> %3, ptr %data, align 2
  ret void
}

19 months ago[include-cleaner] Remove filtering from UsingDecl visit.
Viktoriia Bakalova [Mon, 28 Nov 2022 15:28:02 +0000 (15:28 +0000)]
[include-cleaner] Remove filtering from UsingDecl visit.

Removes filtering from the VisitUsingDecl method for implementation files.

Differential Revision: https://reviews.llvm.org/D138821

19 months ago[InstSimplify] Fix check lines (NFC)
Nikita Popov [Thu, 8 Dec 2022 10:22:19 +0000 (11:22 +0100)]
[InstSimplify] Fix check lines (NFC)

Accidentally used the wrong binary in the previous commit.

19 months ago[InstSimplify] Add test for insertvalue of undef (NFC)
Nikita Popov [Thu, 8 Dec 2022 10:16:25 +0000 (11:16 +0100)]
[InstSimplify] Add test for insertvalue of undef (NFC)

19 months ago[Arm][AArch64] Add support for v8.9-A/v9.4-A base extensions
Lucas Prates [Mon, 5 Dec 2022 13:26:21 +0000 (13:26 +0000)]
[Arm][AArch64] Add support for v8.9-A/v9.4-A base extensions

This implements the base extensions that are part of the v8.9-A and
v9.4-A architecture versions, including:

* The Clear BHB Instruction (FEAT_CLRBHB)
* The Speculation Restriction Instruction (FEAT_SPECRES2)
* The SLC target for the PRFM instruction
* New system registers:
  * ID_AA64PFR2_EL1
  * ID_AA64MMFR3_EL1
  * HFGITR2_EL2
  * SCTLR2_EL3

More information on the new extensions can be found on:

* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022
* https://developer.arm.com/downloads/-/exploration-tools

Contributors: Sam Elliott, Tomas Matheson and Son Tuan Vu.

Reviewed By: lenary

Differential Revision: https://reviews.llvm.org/D139424

19 months ago[ELF] Merge SHT_RISCV_ATTRIBUTES sections
Fangrui Song [Thu, 8 Dec 2022 09:53:40 +0000 (09:53 +0000)]
[ELF] Merge SHT_RISCV_ATTRIBUTES sections

Currently we take the first SHT_RISCV_ATTRIBUTES (.riscv.attributes) as the
output. If we link an object without an extension with an object with the
extension, the output Tag_RISCV_arch may not contain the extension and some
tools like objdump -d will not decode the related instructions.

This patch implements
Tag_RISCV_stack_align/Tag_RISCV_arch/Tag_RISCV_unaligned_access merge as
specified by
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#attributes

For the deprecated Tag_RISCV_priv_spec{,_minor,_revision}, dump the attribute to
the output iff all input agree on the value. This is different from GNU ld but
our simple approach should be ok for deprecated tags.

`RISCVAttributeParser::handler` currently warns about unknown tags. This
behavior is retained. In GNU ld arm, tags >= 64 (mod 128) are ignored with a
warning. If RISC-V ever wants to do something similar
(https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/352), consider
documenting it in the psABI and changing RISCVAttributeParser.

Like GNU ld, zero value integer attributes and empty string attributes are not
dumped to the output.

Reviewed By: asb, kito-cheng

Differential Revision: https://reviews.llvm.org/D138550

19 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Thu, 8 Dec 2022 09:52:02 +0000 (10:52 +0100)]
[InstCombine] Regenerate test checks (NFC)

Update the check prefixes to allow auto-generation. WIN was
redundant with NOSTPCPY, and CHECK-IPRINTF should specialize
WITHSTPCPY.

19 months agoImplement CWG2631
Corentin Jabot [Sun, 23 Oct 2022 15:32:58 +0000 (17:32 +0200)]
Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D136554

19 months agoStore OptTable::Info::Name as a StringRef
serge-sans-paille [Sun, 4 Dec 2022 08:33:14 +0000 (09:33 +0100)]
Store OptTable::Info::Name as a StringRef

This is a recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e,
with a few cleanups.

This avoids implicit conversion to StringRef at several points, which in
turns avoid redundant calls to strlen.

As a side effect, this greatly simplifies the implementation of
StrCmpOptionNameIgnoreCase.

It also eventually gives a consistent, humble speedup in compilation
time (timing updated since original commit).

https://llvm-compile-time-tracker.com/compare.php?from=de4b6a1bc64db33643f001ad45fae7b92b4a4688&to=c23a93d1292052b4be2fbe8c586fa31143d0c7ed&stat=instructions:u

Differential Revision: https://reviews.llvm.org/D139274

19 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Thu, 8 Dec 2022 09:24:10 +0000 (10:24 +0100)]
[InstCombine] Regenerate test checks (NFC)

Use generated check with --check-globals to verify that the TBAA
metadata is correct.

19 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Thu, 8 Dec 2022 09:20:21 +0000 (10:20 +0100)]
[InstCombine] Regenerate test checks (NFC)

Also clean up some redundant attributes / metadata while here.

19 months ago[Inline] Regenerate test checks (NFC)
Nikita Popov [Thu, 8 Dec 2022 09:16:06 +0000 (10:16 +0100)]
[Inline] Regenerate test checks (NFC)

Don't use anon names, convert to opaque pointers and use
generated check lines.

19 months ago[Inline] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 8 Dec 2022 09:04:43 +0000 (10:04 +0100)]
[Inline] Convert some tests to opaque pointers (NFC)

19 months ago[SCEV] Compute symbolic exit count for 'and' conditions
Max Kazantsev [Thu, 8 Dec 2022 09:04:01 +0000 (16:04 +0700)]
[SCEV] Compute symbolic exit count for 'and' conditions

If loop exits by condition like `A < B && X < Y`, and at least one of symbolic max
exit counts for these conditions is known, it can be used as estimate of symbolic
max exit count for whole branch. If both are known, then we can use their umin
as the estimate.

Differential Revision: https://reviews.llvm.org/D139403
Reviewed By: nikic

19 months ago[Alignment] Use Align in MCStreamer::emitTBSSSymbol
Guillaume Chatelet [Wed, 7 Dec 2022 16:47:48 +0000 (16:47 +0000)]
[Alignment] Use Align in MCStreamer::emitTBSSSymbol

In the same vein as D139439, the patch is not NFC as there is no way to check all downstream implementations but the patch seems pretty safe.

Differential Revision: https://reviews.llvm.org/D139548

19 months ago[DebugInfo] Store optional DIFile::Source as pointer
Jonas Hahnfeld [Thu, 1 Dec 2022 13:14:43 +0000 (14:14 +0100)]
[DebugInfo] Store optional DIFile::Source as pointer

getCanonicalMDString() also returns a nullptr for empty strings, which
tripped over the getSource() method. Solve the ambiguity of no source
versus an optional containing a nullptr by simply storing a pointer.

Differential Revision: https://reviews.llvm.org/D138658

19 months agoFix an unused-variable warning in release build, NFC
Haojian Wu [Thu, 8 Dec 2022 08:56:32 +0000 (09:56 +0100)]
Fix an unused-variable warning in release build, NFC

19 months agoUpdate the bazel BUILD for dsymutil binary.
Haojian Wu [Thu, 8 Dec 2022 08:51:34 +0000 (09:51 +0100)]
Update the bazel BUILD for dsymutil binary.

Reflect the change eeee51e4bb9998c70737a8b771fc1a7884cfedd1

19 months ago[flang] Handle polymorphic passed object in elemental call
Valentin Clement [Thu, 8 Dec 2022 08:47:06 +0000 (09:47 +0100)]
[flang] Handle polymorphic passed object in elemental call

The passed object is placed in the passed arguments by semantics.
When the TBP to be called is an elemental subroutine or function it has to be
handled accordingly.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D139537

19 months ago[llvm] Call reserve before push_back in a loop
Gregory Alfonso [Thu, 8 Dec 2022 08:42:50 +0000 (08:42 +0000)]
[llvm] Call reserve before push_back in a loop

It is generally good practice, if you know how big the vector is going to be in the end, to reserve before continually calling "push_back" or "emplace_back"

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D139483

19 months ago[libc++][NFC] Rename __libcpp_*_or_builtin to __constexpr_*
Nikolas Klauser [Wed, 7 Dec 2022 11:05:32 +0000 (12:05 +0100)]
[libc++][NFC] Rename __libcpp_*_or_builtin to __constexpr_*

We normally use the `__libcpp_` prefix to backport functions, but that doesn't really make sense here. The functions are always available. Using `__constexpr_` makes the intended use of the functions clear.

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D139521

19 months ago[flang] add hlfir.noreassoc codegen
Jean Perier [Thu, 8 Dec 2022 08:33:01 +0000 (09:33 +0100)]
[flang] add hlfir.noreassoc codegen

Differential Revision: https://reviews.llvm.org/D139542

19 months ago[flang] Add hlfir.as_expr character scalar codegen
Jean Perier [Thu, 8 Dec 2022 08:30:32 +0000 (09:30 +0100)]
[flang] Add hlfir.as_expr character scalar codegen

Creates a copy of the operand.

Differential Revision: https://reviews.llvm.org/D139533