platform/upstream/llvm.git
13 months agoAMDGPU: Merge dag and gisel tests for non-entry LDS handling
Matt Arsenault [Wed, 7 Jun 2023 22:12:55 +0000 (18:12 -0400)]
AMDGPU: Merge dag and gisel tests for non-entry LDS handling

13 months agoAMDGPU: Fix errors in test from using non-gfx calling convention
Matt Arsenault [Wed, 7 Jun 2023 21:47:02 +0000 (17:47 -0400)]
AMDGPU: Fix errors in test from using non-gfx calling convention

13 months ago[BOLT] Handle recursive calls as inter-branches in DataAggregator
Amir Ayupov [Wed, 7 Jun 2023 00:53:15 +0000 (17:53 -0700)]
[BOLT] Handle recursive calls as inter-branches in DataAggregator

Align yaml and fdata profiles by applying the same treatment to recursive
calls (direct, indirect, tail). fdata profile increments entry count when
handling recursive calls. Make perf/pre-aggregated perf reader (DataAggregator)
do the same.

Test Plan:
In pre-aggregated-perf.test, add a dummy pre-aggregated branch entry between
an indirect call in `frame_dummy` function and its entry point.
Check that YAML profile gets incremented entry count for this function.

End-to-end test: https://github.com/rafaelauler/bolt-tests/pull/24

Reviewed By: #bolt, maksfb

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

13 months ago[LV] Extend test coverage for loops with accesses with clamped indexes.
Florian Hahn [Thu, 8 Jun 2023 11:10:03 +0000 (12:10 +0100)]
[LV] Extend test coverage for loops with accesses with clamped indexes.

Extend test coverage ahead of upcoming patches.

13 months ago[memprof] Fix rawprofile test on 32-bit architectures
Marco Elver [Wed, 7 Jun 2023 14:17:08 +0000 (16:17 +0200)]
[memprof] Fix rawprofile test on 32-bit architectures

The first argument of StackTrace constructor is a pointer to uptr. Match
the type accordingly.

This fixes builds on 32-bit architectures.

13 months ago[sanitizer_common] Move UNDEFINED attribute outside _MSC_VER guard
Marco Elver [Wed, 7 Jun 2023 20:44:49 +0000 (22:44 +0200)]
[sanitizer_common] Move UNDEFINED attribute outside _MSC_VER guard

The __has_attribute check is sufficient, and if clang-cl is used, the
attribute will be available as well.

13 months ago[LV] Remove UB caused by undef from pr37248.ll (NFC).
Florian Hahn [Thu, 8 Jun 2023 10:58:58 +0000 (11:58 +0100)]
[LV] Remove UB caused by undef from pr37248.ll (NFC).

Also generate full check lines.

13 months ago[mlir][irdl] Add `irdl.c_pred`
Mathieu Fehr [Tue, 6 Jun 2023 19:07:01 +0000 (20:07 +0100)]
[mlir][irdl] Add `irdl.c_pred`

`irdl.c_pred` is an attribute constraint defined by a C++ predicate.
Contrary to the other constraints, this operation cannot be used in
dialects that are registered at runtime. Its principal use is to
share dialect definitions that are defined in C++ or ODS.

Reviewed By: Mogball

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

13 months ago[RegScavenger] Remove scavengeRegister
Jay Foad [Thu, 8 Jun 2023 07:11:01 +0000 (08:11 +0100)]
[RegScavenger] Remove scavengeRegister

All users have been converted to scavengeRegisterBackwards.

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

13 months ago[X86] Prefer vmovmsk instead of vtest for alderlake.
Luo, Yuanke [Tue, 6 Jun 2023 05:27:15 +0000 (13:27 +0800)]
[X86] Prefer vmovmsk instead of vtest for alderlake.

On alderlake E-core, the latency of VMOVMSKPS is 5 for YMM/XMM. The
latency of VPTESTPS is 7 for YMM and is 5 for XMM. Since alderlake use
the P-core schedule model, we can't determine which one better based on
the latency information of schedule model. Alternatively we add an
tuning feature for alderlake and select VMOVMSKPS with the indication
for the tuning feature. In the case of "vmovmskps + test + jcc", the
test and jcc can be fused, while vtest and jcc can't.

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

13 months ago[NFC] Add regression tests for an infinite loop caused by D127115
Amaury Séchet [Thu, 8 Jun 2023 09:07:36 +0000 (09:07 +0000)]
[NFC] Add regression tests for an infinite loop caused by D127115

13 months ago[NFC][Driver] Change MultilibBuilder flags argument order
Michael Platings [Thu, 8 Jun 2023 08:17:49 +0000 (09:17 +0100)]
[NFC][Driver] Change MultilibBuilder flags argument order

Follow up to D151437

Reviewed By: phosek

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

13 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 8 Jun 2023 08:07:24 +0000 (10:07 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)

13 months ago[clang] Fix consteval operators in template contexts
Mariya Podchishchaeva [Wed, 7 Jun 2023 14:28:04 +0000 (10:28 -0400)]
[clang] Fix consteval operators in template contexts

Clang used to reject consteval operators if they're used inside a
template due to TreeTransform putting two different `DeclRefExpr`
expressions for the same reference of the same operator declaration into
`ReferenceToConsteval` set.
It seems there was an attempt to not rebuild the whole operator that
never succeeded, so this patch just removes this attempt and
problemating referencing of a `DeclRefExpr` that always ended up
discarded.

Fixes https://github.com/llvm/llvm-project/issues/62886

Reviewed By: cor3ntin

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

13 months ago[mlir][vector] NFC - Add debug information to vector unrolling patterns
Nicolas Vasilache [Wed, 7 Jun 2023 18:28:45 +0000 (18:28 +0000)]
[mlir][vector] NFC - Add debug information to vector unrolling patterns

13 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 8 Jun 2023 07:12:34 +0000 (09:12 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)

13 months ago[CodeGen] Disable default copy ctor and copy assignment operator for AggressiveAntiDe...
Bing1 Yu [Thu, 8 Jun 2023 07:51:43 +0000 (15:51 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for AggressiveAntiDepBreaker

Reviewed By: pengfei

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

13 months ago[CodeGen] Disable default copy ctor and copy assignment operator for PressureDiffs
Bing1 Yu [Thu, 8 Jun 2023 07:50:54 +0000 (15:50 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for PressureDiffs

Reviewed By: pengfei

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

13 months ago[CodeGen] Disable default copy ctor and copy assignment operator for MachineSchedContext
Bing1 Yu [Thu, 8 Jun 2023 07:49:49 +0000 (15:49 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for MachineSchedContext

Reviewed By: pengfei

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

13 months ago[mlir][vector][transform] Drop redundant "apply_" from op names
Matthias Springer [Thu, 8 Jun 2023 06:58:40 +0000 (08:58 +0200)]
[mlir][vector][transform] Drop redundant "apply_" from op names

This is for consistency with the other ops.

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

13 months ago[InstCombine] (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A&B), -1)
Shivam Gupta [Thu, 8 Jun 2023 03:30:05 +0000 (09:00 +0530)]
[InstCombine] (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A&B), -1)

This patch add another icmp fold for -1 case.

This fixes https://github.com/llvm/llvm-project/issues/62311,
where we want instcombine to merge all compare intructions together so
later passes like simplifycfg and slpvectorize can better optimize this
chained comparison.

Reviewed By: goldstein.w.n

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

13 months ago[InstCombine] Add test case for (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A...
Shivam Gupta [Thu, 8 Jun 2023 03:30:02 +0000 (09:00 +0530)]
[InstCombine] Add test case for (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A&B), -1); NFC

Reviewed By: goldstein.w.n

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

13 months ago[DAGCombiner] Use generalized pattern matcher in visitFMA to support vp.fma.
Yeting Kuo [Tue, 6 Jun 2023 08:55:27 +0000 (16:55 +0800)]
[DAGCombiner] Use generalized pattern matcher in visitFMA to support vp.fma.

Note: Some patterns in visitFMA are needed refined to support splat of constant.

Reviewed By: luke

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

13 months ago[ExecutionEngine] Support TargetExtType in Interpreter
Wenju He [Thu, 8 Jun 2023 01:23:52 +0000 (09:23 +0800)]
[ExecutionEngine] Support TargetExtType in Interpreter

When llvm Interpreter is used to execute bitcode, it shall be able to handle TargetExtType.

Reviewed By: jcranmer-intel

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

13 months ago[Clang][OpenMP][OMPIRBuilder] Fix getTargetEntryUniqueInfo to fatal error instead...
Andrew Gozillon [Thu, 8 Jun 2023 00:27:34 +0000 (19:27 -0500)]
[Clang][OpenMP][OMPIRBuilder] Fix getTargetEntryUniqueInfo to fatal error instead of assert when it cannot generate a unique ID

This prevents access of uninitialized ID components later, or continuing progress
further making errors harder to track down.

Hoepfully this will be the last in my long series of mistakes in recent
commits relating to this area of code!

13 months ago[OpenMP] Fix using the target ID when using the new driver
Joseph Huber [Fri, 2 Jun 2023 00:16:29 +0000 (19:16 -0500)]
[OpenMP] Fix using the target ID when using the new driver

AMDGPU sometimes uses a novel formatting for their offloading
architecture called the target id. This merges the attributes and the
architecture name into a single string. Previously, we were passing this
as the canonical architecture name. This caused the linker wrapper to
fail to find relevant libraries and then pass an incalid CPU name. This
patch changes the handling in the offload packager to handle the
canonical architecture and then extract the features.

Reviewed By: yaxunl

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

13 months agoRevert "Revert "[clang-format] Fix overlapping replacements before PPDirectives""
Leonard Chan [Thu, 8 Jun 2023 00:14:53 +0000 (00:14 +0000)]
Revert "Revert "[clang-format] Fix overlapping replacements before PPDirectives""

This reverts commit 94e75469597f197f9c4b45baa6c8a576c78dbd02.

Apparently I broke some builders with the original revert: http://45.33.8.238/linux/109159/step_7.txt

13 months ago[RISCV] Use Selection::getElementCount to simplify code. NFC
Craig Topper [Thu, 8 Jun 2023 00:01:24 +0000 (17:01 -0700)]
[RISCV] Use Selection::getElementCount to simplify code. NFC

13 months ago[libc] Update FMA detection macro for x86-64 targets.
Tue Ly [Wed, 7 Jun 2023 23:23:12 +0000 (19:23 -0400)]
[libc] Update FMA detection macro for x86-64 targets.

To generate fma instructions for x86-64 targets, we need both -mavx2
and -mfma.

Reviewed By: brooksmoses

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

13 months ago[RISCV] Pass SDLoc by const reference. NFC
Craig Topper [Wed, 7 Jun 2023 23:52:33 +0000 (16:52 -0700)]
[RISCV] Pass SDLoc by const reference. NFC

13 months ago[lldb] Disable variable watchpoints when going out of scope
Med Ismail Bennani [Wed, 7 Jun 2023 23:51:45 +0000 (16:51 -0700)]
[lldb] Disable variable watchpoints when going out of scope

If we use a variable watchpoint with a condition using a scope variable,
if we go out-of-scope, the watpoint remains active which can the
expression evaluator to fail to parse the watchpoint condition (because
of the missing varible bindings).

This was discovered after `watchpoint_callback.test` started failing on
the green dragon bot.

This patch should address that issue by setting an internal breakpoint
on the return addresss of the current frame when creating a variable
watchpoint. The breakpoint has a callback that will disable the watchpoint
if the the breakpoint execution context matches the watchpoint execution
context.

This is only enabled for local variables.

This patch also re-enables the failing test following e1086384e584.

rdar://109574319

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months agoRevert "[clang-format] Fix overlapping replacements before PPDirectives"
Leonard Chan [Wed, 7 Jun 2023 23:44:32 +0000 (23:44 +0000)]
Revert "[clang-format] Fix overlapping replacements before PPDirectives"

This reverts commit 4b9764959dc4b8783e18747c1742ab164e4bc4ee.

Reverting since this causes clang-formtat to incorrectly fall into an
error path yet return a zero exit code despite not formatting the file
at all.

See https://github.com/llvm/llvm-project/issues/63170

13 months agoFix namespace of operator<< defn
Sam McCall [Wed, 7 Jun 2023 23:36:59 +0000 (01:36 +0200)]
Fix namespace of operator<< defn

13 months ago[ORC] Simplify construction of EPCIndirectionUtils.
Lang Hames [Wed, 7 Jun 2023 17:16:14 +0000 (10:16 -0700)]
[ORC] Simplify construction of EPCIndirectionUtils.

ExecutionSessions always have an ExecutorProcessControl object now, so we can
construct EPCIndirectionUtil objects directly from an ExecutionSession.

13 months ago[RISCV] Add i8 vector interleave test. NFC
Craig Topper [Wed, 7 Jun 2023 23:25:18 +0000 (16:25 -0700)]
[RISCV] Add i8 vector interleave test. NFC

13 months ago[lldb] Reinvoke crashlog under lldb when run with -i from the command line
Jonas Devlieghere [Wed, 7 Jun 2023 23:17:00 +0000 (16:17 -0700)]
[lldb] Reinvoke crashlog under lldb when run with -i from the command line

Run crashlog inside lldb when invoked in interactive mode from the
command line. Currently, when passing -i to crashlog from the command
line, we symbolicate in LLDB and immediately exit right after. This
pretty much defeats the purpose of interactive mode. That said, we
wouldn't want to re-implement the driver from the crashlog script.
Re-invoking the crashlog command from inside LLDB solves the issue.

rdar://97801509

Differential revision: https://reviews.llvm.org/D152319

13 months ago[Clang][OpenMP][OMPIRBuilder] Change llvm_unreachable inside of getTargetEntryUniqueI...
Andrew Gozillon [Wed, 7 Jun 2023 22:52:28 +0000 (17:52 -0500)]
[Clang][OpenMP][OMPIRBuilder] Change llvm_unreachable inside of getTargetEntryUniqueInfo to a more apt assert

However, with the correct condition this time and appropriate Clang
callback function to give the correct fallback Filename and Line Info.

13 months ago[RISCV] Remove tab characters from a test. NFC
Craig Topper [Wed, 7 Jun 2023 22:43:36 +0000 (15:43 -0700)]
[RISCV] Remove tab characters from a test. NFC

13 months ago[llvm][openacc] Fix OpenACC frontend test
Razvan Lupusoru [Wed, 7 Jun 2023 21:40:20 +0000 (14:40 -0700)]
[llvm][openacc] Fix OpenACC frontend test

After D152389, single reduction clause constraint was removed.
This broke the OpenACC frontend test which seems to rely on specific
allowed clause ordering.

Reviewed By: vzakhari

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

13 months ago[Sanitizers] UUID/Build ID is 16 bytes on Darwin.
usama hameed [Wed, 7 Jun 2023 21:29:53 +0000 (14:29 -0700)]
[Sanitizers] UUID/Build ID is 16 bytes on Darwin.

https://reviews.llvm.org/D114294 changed the kModuleUUIDSize from 16 to 32 for
all platforms. This is not true for Darwin where the UUID is 16 bytes.

Differential Revision: https://reviews.llvm.org/D152309
rdar://110346025

13 months ago[clang-format] Add the KeepEmptyLinesAtEOF option
Owen Pan [Tue, 6 Jun 2023 19:58:21 +0000 (12:58 -0700)]
[clang-format] Add the KeepEmptyLinesAtEOF option

Adds an option KeepEmptyLinesAtEOF to keep empty lines (up to
MaxEmptyLinesToKeep) before EOF. This remedies the probably unintentional
change in behavior introduced in 3d3ea84a4f8f, which started to always
remove empty lines before EOF.

Fixes #56054.
Fixes #63150.

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

13 months ago[AArch64][SVE] Predicated mul pattern
David Green [Wed, 7 Jun 2023 20:53:30 +0000 (21:53 +0100)]
[AArch64][SVE] Predicated mul pattern

This is a simple predicated mul pattern, selecting from
select(p, mul(x, y), x).

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

13 months ago[flang][openacc] Lower reduction for compute constructs
Razvan Lupusoru [Wed, 7 Jun 2023 18:13:44 +0000 (11:13 -0700)]
[flang][openacc] Lower reduction for compute constructs

Parallel and serial constructs support reduction clause. Extend
recent D151564 loop reduction clause support to also include these
compute constructs.

Reviewed By: clementval, vzakhari

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

13 months ago[flang][openacc] Remove single reduction clause limitation
Razvan Lupusoru [Wed, 7 Jun 2023 18:05:40 +0000 (11:05 -0700)]
[flang][openacc] Remove single reduction clause limitation

The constraint that a single reduction clause is allowed is actually
not valid as per OpenACC specification. Multiple reduction clauses
are allowed, especially since reduction clauses can have different
reduction operators.

Reviewed By: vzakhari

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

13 months ago[gn build] Port 7949ee0d4f10
LLVM GN Syncbot [Wed, 7 Jun 2023 20:34:06 +0000 (20:34 +0000)]
[gn build] Port 7949ee0d4f10

13 months ago[libc++] Introduce __is_pointer_in_range
Nikolas Klauser [Wed, 7 Jun 2023 20:33:02 +0000 (13:33 -0700)]
[libc++] Introduce __is_pointer_in_range

This checks whether a pointer is within a range, even during constant evaluation. This allows running optimized code paths during constant evaluation, instead of falling back to the general-purpose implementation all the time. This is also a central place for comparing unrelated pointers, which is technically UB.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

13 months ago[AMDGPU] Switch to backwards scavenging in eliminateFrameIndex
Jay Foad [Tue, 16 May 2023 16:07:44 +0000 (17:07 +0100)]
[AMDGPU] Switch to backwards scavenging in eliminateFrameIndex

Frame index elimination runs backwards so we must use backwards
scavenging. Otherwise, when a scavenged register is spilled, the
scavenger will remember that the register is in use until the restore
point, but it will never reach that restore point. The result is that in
some cases it will keep scavenging different registers instead of
reusing the same one.

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

13 months ago[RISCV] Change riscv_vid_vl isel pattern to use _MASK instruction.
Craig Topper [Wed, 7 Jun 2023 19:48:43 +0000 (12:48 -0700)]
[RISCV] Change riscv_vid_vl isel pattern to use _MASK instruction.

The post isel peephole can convert it to the unmasked form.

We don't have any way to test the masked version right now because
we always use a true mask.

This makes the isel pattern consistent with many other instructions
that select the mask form.

13 months ago[Matrix] Convert binop operand of dot product to a row vector.
Florian Hahn [Wed, 7 Jun 2023 19:45:07 +0000 (20:45 +0100)]
[Matrix] Convert binop operand of dot product to a row vector.

The dot product lowering will use the left operand as row vector.
If the operand is a binary op, convert it to operate on a row vector
instead of a column vector.

Depends on D148428.

Reviewed By: thegameg

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

13 months ago[Clang] Check for abstract parameters only when functions are defined.
Corentin Jabot [Sun, 4 Jun 2023 15:12:30 +0000 (17:12 +0200)]
[Clang] Check for abstract parameters only when functions are defined.

The C++ standard allows abstract parameters in deleted functions
and in function declarations

> The type of a parameter or the return type for a function definition
> shall not be a (possibly cv-qualified) class type that is
> incomplete or abstract within the function body
> unless the function is deleted.

Fixes https://github.com/llvm/llvm-project/issues/63012

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

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

13 months ago[Clang][OpenMP] Rework recently moved getTargetEntryUniqueInfo to fix incorrect error...
Andrew Gozillon [Wed, 7 Jun 2023 19:27:42 +0000 (14:27 -0500)]
[Clang][OpenMP] Rework recently moved getTargetEntryUniqueInfo to fix incorrect error breaking sanitizer

This move was done by https://reviews.llvm.org/rGcda46cc4f921f6b288c57a68b901ec2f57134606 and may be the issue causing the sanitizer to fail. But in either case, it is an invalid assert that required some changes to function correctly.

13 months ago[compiler-rt] Fixes Chromium Apple CI.
Mark de Wever [Wed, 7 Jun 2023 19:24:05 +0000 (21:24 +0200)]
[compiler-rt] Fixes Chromium Apple CI.

s/add_asm_sources/set/ at one place it was forgotten in D152102 as
reported by @paulkirth.

13 months ago[InstrProf] Fix BalancedPartitioning when threads are disabled
Ellis Hoag [Wed, 7 Jun 2023 18:00:57 +0000 (11:00 -0700)]
[InstrProf] Fix BalancedPartitioning when threads are disabled

In https://reviews.llvm.org/D147812 we introduced the class
`BalancedPartitioning` which includes some threading code. The tests in
that diff run forever when built with `-DLLVM_ENABLE_THREADS=OFF` so
some bots were broken.

These tests were skipped in
https://reviews.llvm.org/rGa4845eaf2e9aa18dd900d7cbeff4e5ff52e4b50e
because of this.

This diff disables the threading code if `LLVM_ENABLE_THREADS` is
disabled so we can re-enable the tests.

Reviewed By: luporl

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

13 months agoAMDGPU: Remove r600 local id annotations in AMDGPULowerIntrinsics
Matt Arsenault [Wed, 7 Jun 2023 18:27:53 +0000 (14:27 -0400)]
AMDGPU: Remove r600 local id annotations in AMDGPULowerIntrinsics

With these dropped and memory intrinsic moved into a generic pass, we
can drop the whole pass.

No tests fail with this removed. The new amdgcn intrinsics are
annotated in clang up front.  Theoretically may regress r600, but that
would need new testing and support work (r600 ideally would also
follow the clang handling). The regression would be any IR passes
making use of known bits between this point and codegen. The DAG
computeKnownBits understand the intrinsics directly now.

If we wanted to refine these values, a better place would be in
AMDGPUAttributor.

13 months ago[libc] Temporarily suppress -fsanitize=function for qsort comparator
Leonard Chan [Wed, 7 Jun 2023 18:44:52 +0000 (18:44 +0000)]
[libc] Temporarily suppress -fsanitize=function for qsort comparator

Recent upstream changes to -fsanitize=function find more instances of
function type mismatches. One case is with the comparator passed to this
class. Libraries like boringssl will tend to pass comparators that take
pointers to varying types while this comparator expects to accept const
void pointers. Ideally those tools would pass a function that strictly
accepts const void*s to avoid UB, or we'd have something like qsort_r/s.

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

13 months ago[clang] Implement P2564 "consteval must propagate up"
Corentin Jabot [Mon, 8 May 2023 10:18:43 +0000 (12:18 +0200)]
[clang] Implement P2564 "consteval must propagate up"

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

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

13 months ago[libc++] Rename availability macros for <filesystem>
Louis Dionne [Mon, 5 Jun 2023 15:20:39 +0000 (08:20 -0700)]
[libc++] Rename availability macros for <filesystem>

This makes it clearer that the availability macro only pertains to
<filesystem>, and not to whether the platform has support for a file
system.

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

13 months ago[Sanitizers] Remove BuildId from sanitizers stacktrace on Darwin
usama hameed [Tue, 6 Jun 2023 22:53:18 +0000 (15:53 -0700)]
[Sanitizers] Remove BuildId from sanitizers stacktrace on Darwin

On Darwin, we do not want to show the BuildId appended at the end of stack
frames in Sanitizers. The BuildId/UUID can be seen by using the
print_module_map=1 sanitizer option.

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

rdar://108324403

13 months ago[mlir][bytecodegen] Don't emit empty case (NFC)
Jacques Pienaar [Wed, 7 Jun 2023 18:15:06 +0000 (11:15 -0700)]
[mlir][bytecodegen] Don't emit empty case (NFC)

13 months ago[mlir][sparse][gpu] refined build setup for cusparse
Aart Bik [Wed, 7 Jun 2023 17:43:48 +0000 (10:43 -0700)]
[mlir][sparse][gpu] refined build setup for cusparse

Reviewed By: K-Wu

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

13 months ago[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols
Eli Friedman [Mon, 17 Apr 2023 20:15:46 +0000 (13:15 -0700)]
[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols

This is mostly useful for ARM64EC, which uses such symbols extensively.

One interesting quirk of ARM64EC is that we need to be able to emit weak
symbols that point at each other (so if either symbol is defined
elsewhere, both symbols point at the definition). This handling is
currently restricted to weak_anti_dep symbols, because we depend on the
current behavior of resolving weak symbols in some cases.

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

13 months agoRemove unnecessary copy
David Blaikie [Wed, 7 Jun 2023 18:02:58 +0000 (18:02 +0000)]
Remove unnecessary copy

13 months ago[WebAssembly] Add ldexp{,f,l} libcall signatures
Derek Schuff [Wed, 7 Jun 2023 17:24:07 +0000 (10:24 -0700)]
[WebAssembly] Add ldexp{,f,l} libcall signatures

llvm.ldexp.* intrinsics were recently added to LLVM, which means
wasm now needs to know the signatures of the corresponding libcalls.

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

Fixes: #63164

13 months ago[InstrProf] Skip Balanced Partitioning tests on ARM
Leandro Lupori [Wed, 7 Jun 2023 17:27:59 +0000 (17:27 +0000)]
[InstrProf] Skip Balanced Partitioning tests on ARM

Balanced Partitioning tests, added by 1794532bb942, currently
hang on ARM, what causes check-all to never finish.

Issue #63168

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

13 months agoImprove WebAssembly vector bitmask, mask reduction, and extending
Caleb Zulawski [Wed, 7 Jun 2023 17:20:22 +0000 (10:20 -0700)]
Improve WebAssembly vector bitmask, mask reduction, and extending

This is inspired by a recently filed Rust issue noting poor codegen for vector masks (https://github.com/rust-lang/portable-simd/issues/351).

Reviewed By: tlively

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

13 months ago[lldb][NFCI] Change type of Broadcaster's name
Alex Langford [Tue, 6 Jun 2023 01:05:11 +0000 (18:05 -0700)]
[lldb][NFCI] Change type of Broadcaster's name

Broadcasters don't need their names in the StringPool. It doesn't
benefit from fast comparisons and doesn't benefit from uniqueness.

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

13 months ago[MLIR][Tosa] Fix fp canonicalization for `clamp`
rikhuijzer [Wed, 7 Jun 2023 17:09:17 +0000 (10:09 -0700)]
[MLIR][Tosa] Fix fp canonicalization for `clamp`

The canonicalization for `clamp` removed the `clamp` operation when the
chosen min and max values were outside the range of what is possible to
represent with the input type. For example, if the input type is `i8`,
then the min and max values must be between -128 and 127. If the min and
max are, say, -200 and 200, then the `clamp` operation can be safely
removed.

However, as pointed out by @wyanzhao, this is wrong for floating point
types since they can represent infinity.

Fixes #62341.

Reviewed By: jpienaar

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

13 months ago[mlir][quant] Move comments to TableGen statements
rikhuijzer [Wed, 7 Jun 2023 16:04:19 +0000 (09:04 -0700)]
[mlir][quant] Move comments to TableGen statements

The `quant` dialect documentation currently mostly empty (https://mlir.llvm.org/docs/Dialects/QuantDialect/).
This patch moves the comments to TableGen statements.
By looking at the generated `QuantDialect.md`, I've confirmed that each change in this patch will end up in the documentation.

The only thing that I wasn't able to document was the `UniformQuantizedType`.
I haven't found a way to document a `DialectType` since most appear to be private in other dialects; suggestions are welcome.

Reviewed By: jpienaar

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

13 months ago[MLIR][python bindings] TypeCasters for Attributes
max [Wed, 31 May 2023 20:52:46 +0000 (15:52 -0500)]
[MLIR][python bindings] TypeCasters for Attributes

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

13 months ago[AMDGPU] Regenerate some spill checks
Jay Foad [Wed, 7 Jun 2023 16:50:06 +0000 (17:50 +0100)]
[AMDGPU] Regenerate some spill checks

13 months agoFix parameter name in Sema::addInitCapture to ByRef.
Jens Massberg [Wed, 7 Jun 2023 13:15:07 +0000 (15:15 +0200)]
Fix parameter name in Sema::addInitCapture to ByRef.

Rename parameter in Sema::addInitCapture as proposed in review of Sema::addInitCapture. Sorry, that I have missed the comment there!

Reviewed By: ilya-biryukov

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

13 months ago[LLVM] Removes CMake work-arounds.
Mark de Wever [Sun, 4 Jun 2023 15:46:02 +0000 (17:46 +0200)]
[LLVM] Removes CMake work-arounds.

CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: kwk

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

13 months ago[gn] port 66a562d22e7 more (libc++ _LIBCPP_HAS_NO_FILESYSTEM)
Nico Weber [Wed, 7 Jun 2023 16:00:39 +0000 (12:00 -0400)]
[gn] port 66a562d22e7 more (libc++ _LIBCPP_HAS_NO_FILESYSTEM)

13 months agoAdd support for the NO_COLOR environment variable
Aaron Ballman [Wed, 7 Jun 2023 15:53:08 +0000 (11:53 -0400)]
Add support for the NO_COLOR environment variable

Clang currently supports disabling color diagnostic output via
-fno-color-diagnostics. However, there is a somewhat long-standing push
to support use of an environment variable to override color output so
that users can set up their terminal such that most color output is
disabled (largely for accessibility reasons).

There are two competing de facto standards to accomplish this:
  NO_COLOR (https://no-color.org/) and
  CLICOLOR/CLICOLOR_FORCE (http://bixense.com/clicolors/).

This patch adds support for NO_COLOR as that appears to be the more
commonly supported feature, at least when comparing issues and pull
requests:
https://github.com/search?q=NO_COLOR&type=issues (2.2k issues, 35k pull requests)
https://github.com/search?q=CLICOLOR&type=issues (1k issues, 3k pull requests)

It's also the more straightforward and thoroughly-specified of the two
options. If NO_COLOR is present as an environment variable (regardless
of value), color output is suppressed unless the command line specifies
use of color output (command line takes precedence over the environment
variable).

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

13 months ago[RISCV] Use inheritance to reduce repeated code in RISCVInstrInfoV.td. NFC
Craig Topper [Wed, 7 Jun 2023 15:49:45 +0000 (08:49 -0700)]
[RISCV] Use inheritance to reduce repeated code in RISCVInstrInfoV.td. NFC

Reviewed By: pcwang-thead

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

13 months ago[MLIR] Removes CMake work-arounds.
Mark de Wever [Sun, 4 Jun 2023 15:42:38 +0000 (17:42 +0200)]
[MLIR] Removes CMake work-arounds.

CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: mehdi_amini

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

13 months ago[compiler-rt] Removes CMake work-arounds.
Mark de Wever [Sun, 4 Jun 2023 15:44:30 +0000 (17:44 +0200)]
[compiler-rt] Removes CMake work-arounds.

CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: phosek

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

13 months ago[gn] port 66a562d22e7 (libc++ _LIBCPP_HAS_NO_FILESYSTEM)
Nico Weber [Wed, 7 Jun 2023 15:37:07 +0000 (11:37 -0400)]
[gn] port 66a562d22e7 (libc++ _LIBCPP_HAS_NO_FILESYSTEM)

13 months agoRevert "[flang][hlfir] allow recursive intrinsic lowering"
Tom Eccles [Wed, 7 Jun 2023 15:23:52 +0000 (15:23 +0000)]
Revert "[flang][hlfir] allow recursive intrinsic lowering"

This reverts commit 6bcfab3161ea3a90b26dce3f85ba052933060b73.

Reverting because this breaks the build with MSVC

13 months ago[TableGen] Emit separate computeRequiredFeatures() function
Pavel Kosov [Wed, 7 Jun 2023 13:05:46 +0000 (16:05 +0300)]
[TableGen] Emit separate computeRequiredFeatures() function

A function is already emitted in *GenInstrInfo.inc that takes Opcode
number and a set of supported Features and reports fatal error if some
of the required features are missing.

The information about features required by the particular opcode can be
reused by llvm-exegesis, so move its computation info a separate
computeRequiredFeatures() function. Then verifyInstructionPredicates()
can just compare the sets of available and required features computed by
the other functions.

This commit moves the definition of FeatureBitsets[] as well as CEFBS_*
enumerator values (that are indices into FeatureBitsets[] array) inside
the computeRequiredFeatures() function because these are implementation
details of that function. The inclusion of potentially huge
computeRequiredFeatures() function is now controlled by a dedicated
macro that is set for simplicity by TableGen-erated code itself if
`defined(ENABLE_INSTR_PREDICATE_VERIFIER) && !defined(NDEBUG)`.

~~

Huawei RRI, OS Lab

Reviewed By: courbet

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

13 months ago[Option] Support special argument "--"
Fangrui Song [Wed, 7 Jun 2023 15:06:05 +0000 (08:06 -0700)]
[Option] Support special argument "--"

Many command line option implementations, including getopt_long and our
Support/CommandLine.cpp, support `--` as an end-of-option indicator. All
the subsequent arguments are then treated as positional arguments.

D1387 added KIND_REMAINING_ARGS and 76ff1d915c9c42823a3f2b08ff936cf7a48933c5 dropped special handling of `--`.
Users need to add `def DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>;` and
append `OPT_DASH_DASH` to the `OPT_INPUT` list., which is not ergonomic.

Restore this feature under an option and modify llvm-strings to utilize the
feature as an example. In the future, we probably should enable this feature by
default and exclude some tools that handle `DASH_DASH` differently (clang,
clang-scan-deps, etc. I suspect that many are workarounds for LLVMOption not
supporting `--` as a built-in feature).

Reviewed By: serge-sans-paille

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

13 months ago[libc++] Roll up fstream support into filesystem support
Louis Dionne [Wed, 31 May 2023 18:20:24 +0000 (11:20 -0700)]
[libc++] Roll up fstream support into filesystem support

LIBCXX_ENABLE_FILESYSTEM should represent whether the platform has
support for a filesystem, not just whether we support <filesystem>.
This patch slightly generalizes the setting to also encompass whether
we provide <fstream>, since that only makes sense when a filesystem is
supported.

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

13 months ago[ASAN] Fix validation size for dirent on FreeBSD
Justin Cady [Wed, 7 Jun 2023 14:59:07 +0000 (10:59 -0400)]
[ASAN] Fix validation size for dirent on FreeBSD

Typically the size required to represent a dirent is stored in `d_reclen`. But
this not always the case for FreeBSD (for example, when walking a directory
over NFS).

This leads to ASAN false positives for `scandir` and similar functions. Because
ASAN uses `d_reclen` for the range to validate, it can overrun when `d_reclen` is
incorrect (too large).

This change adds `__sanitizer_dirsiz` which fixes the dirent size calculation
for FreeBSD. Other platforms continue to use `d_reclen`.

Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D151583

13 months ago[clang][DeclPrinter] Fix AST print of out-of-line record definitions
Timo Stripf [Wed, 7 Jun 2023 14:57:31 +0000 (10:57 -0400)]
[clang][DeclPrinter] Fix AST print of out-of-line record definitions

DeclPrinter::VisitCXXRecordDecl did not output qualifiers for records.
As result, the output of out-of-line record definitions was incorrect.

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

13 months ago[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)
Kristina Bessonova [Mon, 13 Mar 2023 12:27:45 +0000 (13:27 +0100)]
[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Currently, `retainedNodes` tracks function-local variables and labels.
To support function-local import, types and static variables (which are globals
in LLVM IR), subsequent patches use the same field. So this patch makes
preliminary refactoring of the code tracking local entities to apply future
functional changes lucidly and cleanly.

No functional changes intended.

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

13 months ago[flang][hlfir] allow recursive intrinsic lowering
Tom Eccles [Tue, 6 Jun 2023 15:15:25 +0000 (15:15 +0000)]
[flang][hlfir] allow recursive intrinsic lowering

We need to allow recursive application of intrinsic lowering patterns,
otherwise we cannot lower nested calls of the same intrinsic e.g.
matmul(matmul(a, b), c).

matmul(matmul(a, b), matmul(c, d)) requires hlfir.associate of hlfir
expr with more than one use (TODO).

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

13 months ago[flang][hlfir] relax the strictness of intrinsic verifiers
Tom Eccles [Fri, 2 Jun 2023 16:53:20 +0000 (16:53 +0000)]
[flang][hlfir] relax the strictness of intrinsic verifiers

The verifiers for hlfir.matmul and hlfir.transpose try to ensure that
the shape of the result value makes sense given the shapes of the input
argument(s).

It there are some cases in the gfortran tests where lowering knows a bit
more about shape information than (HL)FIR. I think the cases here will be
solved when hlfir.shape_meet is implemented.

But in the meantime, and to improve robustness, I've relaxed the
verifier to allow the return type to have more precise shape information
than can be deduced from the argument type(s).

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

13 months ago[gn] port 1794532bb94
Nico Weber [Wed, 7 Jun 2023 14:17:48 +0000 (10:17 -0400)]
[gn] port 1794532bb94

13 months ago[gn] port d19a3834dce5
Nico Weber [Wed, 7 Jun 2023 14:15:43 +0000 (10:15 -0400)]
[gn] port d19a3834dce5

13 months ago[LV] Add option to tune the cost model, NFC
zhongyunde [Wed, 7 Jun 2023 13:50:54 +0000 (21:50 +0800)]
[LV] Add option to tune the cost model, NFC

For Neon, the default nonconst stride cost is conservative,
and it is a local variable, which is not convenience to
to tune the loop vectorize.
So I try to use a option, which is similar to SVEGatherOverhead brought in D115143.
Fix https://github.com/llvm/llvm-project/issues/63082.

Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D152253

13 months agoReland "D144999 [MC][MachO]Only emits compact-unwind format for "canonical" personali...
Vy Nguyen [Tue, 6 Jun 2023 18:00:47 +0000 (14:00 -0400)]
Reland "D144999 [MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs."

Reasons for rolling forward:
    - the crash reported from Chromium was fixed in D151824 (not related to this patch at all)
    - since D152824 was committed, it should now be safe to roll this forward.

New change:
    - add an additional _ in name check

This reverts commit 4980eead4d0b4666d53dad07afb091375b3a13a0.

13 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 7 Jun 2023 13:16:35 +0000 (15:16 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)

13 months ago[clang][CodeGen] Fix GPU-specific attributes being dropped by bitcode linking
pvanhout [Tue, 6 Jun 2023 11:32:00 +0000 (13:32 +0200)]
[clang][CodeGen] Fix GPU-specific attributes being dropped by bitcode linking

Device libs make use of patterns like this:
```
__attribute__((target("gfx11-insts")))
static unsigned do_intrin_stuff(void)
{
  return __builtin_amdgcn_s_sendmsg_rtnl(0x0);
}
```
For functions that are assumed to be eliminated if the currennt GPU target doesn't support them.
At O0 such functions aren't eliminated by common optimizations but often by AMDGPURemoveIncompatibleFunctions instead, which sees the "+gfx11-insts" attribute on, say, GFX9 and knows it's not valid, so it removes the function.

D142907 accidentally made it so such attributes were dropped during bitcode linking, making it impossible for RemoveIncompatibleFunctions to catch the functions and causing ISel to catch fire eventually.

This fixes the issue and adds a new test to ensure we don't accidentally fall into this trap again.

Fixes SWDEV-403642

Reviewed By: arsenm, yaxunl

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

13 months ago[TableGen] Add !setdagarg and !setdagname
Michael Liao [Wed, 31 May 2023 03:34:47 +0000 (23:34 -0400)]
[TableGen] Add !setdagarg and !setdagname

- This patch proposes to add `!setdagarg` and `!setdagname` bang
  operators to produce a new DAG node after replacing the specified
  argument value/name from the given input DAG node. E.g.,
  `!setdagarg((foo 1, 2), 0, "x")` produces `(foo "x", 2)` and
  `!setdagname((foo 1:$a, 2:$b), 1, "c")` produces `(foo 1:$a, 2:$c)`.

Reviewed By: simon_tatham

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

13 months ago[X86][FP16] Do not generate VBROADCAST for fp16
Phoebe Wang [Wed, 7 Jun 2023 08:15:06 +0000 (16:15 +0800)]
[X86][FP16] Do not generate VBROADCAST for fp16

We cannot lower VBROADCAST i16 under AVX1.

Fixes #63114

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

13 months agoPreISelIntrinsicLowering: Identify load.relative with intrinsic id
Matt Arsenault [Wed, 7 Jun 2023 12:16:51 +0000 (08:16 -0400)]
PreISelIntrinsicLowering: Identify load.relative with intrinsic id

13 months agoAMDGPU: Add MF independent version of getImplicitParameterOffset
Matt Arsenault [Wed, 7 Jun 2023 11:56:16 +0000 (07:56 -0400)]
AMDGPU: Add MF independent version of getImplicitParameterOffset

13 months agoAMDGPU: Use available subtarget member
Matt Arsenault [Wed, 7 Jun 2023 11:47:52 +0000 (07:47 -0400)]
AMDGPU: Use available subtarget member

13 months ago[Clang][OpenMP] Fix -Wcovered-switch-default in CGOpenMPRuntime.cpp (NFC)
Jie Fu [Wed, 7 Jun 2023 12:23:48 +0000 (20:23 +0800)]
[Clang][OpenMP] Fix -Wcovered-switch-default in CGOpenMPRuntime.cpp (NFC)

/data/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1621:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
/data/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1643:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
2 errors generated.

13 months ago[AArch64][SVE] Add a commutative VSelectCommPredOrPassthruPatFrags
David Green [Wed, 7 Jun 2023 12:18:16 +0000 (13:18 +0100)]
[AArch64][SVE] Add a commutative VSelectCommPredOrPassthruPatFrags

This adds a commutative version of VSelectPredOrPassthruPatFrags (renamed from
EitherVSelectOrPassthruPatFrags) that checks both variants for commutative
operations like min/max. I have not attempted to handle fp operation that
require fast-math flags.

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