platform/upstream/llvm.git
20 months ago[libc][docs] Move links to internal developer guides out of the main side bar.
Siva Chandra Reddy [Fri, 4 Nov 2022 19:53:24 +0000 (12:53 -0700)]
[libc][docs] Move links to internal developer guides out of the main side bar.

The links are all now from a "Developer Guides" page which is linked from the
main side bar.

20 months agoMLIR. NFC. Remove trailing whitespaces in MemRefOps.td
Uday Bondhugula [Sat, 5 Nov 2022 05:38:21 +0000 (11:08 +0530)]
MLIR. NFC. Remove trailing whitespaces in MemRefOps.td

Remove trailing whitespaces in MemRefOps.td. NFC.

20 months ago[lldb/crashlog] Standardize file path key in the ScriptedProcess Dictionary
Med Ismail Bennani [Sat, 5 Nov 2022 04:58:51 +0000 (21:58 -0700)]
[lldb/crashlog] Standardize file path key in the ScriptedProcess Dictionary

This patch replaces the backing file path key to "file_path" to keep it
consistent.

rdar://101652618

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[lldb/test] Fix StructuredDataTest::GetDescriptionEmpty warning (NFC)
Med Ismail Bennani [Sat, 5 Nov 2022 04:57:31 +0000 (21:57 -0700)]
[lldb/test] Fix StructuredDataTest::GetDescriptionEmpty warning (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[lldb/crashlog] Fix frame parser regex for when there is no source info
Med Ismail Bennani [Fri, 4 Nov 2022 21:49:52 +0000 (14:49 -0700)]
[lldb/crashlog] Fix frame parser regex for when there is no source info

It can happen that the originator of a crash report doesn't have access
to certain images. When that's the case, ReportCrash won't show the
source info in the crash report stack frames, but only the stack address
and image name.

This patch fixes a bug in the crashlog stackframe parser regular
expression to optionally match the source info group.

rdar://101934135

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[InstCombine] fold `sub + and` pattern with specific const value
chenglin.bi [Sat, 5 Nov 2022 04:58:14 +0000 (12:58 +0800)]
[InstCombine] fold `sub + and` pattern with specific const value

`C1 - ((C3 - X) & C2) --> (X & C2) + (C1 - (C2 & C3))`
when:
    (C3 - ((C2 & C3) - 1)) is pow2 &&
    ((C2 + C3) & ((C2 & C3) - 1)) == ((C2 & C3) - 1) &&
    C2 is negative pow2 || (C3 - X) is nuw

https://alive2.llvm.org/ce/z/HXQJV-

Fix: #58523

Reviewed By: spatel

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

20 months ago[libc] Add add_with_carry to builtin wrapper.
Tue Ly [Fri, 4 Nov 2022 18:22:35 +0000 (14:22 -0400)]
[libc] Add add_with_carry to builtin wrapper.

Add add_with_carry to builtin wrapper to be used by UInt class.

Reviewed By: orex

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

20 months ago[mlir] Attempt to fix windows build after D137374
River Riddle [Sat, 5 Nov 2022 01:53:50 +0000 (18:53 -0700)]
[mlir] Attempt to fix windows build after D137374

20 months ago[mlir:LLVM] Fix translation of DISubRangeAttr to LLVM
River Riddle [Fri, 4 Nov 2022 02:12:53 +0000 (19:12 -0700)]
[mlir:LLVM] Fix translation of DISubRangeAttr to LLVM

We were missing DISubRangeAttr in the type switch. This
also updates a few of the range parameters to be optional.

20 months ago[mlir] Infer SubElementInterface implementations using the storage KeyTy
River Riddle [Thu, 3 Nov 2022 23:06:59 +0000 (16:06 -0700)]
[mlir] Infer SubElementInterface implementations using the storage KeyTy

The KeyTy of attribute/type storage classes provide enough information for
automatically implementing the necessary sub element interface methods. This
removes the need for derived classes to do it themselves, which is both much
nicer and easier to handle certain invariants (e.g. null handling). In cases where
explicitly handling for parameter types is necessary, they can provide an implementation
of `AttrTypeSubElementHandler` to opt-in to support.

This tickles a few things alias wise, which annoyingly messes with tests that hard
code specific affine map numbers.

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

20 months ago[mlir][MemRef] Fix the lowering of extract_strided_metadata
Quentin Colombet [Thu, 3 Nov 2022 19:14:52 +0000 (19:14 +0000)]
[mlir][MemRef] Fix the lowering of extract_strided_metadata

The first result of the extract_strided_metadata operation is a MemRef,
not a naked pointer.
This patch fixes the lowering of this operation in MemRefToLLVM so that
we properly materialize the full MemRef structure and not just the base,
naked, pointer.

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

20 months ago[RISCV] Add isel pattern for (and X, 0xffffffff << C) with Zba.
Craig Topper [Sat, 5 Nov 2022 00:49:08 +0000 (17:49 -0700)]
[RISCV] Add isel pattern for (and X, 0xffffffff << C) with Zba.

We can use SRLI by C to clear LSBs followed by a SLLI_UW.

20 months ago[RISCV] Remove duplicate SDNodeXForm. NFC
Craig Topper [Sat, 5 Nov 2022 00:26:16 +0000 (17:26 -0700)]
[RISCV] Remove duplicate SDNodeXForm. NFC

20 months agoBack out test that failed.
Jennifer Yu [Sat, 5 Nov 2022 00:15:14 +0000 (17:15 -0700)]
Back out test that failed.
But I can not reproduce the problem on my local machine. My local machine run:

222 0x5a6780
222 0x7fffbef9400e
222 0x5a677e 0x5a6780 0x7fffbef936c8
222 0x376f8e 0x376f90 0x7fffbef94008
222 0x281f20
222 0x7fffbef9400e
PASSED

20 months ago[llvm-profdata] Check for all duplicate entries in MemOpSize table
Matthew Voss [Sat, 5 Nov 2022 00:08:54 +0000 (17:08 -0700)]
[llvm-profdata] Check for all duplicate entries in MemOpSize table

Previously, we only checked for duplicate zero entries when merging a
MemOPSize table (see D92074), but a user recently provided a reproducer
demonstrating that other entries can also be duplicated. As demonstrated
by the test in this patch, PGOMemOPSizeOpt can potentially generate
invalid IR for non-zero, non-consecutive duplicate entries. This seems
to be a rare case, since the duplicate entry is often below the
threshold, but possible. This patch extends the existing warning to
check for any duplicate values in the table, both in the optimization
and in llvm-profdata.

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

20 months ago[RISCV] Rename isAllUsesReadW to hasAllWUsers in RISCVSExtWRemoval. NFC
Craig Topper [Fri, 4 Nov 2022 19:59:55 +0000 (12:59 -0700)]
[RISCV] Rename isAllUsesReadW to hasAllWUsers in RISCVSExtWRemoval. NFC

20 months ago[mlir][sparse] fix sparse tensor rewriting patterns that do not propagate sparse...
Peiming Liu [Fri, 4 Nov 2022 19:35:29 +0000 (19:35 +0000)]
[mlir][sparse] fix sparse tensor rewriting patterns that do not propagate sparse tensor SSA properly.

Reviewed By: aartbik

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

20 months agoFix Bazel build for ba65584d1545951ce958ea5729692374055d6b9f
David Blaikie [Fri, 4 Nov 2022 23:35:05 +0000 (23:35 +0000)]
Fix Bazel build for ba65584d1545951ce958ea5729692374055d6b9f

20 months ago[mlir][sparse] extend foreach operation to accept reduction arguments.
Peiming Liu [Fri, 4 Nov 2022 17:52:21 +0000 (17:52 +0000)]
[mlir][sparse] extend foreach operation to accept reduction arguments.

Reviewed By: aartbik

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

20 months agoR600: Remove broken atomicrmw patterns
Matt Arsenault [Thu, 3 Nov 2022 21:05:37 +0000 (14:05 -0700)]
R600: Remove broken atomicrmw patterns

inc/dec are not add/sub of 1.

20 months ago[MLGO][NFC] Use std::map instead of DenseMap to avoid use after free
Mircea Trofin [Fri, 4 Nov 2022 23:05:10 +0000 (16:05 -0700)]
[MLGO][NFC] Use std::map instead of DenseMap to avoid use after free

In `MLInlineAdvisor::getAdviceImpl`, we call `getCachedFPI` twice, once
for the caller, once for the callee, so the second may invalidate the
reference obtained by the first because the underlying implementation of
the cache is a `DenseMap`. `std::map` doesn't have that problem.

20 months ago[libc++abi] Use std::nullptr_t instead of declaring it manually
Ryan Prichard [Fri, 4 Nov 2022 22:51:44 +0000 (15:51 -0700)]
[libc++abi] Use std::nullptr_t instead of declaring it manually

Sometimes libc++'s stddef.h wrapper gets included, which defines
::nullptr_t. This test is compiled with -Wshadow -Werror, so shadowing
::nullptr_t with a nullptr_t in main is an error. Include cstddef,
which is guaranteed to define std::nullptr_t in C++11 and forward.

Reviewed By: ldionne, #libc_abi

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

20 months agoAMDGPU: Fold undef rcp to qnan
Matt Arsenault [Mon, 17 Oct 2022 04:35:07 +0000 (21:35 -0700)]
AMDGPU: Fold undef rcp to qnan

This matches the behavior in instcombine, and for fdiv.

20 months agoAMDGPU: Fix test failure
Matt Arsenault [Fri, 4 Nov 2022 22:49:15 +0000 (15:49 -0700)]
AMDGPU: Fix test failure

20 months ago[mlir][sparse] support Parallel for/reduction.
Peiming Liu [Tue, 18 Oct 2022 16:41:03 +0000 (16:41 +0000)]
[mlir][sparse] support Parallel for/reduction.

Reviewed By: aartbik

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

20 months agoRevert "[lldb-vscode] Send Statistics Dump in terminated event"
George Hu [Fri, 4 Nov 2022 22:37:18 +0000 (15:37 -0700)]
Revert "[lldb-vscode] Send Statistics Dump in terminated event"

This reverts commit e3ccbae309273900a42e30b606c15c873d57f1ea.

There is a bug which is failing the test running on mac.

20 months agoRemove redundant loads.
Jennifer Yu [Wed, 2 Nov 2022 22:43:26 +0000 (15:43 -0700)]
Remove redundant loads.

It is caused by regenerate captured var value when processing the
has_device_addr, the captured var value has been generated in
GenerateOpenMPCapturedVars and passed as Arg in generateInfoForCapture.
The fix just use Arg instead regenerated just same as is_device_ptr

20 months agoAMDGPU: Fix assert when trying to overextend liverange
Matt Arsenault [Tue, 25 Oct 2022 05:41:41 +0000 (22:41 -0700)]
AMDGPU: Fix assert when trying to overextend liverange

This was trying to add segments beyond the new and use,
so skip additional segments.

This would hit (S < E && "Cannot create empty or backwards segment").

20 months agoFix test TestVSCode_terminatedEvent.py
Wanyi Ye [Fri, 4 Nov 2022 19:01:00 +0000 (12:01 -0700)]
Fix test TestVSCode_terminatedEvent.py

This test is broken due to the flaky encoding of top-level JSON key 'memory'
When I run locally (linux) the test passed. However, it failed the build bot: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48111/
I will find a way to repro before I can actually fix this issue correctly.

https://reviews.llvm.org/D137455

20 months ago[mlir][spirv] Fold noop `BitcastsOp`s
Jakub Kuderski [Fri, 4 Nov 2022 21:37:18 +0000 (17:37 -0400)]
[mlir][spirv] Fold noop `BitcastsOp`s

This allows for bitcast conversion to roundtrip.

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

Reviewed By: antiagainst, Hardcode84, mravishankar

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

20 months ago[CMake] Only set LLVM_DEFAULT_TARGET_TRIPLE to LLVM_HOST_TRIPLE when native target...
Xiang Li [Fri, 4 Nov 2022 19:37:07 +0000 (12:37 -0700)]
[CMake] Only set LLVM_DEFAULT_TARGET_TRIPLE to LLVM_HOST_TRIPLE when native target is enabled

This is for case when native target like X86 is not in LLVM_TARGETS_TO_BUILD.
Right now LLVM_DEFAULT_TARGET_TRIPLE is set to LLVM_HOST_TRIPLE even when native target is not enabled,
As a result, many lit tests will fail because default_triple is set for lit test but not enabled when build LLVM.

Reviewed By: smeenai

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

20 months agoRevert "Implement CWG2631"
Corentin Jabot [Fri, 4 Nov 2022 21:09:58 +0000 (22:09 +0100)]
Revert "Implement CWG2631"

This reverts commit 7acfe3629479c8489fc2d7f629994dc200be990c.
This reverts commit 5f87a892a7bed9cb0599573b9aaf387bc1df9c14.
This reverts commit 6875ac69279a3a02fab382a2c8d121558ecbfa91.

20 months ago[mlir][tiling] Relax tiling to accept generating multiple operations.
Hanhan Wang [Fri, 4 Nov 2022 20:58:59 +0000 (13:58 -0700)]
[mlir][tiling] Relax tiling to accept generating multiple operations.

Some operations need to generate multiple operations when implementing
the tiling interface. Here is a sound example in IREE, see
https://github.com/iree-org/iree/pull/10905 for more details.

Reviewed By: mravishankar

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

20 months agoAlias Analysis infra in Flang
Renaud-K [Wed, 2 Nov 2022 22:39:58 +0000 (15:39 -0700)]
Alias Analysis infra in Flang

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

20 months ago[BOLT] Always move JTs in jump-table=move
Rafael Auler [Sat, 29 Oct 2022 01:34:48 +0000 (18:34 -0700)]
[BOLT] Always move JTs in jump-table=move

We should always move jump tables when requested. Previously,
we were not moving jump tables of non-simple functions in relocation
mode. That caused a bug detailed in the attached test case: in PIC
jump tables, we force jump tables to be moved, but if they are not
moved because the function is not simple, we could incorrectly update
original entries in .rodata, corrupting it under special circumstances
(see testcase).

Reviewed By: #bolt, maksfb

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

20 months ago[BOLT][Hugify] Fix apple builds
Rafael Auler [Fri, 4 Nov 2022 20:08:31 +0000 (13:08 -0700)]
[BOLT][Hugify] Fix apple builds

Fix placement of ifdefs in hugify.cpp after D129107 landed.

20 months agoSome uses of the preprocessor can result in multiple target regions on the
Mike Rice [Thu, 3 Nov 2022 15:50:08 +0000 (08:50 -0700)]
Some uses of the preprocessor can result in multiple target regions on the
same line. Cases such as those in the associated lit tests, can now be
supported.

This adds a 'Count' field to TargetRegionEntryInfo to differentiate
regions with the same source position.

The OffloadEntriesInfoManager routines are updated to maintain a count of
regions seen at a location. The registration of regions proceeds that same as
before, but now the next available count is always determined and used in the
offload entry.

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

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

20 months ago[mlir] Move the assertion to a valid place.
Hanhan Wang [Thu, 3 Nov 2022 01:09:46 +0000 (18:09 -0700)]
[mlir] Move the assertion to a valid place.

The defining Op may live in an unlinked block so its parent Op may be
null. Only assert it when the parent Op is not null.

Reviewed By: mravishankar

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

20 months ago[mlir][arith][spirv] Remove duplicate test cases
Jakub Kuderski [Fri, 4 Nov 2022 19:10:58 +0000 (15:10 -0400)]
[mlir][arith][spirv] Remove duplicate test cases

Reviewed By: antiagainst

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

20 months ago[mlir][spirv] Do not truncate i/f64 -> i/f32 in SPIRVConversion
Jakub Kuderski [Fri, 4 Nov 2022 19:10:18 +0000 (15:10 -0400)]
[mlir][spirv] Do not truncate i/f64 -> i/f32 in SPIRVConversion

This truncation can be unexpected and break program behavior.
Dedicated emulation passes should be used instead.

Also rename pass options to "emulate-lt-32-bit-scalar-types".

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

Reviewed By: antiagainst

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

20 months ago[IndVars] Forget SCEV for replaced PHI.
Florian Hahn [Fri, 4 Nov 2022 18:42:06 +0000 (18:42 +0000)]
[IndVars] Forget SCEV for replaced PHI.

Additional SCEV verification highlighted a case where the cached loop
dispositions where incorrect after simplifying a phi node in IndVars.
Fix it by invalidating the phi before replacing it.

Fixes #58750

20 months ago[LLVM][AMDGPU] Specialize 32-bit atomic fadd instruction for generic address space
Shilei Tian [Fri, 4 Nov 2022 18:10:54 +0000 (14:10 -0400)]
[LLVM][AMDGPU] Specialize 32-bit atomic fadd instruction for generic address space

The 32-bit floating-point atomic add instructions on AMDGPUs does not support a
"flat" or "generic" address space. So, if the address space cannot be determined
statically, the AMDGPU backend will fall back to a CAS loop (which does support
"flat" addressing). Instead, this patch emits runtime address-space checks to
allow native FP atomic add instructions for global and LDS memory (and non-atomic
FP add instructions for private/scratch memory).

In order to do that, this patch introduces a new interface function
`emitExpandAtomicRMW`. It is expected to be called when a common atomic expand
doesn't work for a specific target, such as the case we discussed here.

Reviewed By: arsenm

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

20 months ago[bazel] Port 589764a38264
Benjamin Kramer [Fri, 4 Nov 2022 18:06:44 +0000 (19:06 +0100)]
[bazel] Port 589764a38264

20 months agoFix format specifier warning in EmulateInstructionRISCV more
Benjamin Kramer [Fri, 4 Nov 2022 17:58:43 +0000 (18:58 +0100)]
Fix format specifier warning in EmulateInstructionRISCV more

Yes, the portable macro is still the only way to do this.

20 months ago[mlir][math] Simplify pow(x, 0.75) into sqrt(sqrt(x)) * sqrt(x).
Slava Zakharin [Wed, 2 Nov 2022 01:27:04 +0000 (18:27 -0700)]
[mlir][math] Simplify pow(x, 0.75) into sqrt(sqrt(x)) * sqrt(x).

Trivial simplification for CPU2017/503.bwaves resulting in 3.89%
speed-up on icelake.

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

20 months ago[lldb] Fix format specifier warning in EmulateInstructionRISCV
Jonas Devlieghere [Fri, 4 Nov 2022 17:46:21 +0000 (10:46 -0700)]
[lldb] Fix format specifier warning in EmulateInstructionRISCV

Fixes warning: format specifies type 'unsigned long' but the argument
has type 'lldb::addr_t' (aka 'unsigned long long') [-Wformat]

20 months ago[mlir][math] Initial support for fastmath flag attributes for Math dialect.
Slava Zakharin [Fri, 4 Nov 2022 16:52:47 +0000 (09:52 -0700)]
[mlir][math] Initial support for fastmath flag attributes for Math dialect.

Added arith::FastMathAttr and ArithFastMathInterface support for Math dialect
floating point operations.

This change-set creates ArithCommon conversion utils that currently
provide classes and methods to aid with arith::FastMathAttr conversion
into LLVM::FastmathFlags. These utils are used in ArithToLLVM and
MathToLLVM convertors, but may eventually be used by other converters
that need to convert fast math attributes.

Since Math dialect operations use arith::FastMathAttr, MathOps.td now
has to include enum and attributes definitions from Arith dialect.
To minimize the amount of TD code included from Arith dialect,
I moved FastMathAttr definition into ArithBase.td.

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

20 months ago[flang] add -f[no-]reciprocal-math
Tom Eccles [Wed, 19 Oct 2022 10:51:31 +0000 (10:51 +0000)]
[flang] add -f[no-]reciprocal-math

Only add the option processing and store the result. No attributes are
added to FIR yet.

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

20 months ago[flang] Add -f[no-]associative-math and -mreassociate
Tom Eccles [Wed, 19 Oct 2022 10:33:12 +0000 (10:33 +0000)]
[flang] Add -f[no-]associative-math and -mreassociate

Only add the option processing and store the result. No attributes are
added to FIR yet.

Clang only forwards -mreassociate
if (AssociativeMath && !SignedZeros && !TrappingMath)

Flang doesn't have -f[no-]trapping-math, so this part of the condition
has been omitted. !TrappingMath is the default.

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

20 months ago[flang] Add -f[no-]signed-zeros
Tom Eccles [Tue, 18 Oct 2022 17:59:03 +0000 (17:59 +0000)]
[flang] Add -f[no-]signed-zeros

Only add the option processing and store the result. No attributes are
added to FIR yet.

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

20 months ago[flang] Add -f[no-]approx-func
Tom Eccles [Tue, 18 Oct 2022 16:14:52 +0000 (16:14 +0000)]
[flang] Add -f[no-]approx-func

Only add the option processing and store the result. No attributes are
added to FIR yet.

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

20 months ago[flang] Add -f[no-]honor-nans and -menable-no-nans
Tom Eccles [Mon, 17 Oct 2022 17:45:15 +0000 (17:45 +0000)]
[flang] Add -f[no-]honor-nans and -menable-no-nans

Only add the option processing and store the result. No attributes are
added to FIR yet.

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

20 months ago[Test] Fix CHECK typo.
Zequan Wu [Wed, 2 Nov 2022 21:25:48 +0000 (14:25 -0700)]
[Test] Fix CHECK typo.

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

20 months ago[RISCV] Define custom-N opcodes
Philip Reames [Fri, 4 Nov 2022 16:59:40 +0000 (09:59 -0700)]
[RISCV] Define custom-N opcodes

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

20 months ago[mlir][Transform] NFC - Add custom builders for some useful transforms.
Nicolas Vasilache [Thu, 3 Nov 2022 22:09:48 +0000 (15:09 -0700)]
[mlir][Transform] NFC - Add custom builders for some useful transforms.

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

20 months ago[RFC][OpenMP][Doc] No backward compatible for libomptarget and plugins
Shilei Tian [Fri, 4 Nov 2022 16:40:45 +0000 (12:40 -0400)]
[RFC][OpenMP][Doc] No backward compatible for libomptarget and plugins

Now we state that backward compatibility is not guaranteed in the document.

Reviewed By: JonChesterfield, dreachem

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

20 months ago[mlir][linalg] Fix neutral element value for minf/maxf
Thomas Raoux [Fri, 4 Nov 2022 04:23:32 +0000 (04:23 +0000)]
[mlir][linalg] Fix neutral element value for minf/maxf

The neutral element got minf/maxf should be respectively +inf and -inf.

Bug reported by @Hardcode84.

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

20 months ago[Driver][AIX] Change UNSUPPORTED to XFAIL system-aix
Hubert Tong [Fri, 4 Nov 2022 16:26:53 +0000 (12:26 -0400)]
[Driver][AIX] Change UNSUPPORTED to XFAIL system-aix

Update https://reviews.llvm.org/rGc14df228ff3c to check the host versus
the target thereby allowing XFAIL to be used in case the issue is
resolved in the future.

20 months ago[mlir][python] Allow adding to existing pass manager
rkayaith [Thu, 20 Oct 2022 04:27:09 +0000 (00:27 -0400)]
[mlir][python] Allow adding to existing pass manager

This adds a `PassManager.add` method which adds pipeline elements to the
pass manager. This allows for progressively building up a pipeline from
python without string manipulation.

Reviewed By: mehdi_amini

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

20 months ago[LVI] Improve debug message (NFC)
Nikita Popov [Fri, 4 Nov 2022 15:57:42 +0000 (16:57 +0100)]
[LVI] Improve debug message (NFC)

20 months ago[libc++] inline more functions into basic_string
Nikolas Klauser [Sat, 29 Oct 2022 19:04:35 +0000 (21:04 +0200)]
[libc++] inline more functions into basic_string

This removes a lot of boilerplate.

Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, libcxx-commits

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

20 months agoPrecommit test for redundant mvn instructions
Benjamin Maxwell [Fri, 4 Nov 2022 11:52:38 +0000 (11:52 +0000)]
Precommit test for redundant mvn instructions

20 months ago[clang] Remove an incorrect assert
Corentin Jabot [Fri, 4 Nov 2022 14:45:06 +0000 (15:45 +0100)]
[clang]  Remove an incorrect assert

Compound statements can appear in default arguments
but should not be visited in ImmediateCallVisitor as they are
not subexpressions

20 months ago[LV][IVDescriptors] Fix recurrence identity element for FMin and FMax reductions
Karthik Senthil [Fri, 4 Nov 2022 14:33:45 +0000 (10:33 -0400)]
[LV][IVDescriptors] Fix recurrence identity element for FMin and FMax reductions

For a min and max reduction idioms, the identity (i.e. neutral) element
should be datatype's highest and lowest possible values respectively.
Current implementation in IVDescriptors incorrectly returns -Inf for FMin
reduction and +Inf for FMax reduction. This patch fixes this bug which
was causing incorrect reduction computation results in loops vectorized
by LV.

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

20 months ago[VectorCombine] move load safety checks to helper function; NFC
Sanjay Patel [Wed, 2 Nov 2022 21:10:20 +0000 (17:10 -0400)]
[VectorCombine] move load safety checks to helper function; NFC

These checks can be re-used with other potential transforms
such as a load of a subvector-insert.

20 months ago[clang] Fix assert in SemaEXpr.cpp
Corentin Jabot [Fri, 4 Nov 2022 14:37:18 +0000 (15:37 +0100)]
[clang] Fix assert in SemaEXpr.cpp

20 months ago[flang][RFC] Proposal for complex number lowering through MLIR
David Truby [Tue, 1 Nov 2022 14:12:14 +0000 (14:12 +0000)]
[flang][RFC] Proposal for complex number lowering through MLIR

This design document proposes lowering FIR complex number operations
through the MLIR complex dialect.

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

20 months ago[flang][RFC] Change the interface for non-BIND(C) CPTR type with VALUE attribute
Peixin Qiao [Fri, 4 Nov 2022 14:19:38 +0000 (22:19 +0800)]
[flang][RFC] Change the interface for non-BIND(C) CPTR type with VALUE attribute

When the `type(c_ptr/c_funptr)` argument has value attribute in non-BIND(C)
procedure, it is passed by VALUE in gfortran. ifort does not do this. Be
consistent with gfortran.

Fix #58756.

Reviewed By: PeteSteinfeld, jeanPerier

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

20 months ago[flang] Fix function result rewrite
Peixin Qiao [Fri, 4 Nov 2022 14:15:58 +0000 (22:15 +0800)]
[flang] Fix function result rewrite

When the function result is `type(c_ptr/c_funptr)`, and the function has
or does not have BIND(C) attribute, the function result is not taken as
the first argument of the function call in other compilers such as
gfortran and ifort. Fix it to be consistent with gfortran/ifort by
changing the abstract result type check.

Fix #58739.

Reviewed By: PeteSteinfeld, jeanPerier

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

20 months ago[flang] Update fir.select_type op to fit design document
Valentin Clement [Fri, 4 Nov 2022 13:59:37 +0000 (14:59 +0100)]
[flang] Update fir.select_type op to fit design document

Update the already existing fir.select_type operation to
reflect decisions made in the polymorphic entities design document.
The verifier is updated to check that the select is polymorphic.
The case attributes name are changed and some tests are added.

Reviewed By: jeanPerier

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

20 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

20 months ago[StructurizeCFG][DebugInfo] Avoid use-after-free
Juan Manuel MARTINEZ CAAMAÑO [Fri, 4 Nov 2022 13:28:26 +0000 (13:28 +0000)]
[StructurizeCFG][DebugInfo] Avoid use-after-free

Reviewed By: dstuttard

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

20 months ago[GVN] Patch for invalid GVN replacement
Alex Gatea [Fri, 4 Nov 2022 13:28:17 +0000 (14:28 +0100)]
[GVN] Patch for invalid GVN replacement

If PRE is performed as part of the main GVN pass (to PRE GEP
operands before processing loads), and it is performed across a
backedge, we will end up adding the new instruction to the leader
table of a block that has not yet been processed. When it will be
processed, GVN will incorrectly assume that the value is already
available, even though it is only available at the end of the
block.

Avoid this by not performing PRE across backedges.

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

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

20 months agoadds huge pages support of PIE/no-PIE binaries
Alexey Moksyakov [Mon, 27 Jun 2022 12:37:53 +0000 (12:37 +0000)]
adds huge pages support of PIE/no-PIE binaries

This patch adds the huge pages support (-hugify) for PIE/no-PIE
binaries. Also returned functionality to support the kernels < 5.10
where there is a problem in a dynamic loader with the alignment of
pages addresses.

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

20 months ago[llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope
Michał Górny [Fri, 4 Nov 2022 08:19:22 +0000 (09:19 +0100)]
[llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope

Fix mismatch between `%d`/`%x` format strings and `uint64_t` type.
This fixes incorrect printing of "Scope Sizes" on 32-bit platforms
where this leads to `llvm::print()` misreading vararg.

Fixes #58758

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

20 months ago[Driver] Do not run test on AIX
Serge Pavlov [Fri, 4 Nov 2022 11:30:17 +0000 (18:30 +0700)]
[Driver] Do not run test on AIX

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

20 months ago[mlir][linalg] Add BroadcastOp to Linalg structured ops.
Oleg Shyshkov [Fri, 4 Nov 2022 11:06:31 +0000 (12:06 +0100)]
[mlir][linalg] Add BroadcastOp to Linalg structured ops.

[[RFC] Primitive Ops: add BroadcastOp to Linalg](https://discourse.llvm.org/t/rfc-primitive-ops-add-broadcastop-to-linalg/66313?u=olegshyshkov)

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

20 months ago[AMDGPU] Skip stack-arg dbg objects while fixing the dead frame indices
Christudasan Devadasan [Wed, 2 Nov 2022 13:38:02 +0000 (19:08 +0530)]
[AMDGPU] Skip stack-arg dbg objects while fixing the dead frame indices

Both SGPR->VGPR and VGPR->AGPR spilling code give a fixup to the
spill frame indices referred in debug instructions so that they
can be entirely removed. We should skip the stack argument debug
objects while looking inside the bitvector with FI as the index
that tracks the spill indices being processed. The stack args will
have negative indices and would crash while accessing the bitvector.

Reviewed By: arsenm

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

20 months ago[LoongArch] Change the name of LoongArchPreRAExpandPseudo pass
wanglei [Fri, 4 Nov 2022 09:50:31 +0000 (17:50 +0800)]
[LoongArch] Change the name of LoongArchPreRAExpandPseudo pass

By convention, pass names use lowercase letters.
LoongArch-prera-expand-pseudo -> loongarch-prera-expand-pseudo.

Reviewed By: SixWeining

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

20 months ago[IR] Switch everything to use memory attribute
Nikita Popov [Wed, 2 Nov 2022 15:46:56 +0000 (16:46 +0100)]
[IR] Switch everything to use memory attribute

This switches everything to use the memory attribute proposed in
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579.
The old argmemonly, inaccessiblememonly and inaccessiblemem_or_argmemonly
attributes are dropped. The readnone, readonly and writeonly attributes
are restricted to parameters only.

The old attributes are auto-upgraded both in bitcode and IR.
The bitcode upgrade is a policy requirement that has to be retained
indefinitely. The IR upgrade is mainly there so it's not necessary
to update all tests using memory attributes in this patch, which
is already large enough. We could drop that part after migrating
tests, or retain it longer term, to make it easier to import IR
from older LLVM versions.

High-level Function/CallBase APIs like doesNotAccessMemory() or
setDoesNotAccessMemory() are mapped transparently to the memory
attribute. Code that directly manipulates attributes (e.g. via
AttributeList) on the other hand needs to switch to working with
the memory attribute instead.

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

20 months ago[AArch64] SME2 multi-vec unpack, ZIP, frint for two and four registers
Caroline Concatto [Wed, 2 Nov 2022 09:35:43 +0000 (09:35 +0000)]
[AArch64] SME2 multi-vec unpack, ZIP, frint for  two and four registers

This patch adds the assembly/disassembly for the following instructions:
  SUNPK: Unpack and sign-extend multi-vector elements.
  UUNPK: Unpack and zero-extend multi-vector elements.
  ZIP (four registers): Interleave elements from four vectors.
  ZIP (two registers): Interleave elements from two vectors.
  FRINTA: Multi-vector floating-point round to integral value, to nearest with ties away from zero.
  FRINTM: Multi-vector floating-point round to integral value, toward minus Infinity.
  FRINTN: Multi-vector floating-point round to integral value, to nearest with ties to even.
  FRINTP: Multi-vector floating-point round to integral value, toward plus Infinity.

The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[AArch64][SVE] Extend PTEST_ANY(X=OP(PG,...), X) -> PTEST_ANY(PG, X)) instcombine
Cullen Rhodes [Fri, 4 Nov 2022 08:40:18 +0000 (08:40 +0000)]
[AArch64][SVE] Extend PTEST_ANY(X=OP(PG,...), X) ->  PTEST_ANY(PG, X)) instcombine

Extend above instcombine added in D134946 to cover more flag-setting
instructions.

Reviewed By: peterwaller-arm

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

20 months ago[X86] Use default attributes for more intrinsics
Nikita Popov [Wed, 2 Nov 2022 10:49:22 +0000 (11:49 +0100)]
[X86] Use default attributes for more intrinsics

Another followup to D136939, adding default attributes to the
remaining readnone intrinsics.

This also covers some non-readnone intrinsics, because they were
interleaved, and it seemed to make more sense to update them at
the same time.

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

20 months ago[libc][NFC] Remove "$>" from another command block on examples/README.md.
Siva Chandra Reddy [Fri, 4 Nov 2022 08:37:05 +0000 (08:37 +0000)]
[libc][NFC] Remove "$>" from another command block on examples/README.md.

20 months ago[libc][NFC] Remove "$>" from recipe commands blocks in examples/README.md.
Siva Chandra Reddy [Fri, 4 Nov 2022 08:33:28 +0000 (08:33 +0000)]
[libc][NFC] Remove "$>" from recipe commands blocks in examples/README.md.

The blocks come with a copy button so removing the "$>" makes it easy to
copy paste the commands.

20 months ago[libc] Add example programs and their CMake build and instructions.
Siva Chandra Reddy [Fri, 28 Oct 2022 23:20:28 +0000 (23:20 +0000)]
[libc] Add example programs and their CMake build and instructions.

These examples are serve as an examples for people wanting to start
using the libc.

Reviewed By: michaelrj, jeffbailey

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

20 months ago[SimplifyCFG] Allow speculating block containing assume()
Nikita Popov [Thu, 3 Nov 2022 13:13:08 +0000 (14:13 +0100)]
[SimplifyCFG] Allow speculating block containing assume()

SpeculativelyExecuteBB(), which converts a branch + phi structure
into a select, currently bails out if the block contains an assume
(because it is not speculatable).

Adjust the fold to ignore ephemeral values (i.e. assumes and values
only used in assumes) for cost modelling purposes, and drop them
when performing the fold.

Theoretically, we could try to preserve the assume information by
generating a assume(br_cond || assume_cond) style assume, but this
is very unlikely to to be useful (because we don't do anything
useful with assumes of this form) and it would make things
substantially more complicated once we take operand bundle assumes
into account (which don't really support a || operation).
I'd prefer not to do that without good motivation.

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

20 months ago[clang-format][NFC] Remove parsePPElIf()
Owen Pan [Wed, 2 Nov 2022 22:23:00 +0000 (15:23 -0700)]
[clang-format][NFC] Remove parsePPElIf()

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

20 months ago[clang][cuda/hip] Allow `__noinline__` lambdas
Pierre van Houtryve [Fri, 4 Nov 2022 07:25:22 +0000 (07:25 +0000)]
[clang][cuda/hip] Allow `__noinline__`  lambdas

D124866 seem to have had an unintended side effect: __noinline__ on lambdas was no longer accepted.

This fixes the regression and adds a test case for it.

Reviewed By: aaron.ballman

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

20 months agoRevert "Implement CWG2631"
Corentin Jabot [Fri, 4 Nov 2022 07:24:52 +0000 (08:24 +0100)]
Revert "Implement CWG2631"

Breaks the build on some platforms.

This reverts commit bf1e235695a7acdc3e868217e69d5b31ada06cb3.

20 months ago[AMDGPU] Create new instructions in SIInstrInfo::moveToVALU
Jay Foad [Mon, 31 Oct 2022 15:10:14 +0000 (15:10 +0000)]
[AMDGPU] Create new instructions in SIInstrInfo::moveToVALU

Create new VALU instructions in moveToVALU instead of mutating the
existing SALU instruction. This makes it easier to add extra operands so
we can convert to the VOP3 form of VALU instructions.

NFCI but it does have the minor side effect of removing duplicate
implicit operands that were present on the original SALU if they are
default implicit operands for the VALU.

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

20 months ago[flang] Handle non derived-type unlimited polymorphic allocation
Valentin Clement [Fri, 4 Nov 2022 07:18:47 +0000 (08:18 +0100)]
[flang] Handle non derived-type unlimited polymorphic allocation

Runtime call to PointerNullifyDerived or AllocatableInitDerived
should only be generated for derived-type allocation of polymorphic entities.
With unlimited polymorphic entities, it is possible that the type spec is not
a derived-type. Avoid failure in that case.

Reviewed By: PeteSteinfeld

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

20 months ago[libc] Add implementation of setbuf and setvbuf.
Siva Chandra Reddy [Wed, 2 Nov 2022 22:38:50 +0000 (22:38 +0000)]
[libc] Add implementation of setbuf and setvbuf.

Reviewed By: michaelrj

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

20 months ago[libc] Convert the api-test in to an integration test.
Siva Chandra Reddy [Fri, 4 Nov 2022 07:07:54 +0000 (07:07 +0000)]
[libc] Convert the api-test in to an integration test.

It used to pass but showed an annoying message about _start not being
available. That will not happen anymore.

20 months ago[RISCV] Add FMV_H_X/FMV_W_X/FCVT_H_W/FCVT_H_WU to isAllUsesReadW in SExtWRemoval.
Craig Topper [Fri, 4 Nov 2022 03:56:47 +0000 (20:56 -0700)]
[RISCV] Add FMV_H_X/FMV_W_X/FCVT_H_W/FCVT_H_WU to isAllUsesReadW in SExtWRemoval.

The instructions only read the lower 16 or 32 bits of a GPR.

20 months ago[RISCV] Change SEXT_B/SEXT_H/ZEXT_H_RV64 handling in isAllUsesReadW in SExtWRemoval.
Craig Topper [Fri, 4 Nov 2022 03:55:41 +0000 (20:55 -0700)]
[RISCV] Change SEXT_B/SEXT_H/ZEXT_H_RV64 handling in isAllUsesReadW in SExtWRemoval.

These instrucitons only use the lower 8 or 16 bits. We don't need
to look across them.

20 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

20 months ago[lldb/Interpreter] Open saved transcript in GUI Editor
Med Ismail Bennani [Tue, 1 Nov 2022 05:14:18 +0000 (22:14 -0700)]
[lldb/Interpreter] Open saved transcript in GUI Editor

This patch will automatically open LLDB's saved transcript file on the
graphical editor if lldb is running under an interactive graphical session.

This can be controlled by a new setting: `interpreter.open-transcript-in-editor`

rdar://92692106

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[ELF] Fix duplicate work typo. NFC
Fangrui Song [Fri, 4 Nov 2022 06:10:19 +0000 (23:10 -0700)]
[ELF] Fix duplicate work typo. NFC

20 months ago[X86][test] Change some CodeGen tests to use %clang_cc1
Fangrui Song [Fri, 4 Nov 2022 05:54:44 +0000 (22:54 -0700)]
[X86][test] Change some CodeGen tests to use %clang_cc1