platform/upstream/llvm.git
22 months ago[ConstraintElimination] Add tests for chained adds.
Florian Hahn [Wed, 14 Sep 2022 08:27:17 +0000 (09:27 +0100)]
[ConstraintElimination] Add tests for chained adds.

Add test coverage for reasoning about chains of adds.

22 months ago[test][clang] run test for lld emitting dwarf-aranages only if lld is presented
Azat Khuzhin [Wed, 14 Sep 2022 08:09:01 +0000 (10:09 +0200)]
[test][clang] run test for lld emitting dwarf-aranages only if lld is presented

Fixes: https://reviews.llvm.org/D133092
CI: https://lab.llvm.org/buildbot/#/builders/109/builds/46592

Reviewed By: hokein

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

22 months ago[libc][Obvious] Fix typo in the alternate path of the POSIX "access" function.
Siva Chandra [Wed, 14 Sep 2022 08:03:07 +0000 (01:03 -0700)]
[libc][Obvious] Fix typo in the alternate path of the POSIX "access" function.

22 months ago[libc] Add implementation of POSIX function "access".
Siva Chandra Reddy [Tue, 13 Sep 2022 20:09:20 +0000 (20:09 +0000)]
[libc] Add implementation of POSIX function "access".

Reviewed By: lntue

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

22 months ago[clang][Interp] Remove struct from a testcase
Timm Bäder [Wed, 14 Sep 2022 04:21:38 +0000 (06:21 +0200)]
[clang][Interp] Remove struct from a testcase

This should fix the leak sanitizer breakage introduced by
https://reviews.llvm.org/D132997, e.g.
https://lab.llvm.org/buildbot/#/builders/5/builds/27410

22 months ago[C++20] [Coroutines] Prefer sized deallocation in promise_type
Chuanqi Xu [Wed, 14 Sep 2022 06:55:13 +0000 (14:55 +0800)]
[C++20] [Coroutines] Prefer sized deallocation in promise_type

Now when the compiler can't find the sized deallocation function
correctly in promise_type if there are multiple deallocation function
overloads there.

According to [dcl.fct.def.coroutine]p12:
> If both a usual deallocation function with only a pointer parameter
> and a usual deallocation function with both a pointer parameter and a
> size parameter are found, then the selected deallocation function
> shall be the one with two parameters.

So when there are multiple deallocation functions, the compiler should
choose the sized one instead of the unsized one. The patch fixes this.

22 months ago[flang] Make a descriptor copy for fir.load fir.ref<fir.box>
Jean Perier [Wed, 14 Sep 2022 06:54:00 +0000 (08:54 +0200)]
[flang] Make a descriptor copy for fir.load fir.ref<fir.box>

`fir.box` and `fir.ref<fir.box>` are both lowered to LLVM as a
descriptor in memory. This is because fir.box of polymorphic and assumed
rank entities cannot be known at compile time, so fir.box cannot be
lowered to a struct value.

fir.load or fir.ref<fir.box> was previously lowered to a no-op,
propagating the operand descriptor storage as a result.
This is wrong because the operand descriptor storage may later be
modified, and these changes should not be visible in the loaded fir.box
that is an immutable SSA value.

Modify fir.load codegen for fir.box to make a copy into a new storage to
ensure the fir.box is immutable.

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

22 months ago[amdgpu] Expand all ConstantExpr users of LDS variables in instructions
Jon Chesterfield [Wed, 14 Sep 2022 06:55:44 +0000 (07:55 +0100)]
[amdgpu] Expand all ConstantExpr users of LDS variables in instructions

Bug noted in D112717 can be sidestepped with this change.

Expanding all ConstantExpr involved with LDS up front makes the variable specialisation simpler. Excludes ConstantExpr that don't access LDS to avoid disturbing codegen elsewhere.

Reviewed By: rampitec

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

22 months ago[Support] Access threadIndex via a wrapper function
Martin Storsjö [Tue, 13 Sep 2022 08:17:58 +0000 (11:17 +0300)]
[Support] Access threadIndex via a wrapper function

On Unix platforms, this wrapper function is inline, so it should
expand to the same direct access to the thread local variable. On
Windows, it's a non-inline function within Parallel.cpp, allowing
making the thread_local variable static.

Windows Native TLS doesn't support direct access to thread local
variables in a different DLL, and GCC/binutils on Windows occasionally
has problems with non-static thread local variables too.

This fixes mingw dylib builds with native TLS after
e6aebff67426fa0f9779a0c19d6188a043bf15e7.

At the same time, move the whole thread local variable within
    #if LLVM_ENABLE_THREADS
to fix builds without threading support.

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

22 months agoAMDGPU: Factor out hasDivergentBranch(). NFC
Ruiling Song [Thu, 1 Sep 2022 03:47:33 +0000 (11:47 +0800)]
AMDGPU: Factor out hasDivergentBranch(). NFC

This is helpful for detecting whether a block ends with divergent branch
in passes before lowering the pseudo control flow instructions.

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

22 months ago[HLSL]Add -O and -Od option for dxc mode.
Xiang Li [Wed, 29 Jun 2022 19:28:55 +0000 (12:28 -0700)]
[HLSL]Add -O and -Od option for dxc mode.

Two new dxc mode options -O and -Od are added for dxc mode.
-O is just alias of existing cc1 -O option.
-Od will be lowered into -O0 and -dxc-opt-disable.

-dxc-opt-disable is cc1 option added to for build ShaderFlags.

Reviewed By: beanz

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

22 months ago[AArch64InstPrinter] Introduce register markup tags emission
Antonio Frighetto [Wed, 14 Sep 2022 03:52:01 +0000 (20:52 -0700)]
[AArch64InstPrinter] Introduce register markup tags emission

AArch64 assembly syntax emission now leverages markup tags for registers, if enabled.

Reviewed By: MaskRay, david-arm

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

22 months ago[llvm-dwp] Report the filename if it cannot be found
Zhang Qing Shan [Wed, 14 Sep 2022 03:32:41 +0000 (11:32 +0800)]
[llvm-dwp] Report the filename if it cannot be found

For now, we report nothing if the execution/dwo file is missing, which is confusing.

Reviewed By: dblaikie

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

22 months ago[RISCV] Add cost model for vector insert/extract element.
jacquesguan [Wed, 31 Aug 2022 08:09:36 +0000 (16:09 +0800)]
[RISCV] Add cost model for vector insert/extract element.

This patch adds cost model for vector insert/extract element instructions. In RVV, we could use vector scalar move instruction to insert or extract the first element, and use vslide to move it. But for mask vector or i64 vector in i32 target, we need special instructions to make it.

Reviewed By: reames

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

22 months ago[NVPTX] Use MBB.begin() instead MBB.front() in NVPTXFrameLowering::emitPrologue
Shivam Gupta [Sat, 10 Sep 2022 18:59:10 +0000 (00:29 +0530)]
[NVPTX] Use MBB.begin() instead MBB.front() in NVPTXFrameLowering::emitPrologue

The second argument of `NVPTXFrameLowering::emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB)` is the first MBB of the MF. In that function, it assumes the first MBB always contains instructions, so it gets the first instruction by MachineInstr *MI = &MBB.front();. However, with the reproducer/test case attached, all instructions in the first MBB is cleared in a previous pass for stack coloring. As a consequence, MBB.front() triggers the assertion that the first node is actually a sentinel node. Hence we are using MachineBasicBlock::iterator to iterate over MBB.

Fix #52623.

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

22 months ago[RISCV] Transform VMERGE_VVM_<LMUL>_TU with all ones mask to VADD_VI_<LMUL>_TU.
Yeting Kuo [Tue, 13 Sep 2022 02:38:54 +0000 (10:38 +0800)]
[RISCV] Transform VMERGE_VVM_<LMUL>_TU with all ones mask to VADD_VI_<LMUL>_TU.

The transformation is benefit because vmerge.vvm always needs mask operand but
vadd.vi may not.

Reviewed By: craig.topper

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

22 months ago[RISCV] Lower BUILD_VECTOR to RISCVISD::VID_VL if it is floating-point type.
Han-Kuan Chen [Mon, 12 Sep 2022 11:37:04 +0000 (04:37 -0700)]
[RISCV] Lower BUILD_VECTOR to RISCVISD::VID_VL if it is floating-point type.

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

22 months ago[LoongArch] Categorize code by function. NFC.
gonglingqin [Wed, 14 Sep 2022 01:33:45 +0000 (09:33 +0800)]
[LoongArch] Categorize code by function. NFC.

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

22 months ago[RISCV] Assemble `call foo` to R_RISCV_CALL_PLT
Fangrui Song [Wed, 14 Sep 2022 01:47:55 +0000 (18:47 -0700)]
[RISCV] Assemble `call foo` to R_RISCV_CALL_PLT

R_RISCV_CALL/R_RISCV_CALL_PLT distinction isn't necessary. R_RISCV_CALL has been
deprecated as a resolution to
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/98 .

ld.lld and mold treat the two relocation types the same. GNU ld has a custom
handling for undefined weak functions which is unnecessary: calling an
unresolved undefined weak function is UB and GNU ld can handle the case without
a relocation error (such a function call is usually guarded by a zero value
check and should be allowed).

This patch assembles `call foo` to use R_RISCV_CALL_PLT instead of the
deprecated R_RISCV_CALL.

Note: the code generator still differentiates `call foo` and (maybe preemptible)
`call foo@plt`, but the difference is purely aesthetic.

Note: D105429 does not support R_RISCV_CALL_PLT correctly. Changed the test to
force R_RISCV_CALL for now.

Reviewed By: kito-cheng

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

22 months ago[lld-macho][nfci] Don't include null terminator in StringRefs
Jez Ng [Wed, 14 Sep 2022 01:20:55 +0000 (21:20 -0400)]
[lld-macho][nfci] Don't include null terminator in StringRefs

So @keith observed
[here](https://reviews.llvm.org/D128108#inline-1263900) that the
StringRefs we were returning from `CStringInputSection::getStringRef()`
included the null terminator in their total length, but regular
StringRefs do not. Let's fix that so these StringRefs are less confusing
to use.

Reviewed By: #lld-macho, keith, Roger

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

22 months ago[mlir][sparse] minor merger API simplification
Aart Bik [Wed, 14 Sep 2022 00:10:42 +0000 (17:10 -0700)]
[mlir][sparse] minor merger API simplification

Reviewed By: bixia

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

22 months ago[Object][COFF] Allow section symbol to be common symbol
Pengxuan Zheng [Sat, 10 Sep 2022 00:36:16 +0000 (17:36 -0700)]
[Object][COFF] Allow section symbol to be common symbol

I ran into an lld-link error due to a symbol named ".idata$4" coming from some
static library:
  .idata$4 should not refer to special section 0.

Here is the symbol table entry for .idata$4:

  Symbol {
      Name: .idata$4
      Value: 3221225536
      Section: IMAGE_SYM_UNDEFINED (0)
      BaseType: Null (0x0)
      ComplexType: Null (0x0)
      StorageClass: Section (0x68)
      AuxSymbolCount: 0
  }

The symbol .idata$4 is a section symbol (IMAGE_SYM_CLASS_SECTION) and LLD
currently handles it as a regular defined symbol since isCommon() returns false
for this symbol. This results in the error ".idata$4 should not refer to special
section 0" because lld-link asserts that regular defined symbols should not
refer to section 0.

Should this symbol be handled as a common symbol instead? LLVM currently only
allows external symbols (IMAGE_SYM_CLASS_EXTERNAL) to be common
symbols. However, the PE/COFF spec (see section "Section Number Values") does
not seem to mention this restriction. Any thoughts?

Reviewed By: thakis

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

22 months ago[mlir][vector] Fold scalar vector.extract of non-splat n-D constants
Jakub Kuderski [Wed, 14 Sep 2022 00:30:33 +0000 (20:30 -0400)]
[mlir][vector] Fold scalar vector.extract of non-splat n-D constants

Add a new pattern to fold `vector.extract` over n-D constants that extract scalars.
The previous code handled ND splat constants only. The new pattern is conservative and does handle sub-vector constants.

This is to aid the `arith::EmulateWideInt` pass which emits a lot of 2-element vector constants.

Reviewed By: Mogball, dcaballe

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

22 months ago[flang] Write semantics test for atomic_fetch_xor
Katherine Rasmussen [Mon, 12 Sep 2022 15:47:39 +0000 (08:47 -0700)]
[flang] Write semantics test for atomic_fetch_xor

Write a semantics test for the atomic intrinsic subroutine,
atomic_fetch_xor.

Reviewed By: rouson

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

22 months ago[test] [fuzzer] Enable tests for iossim, disable for ios (update2)
Roy Sundahl [Tue, 13 Sep 2022 21:51:47 +0000 (14:51 -0700)]
[test] [fuzzer] Enable tests for iossim, disable for ios (update2)

The fuzzer tests cross_over.test and merge-control-file.test are not handled
correctly on ios device testing. On-device testing requires the macros %t, %s,
etc. to be expanded for a different default directory than when testing on host.

rdar://99889376

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

22 months agoAddress feedback in https://reviews.llvm.org/D133637
YongKang Zhu [Tue, 13 Sep 2022 23:08:17 +0000 (16:08 -0700)]
Address feedback in https://reviews.llvm.org/D133637

https://reviews.llvm.org/D133637 fixes the problem where we should hash raw content of
register mask instead of the pointer to it.

Fix the same issue in `llvm::hash_value()`.

Remove the added API `MachineOperand::getRegMaskSize()` to avoid potential confusion.

Add an assert to emphasize that we probably should hash a machine operand iff it has
associated machine function, but keep the fallback logic in the original change.

Reviewed By: MatzeB

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

22 months ago[IR] Add alignment for llvm.threadlocal.address
Alexander Shaposhnikov [Tue, 13 Sep 2022 21:47:13 +0000 (21:47 +0000)]
[IR] Add alignment for llvm.threadlocal.address

This diff sets the alignment attribute for the return value
and the argument of llvm.threadlocal.address.

(https://github.com/llvm/llvm-project/issues/57438)

Test plan: ninja check-all

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

22 months ago[WebAssembly] Improve codegen for shuffles with undefined lane indices
Fanchen Kong [Tue, 13 Sep 2022 23:03:18 +0000 (16:03 -0700)]
[WebAssembly] Improve codegen for shuffles with undefined lane indices

For undefined lane indices, fill the mask with {0..N} instead of zeros to allow
further reduction to word/dword shuffle on the VM.

Reviewed By: tlively, penzn

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

22 months ago[Lex/DependencyDirectivesScanner] Handle the case where the source line starts with...
Argyrios Kyrtzidis [Sun, 11 Sep 2022 17:06:57 +0000 (10:06 -0700)]
[Lex/DependencyDirectivesScanner] Handle the case where the source line starts with a `tok::hashhash`

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

22 months agoAdd mach-o corefile support for platform binaries
Jason Molenda [Tue, 13 Sep 2022 22:40:21 +0000 (15:40 -0700)]
Add mach-o corefile support for platform binaries

Add support for recognizing a platform binary in the ObjectFileMachO
method that parses the "load binary" LC_NOTEs in a corefile.

A bit of reorganization to ProcessMachCore::DoLoadCore to separate
all of the unrelated things being done in that method into their own
separate methods, as well as small fixes to improve the handling of
a corefile with multiple kernel images in the corefile.

Differential Revision: https://reviews.llvm.org/D133680
rdar://98754861

22 months agoRegisterCoalescer: Fix verifier error when merging copy of undef
Matt Arsenault [Tue, 7 Jun 2022 21:55:32 +0000 (17:55 -0400)]
RegisterCoalescer: Fix verifier error when merging copy of undef

There's no real read of the register, so the copy introduced a new
live value. Make sure we introduce a replacement implicit_def instead
of just erasing the copy.

Found from llvm-reduce since it tries to set undef on everything.

22 months ago[lldb][fuzz] Allow expression fuzzer to be passed as a flag.
Jordan Rupprecht [Tue, 13 Sep 2022 22:39:14 +0000 (15:39 -0700)]
[lldb][fuzz] Allow expression fuzzer to be passed as a flag.

The expression fuzzer checks an environment variable, `LLDB_FUZZER_TARGET`, to get the fuzzer target binary. This is fine, but internally our tooling for running fuzz tests only has proper handling for flag values. It's surprisingly complicated to add support for that, and allowing it to be passed via flag seems reasonable anyway.

Reviewed By: cassanova

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

22 months ago[RISCV] Add MIR comments for VecPolicy operands
Philip Reames [Tue, 13 Sep 2022 22:35:41 +0000 (15:35 -0700)]
[RISCV] Add MIR comments for VecPolicy operands

Analogous to what we already do for SEW operands, aimed at making the resulting MIR readable by a human.

22 months ago[clang] fix generation of .debug_aranges with LTO
Azat Khuzhin [Tue, 13 Sep 2022 22:32:55 +0000 (22:32 +0000)]
[clang] fix generation of .debug_aranges with LTO

Right now in case of LTO the section is not emited:

    $ cat test.c
    void __attribute__((optnone)) bar()
    {
    }
    void __attribute__((optnone)) foo()
    {
            bar();
    }
    int main()
    {
            foo();
    }

    $ clang -flto=thin -gdwarf-aranges -g -O3 test.c
    $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
    0

    $ clang -gdwarf-aranges -g -O3 test.c
    $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
    2

Fix this by passing explicitly -mllvm -generate-arange-section.

P.S. although this looks like a hack, since none of -mllvm was passed to
the lld before.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Suggested-by: OCHyams <orlando.hyams@sony.com>
Reviewed By: dblaikie

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

22 months agoDon't populate the symbol table with symbols that don't belong to a section with...
George Wright [Tue, 13 Sep 2022 22:20:54 +0000 (22:20 +0000)]
Don't populate the symbol table with symbols that don't belong to a section with the flag SHF_ALLOC

When populating the symbol table for an ELF object file, don't insert any symbols that come from ELF sections which don't have runtime allocated memory (typically debugging symbols).

Reviewed By: dblaikie

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

22 months agollvm-reduce: Add undef to new subregister IMPLICIT_DEFs
Matt Arsenault [Tue, 13 Sep 2022 18:22:58 +0000 (14:22 -0400)]
llvm-reduce: Add undef to new subregister IMPLICIT_DEFs

This avoids a verifier error from the other unused lanes when
LiveIntervals is used.

22 months agollvm-reduce: Fix missing undef flags in some tests
Matt Arsenault [Tue, 13 Sep 2022 20:50:41 +0000 (16:50 -0400)]
llvm-reduce: Fix missing undef flags in some tests

These caused failures when LiveIntervals is used by the verifier. Also
fix some other errors that appear with subranges enabled.

22 months agollvm-reduce: Use FileCheck instead of python for interestingness test
Matt Arsenault [Tue, 13 Sep 2022 18:57:32 +0000 (14:57 -0400)]
llvm-reduce: Use FileCheck instead of python for interestingness test

Also avoid using cat for no reason.

22 months ago[RISCV] Simpify operand index calculation in createMIROperandComment [nfc]
Philip Reames [Tue, 13 Sep 2022 22:06:11 +0000 (15:06 -0700)]
[RISCV] Simpify operand index calculation in createMIROperandComment [nfc]

22 months agoRevert "Be more careful to maintain quoting information when parsing commands."
Jim Ingham [Tue, 13 Sep 2022 21:59:21 +0000 (14:59 -0700)]
Revert "Be more careful to maintain quoting information when parsing commands."

This reverts commit 6c089b2af5d8d98f66b27b67f70958f520820a76.

This was causing the test test_help_run_hides_options from TestHelp.py to
fail on Linux and Windows (but the test succeeds on macOS).  The decision
to print option information is determined by CommandObjectAlias::IsDashDashCommand
which was changed, but only by replacing an inline string constant with a const char *
CommandInterpreter::g_argument which has the same string value.  I can't see why this
would fail, I'll have to spin up a vm to see if I can repo there.

22 months agoRevert "constexpr isn't right here."
Jim Ingham [Tue, 13 Sep 2022 21:58:53 +0000 (14:58 -0700)]
Revert "constexpr isn't right here."

This didn't help either.

This reverts commit 8433b210839ed655852428ba8b34bb67b191957a.

22 months agoRevert "Trying to understand the TestHelp.py failure from 6c089b2."
Jim Ingham [Tue, 13 Sep 2022 21:58:27 +0000 (14:58 -0700)]
Revert "Trying to understand the TestHelp.py failure from 6c089b2."

It didn't help.

This reverts commit 81f8788528886ee611041e1f4ee54eea8bbfa277.

22 months agoRevert "Make sure libLLVM users link with libatomic if needed"
Aaron Puchert [Tue, 13 Sep 2022 21:56:08 +0000 (23:56 +0200)]
Revert "Make sure libLLVM users link with libatomic if needed"

Adds too many dependencies: many libraries in LLVM_SYSTEM_LIBS are
arguably not required for users of libLLVM.

This reverts commit 44ffc13f2eb6188a86ae88ea1e942e9ac354db9b.

22 months agoAdd virtual-base-class example to AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDw...
Scott Linder [Tue, 13 Sep 2022 21:49:20 +0000 (21:49 +0000)]
Add virtual-base-class example to AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md

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

22 months ago[ELF][Distributed ThinLTO] Do not generate empty index when bitcode object is linked
Wei Wang [Tue, 13 Sep 2022 00:35:51 +0000 (17:35 -0700)]
[ELF][Distributed ThinLTO] Do not generate empty index when bitcode object is linked

When the same bitcode object file is given multiple times from the Command-line
as lazy object file, empty index is generated which overwrites the one from thinlink.
This could cause undefined symbols during final link.

Reviewed By: MaskRay

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

22 months ago[BOLT] Stop using std::iterator (NFC)
Kazu Hirata [Tue, 13 Sep 2022 21:14:23 +0000 (14:14 -0700)]
[BOLT] Stop using std::iterator (NFC)

Without this patch, I get warnings like:

  bolt/include/bolt/Core/BinaryContext.h:108:19: error:
  'iterator<std::bidirectional_iterator_tag,
  llvm::bolt::BinarySection>' is deprecated
  [-Werror,-Wdeprecated-declarations]

This patch fixes those warnings by defining iterator_category,
value_type, etc.

This patch intentionally leaves duplicate types like FilterIterator::T
and FilterIterator::PointerT intact to avoid mixing the fix and the
cleanup.

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

22 months agoTrying to understand the TestHelp.py failure from 6c089b2.
Jim Ingham [Tue, 13 Sep 2022 21:06:35 +0000 (14:06 -0700)]
Trying to understand the TestHelp.py failure from 6c089b2.

Sadly, the test passes on macOS, but fails on Ubuntu & Win.  The
extra option printing is supposed to be suppressed by the return
from CommandObjectAlias::IsDashDashCommand.  That was changed, but just
by replacing an inline string compare with a const string from
CommandInterpreter.  Putting the old version back temporarily to
see if that is really the problem.

22 months ago[HLSL] Adding a test change I forgot to add
Chris Bieneman [Wed, 14 Sep 2022 01:51:44 +0000 (20:51 -0500)]
[HLSL] Adding a test change I forgot to add

This test just verifies that even at -O0 the buffer subscript operators
are inlined. The original change was
fb5baffc28c8beaf790a2fb1c8a863d29020bfbe.

22 months ago[DirectX backend] Remove Attribute not for DXIL on CallInst
Xiang Li [Sun, 4 Sep 2022 23:07:25 +0000 (16:07 -0700)]
[DirectX backend] Remove Attribute not for DXIL on CallInst

Remove Attribute on CallInst which is not for DXIL when prepare for DXIL.

Reviewed By: beanz

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

22 months ago[HLSL] Mark buffer subscript operators as AlwaysInline
Chris Bieneman [Wed, 14 Sep 2022 01:29:17 +0000 (20:29 -0500)]
[HLSL] Mark buffer subscript operators as AlwaysInline

HLSL requires aggressive inlineing for resource accesses. This just
enforces that we get resource handle accesses inlined early.

22 months ago[gn build] port fc04749957f1
Zequan Wu [Tue, 13 Sep 2022 18:19:08 +0000 (11:19 -0700)]
[gn build] port fc04749957f1

Reviewed By: thakis

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

22 months ago[mlir][sparse] Add sparse_tensor.select operation
Jim Kitchen [Tue, 13 Sep 2022 20:22:53 +0000 (15:22 -0500)]
[mlir][sparse] Add sparse_tensor.select operation

The new select operation allows filtering of sparse tensors
by conditionally keeping or removing each element. This
can be used to remove negative values or select the upper
triangle of a matrix.

The select op has a single region which operates on a single
value and must return a boolean True to keep or False to drop.

Reviewed by: aartbik

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

22 months ago[Clang] [Sema] Ignore invalid multiversion function redeclarations
Evgeny Shulgin [Sat, 10 Sep 2022 13:36:06 +0000 (13:36 +0000)]
[Clang] [Sema] Ignore invalid multiversion function redeclarations

If a redeclaration of a multiversion function is invalid,
it may be in a broken condition (for example, missing an important
attribute). We shouldn't analyze invalid redeclarations.

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

Reviewed By: tahonermann

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

22 months ago[HLSL] Call global destructors from entries
Chris Bieneman [Tue, 13 Sep 2022 18:07:46 +0000 (13:07 -0500)]
[HLSL] Call global destructors from entries

HLSL doesn't have a C++ runtime that supports `atexit` registration. To
enable global destructors we instead rely on the `llvm.global_dtor`
mechanism.

This change disables `atexit` generation for HLSL and updates the HLSL
code generation to call global destructors on the exit from entry
functions.

Depends on D132977.

Reviewed By: aaron.ballman

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

22 months agoconstexpr isn't right here.
Jim Ingham [Tue, 13 Sep 2022 20:01:05 +0000 (13:01 -0700)]
constexpr isn't right here.

22 months ago[Formatters][NFCI] Replace 'is_regex' arguments with an enum.
Jorge Gorbe Moya [Fri, 2 Sep 2022 23:13:13 +0000 (16:13 -0700)]
[Formatters][NFCI] Replace 'is_regex' arguments with an enum.

Modify `SBTypeNameSpecifier` and `lldb_private::TypeMatcher` so they
have an enum value for the type of matching to perform instead of an
`m_is_regex` boolean value.

This change paves the way for introducing formatter matching based on
the result of a python callback in addition to the existing name-based
matching. See the RFC thread at
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204
for more details.

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

22 months ago[AMDGPU] Don't shrink VOP3 instructions pre-RA on GFX10+
Jay Foad [Tue, 13 Sep 2022 11:59:33 +0000 (12:59 +0100)]
[AMDGPU] Don't shrink VOP3 instructions pre-RA on GFX10+

In GFX10, there is no advantage to shrinking these instructions pre-RA,
so this just saves a bit of work.

In GFX11 there is an advantage to *not* shrinking them pre-RA, because
the register classes for 16-bit operands are less restrictive in the
VOP3 form than in the shrunk form. This patch is a prerequisite for
actually setting up those register classes correctly for 16-bit vs
non-16-bit operands.

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

22 months ago[SelectOpti] Fix lifetime intrinsic bug
Sotiris Apostolakis [Tue, 13 Sep 2022 18:48:59 +0000 (18:48 +0000)]
[SelectOpti] Fix lifetime intrinsic bug

When a select is converted to a branch and load instructions are sinked to the true/false blocks,
lifetime intrinsics (if present) could be made unsound if not moved.

This conservatively moves all lifetime intrinsics in a transformed BB to the end block to ensure
preserved lifetime semantics.

Reviewed By: davidxl

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

22 months ago[DX] DXContainer does not support COMDAT
Chris Bieneman [Thu, 8 Sep 2022 20:30:18 +0000 (15:30 -0500)]
[DX] DXContainer does not support COMDAT

The DXContainer is pretty primitive, but doesn't support COMDAT. We need
to set that in the Triple so that Clang won't try to emit COMDATs.

22 months ago[NFC][ADT] Fix assert message
theidexisted [Tue, 13 Sep 2022 18:31:50 +0000 (18:31 +0000)]
[NFC][ADT] Fix assert message

Reviewed By: gchatelet

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

22 months ago[RISCV] Split vmerge peephole tests so they can be auto-gened
Philip Reames [Tue, 13 Sep 2022 18:39:36 +0000 (11:39 -0700)]
[RISCV] Split vmerge peephole tests so they can be auto-gened

Per original review, only one test needed the MIR output checks.  Copy that to it's own file, and use auto-gen for all three files.

22 months ago[mlir] Add bytecode encodings for the builtin ElementsAttr attributes
River Riddle [Tue, 13 Sep 2022 06:22:26 +0000 (23:22 -0700)]
[mlir] Add bytecode encodings for the builtin ElementsAttr attributes

This adds bytecode support for DenseArrayAttr, DenseIntOrFpElementsAttr,
DenseStringElementsAttr, and SparseElementsAttr.

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

22 months ago[mlir] Fix DenseElementsAttr treatment of bool splat of "true"
River Riddle [Tue, 13 Sep 2022 01:42:08 +0000 (18:42 -0700)]
[mlir] Fix DenseElementsAttr treatment of bool splat of "true"

Boolean splats currently can't roundtrip via the "raw" DenseElementsAttr
API. This is because internally we treat true splats in some cases as "1"(one bit set)
and in other cases as "0xFF"(all bits set). This commit cleans up this handling to
consistently use 0xFF (all bits set) as the value for a splat of true.

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

22 months ago[mlir] Add fallback support for parsing/printing unknown external resources
River Riddle [Tue, 13 Sep 2022 08:07:29 +0000 (01:07 -0700)]
[mlir] Add fallback support for parsing/printing unknown external resources

This is necessary/useful for building generic tooling that can roundtrip external
resources without needing to explicitly handle them. For example, this allows
for viewing the resources encoded within a bytecode file without having to
explicitly know how to process them (e.g. making it easier to interact with a
reproducer encoded in bytecode).

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

22 months ago[mlir:Bytecode] Add support for encoding resources
River Riddle [Wed, 7 Sep 2022 03:47:57 +0000 (20:47 -0700)]
[mlir:Bytecode] Add support for encoding resources

Resources are encoded in two separate sections similarly to
attributes/types, one for the actual data and one for the data
offsets. Unlike other sections, the resource sections are optional
given that in many cases they won't be present. For testing,
bytecode serialization is added for DenseResourceElementsAttr.

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

22 months ago[llvm-remarkutil] NFC: Combine parsing + serializing for bitstream2yaml
Jessica Paquette [Tue, 13 Sep 2022 18:02:52 +0000 (11:02 -0700)]
[llvm-remarkutil] NFC: Combine parsing + serializing for bitstream2yaml

We don't need to populate a string table, so we don't need to pre-parse the
remarks.

Split the bitstream2yaml and yaml2bitstream cases up so that we can avoid the
extra remark traversal in the bitstream2yaml case.

This kills the TODO.

22 months ago[libc][Obvious] Use unique test file names in dup, dup2 and dup3 tests.
Siva Chandra Reddy [Tue, 13 Sep 2022 18:16:04 +0000 (18:16 +0000)]
[libc][Obvious] Use unique test file names in dup, dup2 and dup3 tests.

22 months ago[Docs] Added LLVM SPIR-V Backend Working Group
Michal Paszkowski [Tue, 13 Sep 2022 18:17:37 +0000 (20:17 +0200)]
[Docs] Added LLVM SPIR-V Backend Working Group

22 months ago[gn build] port c8daf4a707ad (check-lldb)
Zequan Wu [Tue, 13 Sep 2022 18:14:36 +0000 (11:14 -0700)]
[gn build] port c8daf4a707ad (check-lldb)

Reviewed By: thakis

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

22 months ago[Bazel] Bump bazel version to 5.0.
Christian Sigg [Tue, 13 Sep 2022 07:03:15 +0000 (09:03 +0200)]
[Bazel] Bump bazel version to 5.0.

See https://discourse.llvm.org/t/use-bazelisk-for-bazel-buildbots/65188.

Reviewed By: mehdi_amini

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

22 months ago[RISCV] Teach lowerVECTOR_SHUFFLE to recognize some shuffles as vnsrl.
Craig Topper [Tue, 13 Sep 2022 17:58:48 +0000 (10:58 -0700)]
[RISCV] Teach lowerVECTOR_SHUFFLE to recognize some shuffles as vnsrl.

Unary shuffles such as <0,2,4,6,8,10,12,14> or <1,3,5,7,9,11,13,15>
where half the elements are returned, can be lowered using vnsrl.

SelectionDAGBuilder lowers such shuffles as a build_vector of
extract_elements since the mask has less elements than the source.
To fix this, I've enable the extractSubvectorIsCheapHook to allow
DAGCombine to rebuild the shuffle using 2 extract_subvectors preceding
the shufffle.

I've gone very conservative on extractSubvectorIsCheapHook to minimize
test impact and match what we have test coverage for. This can be
improved in the future.

Reviewed By: reames

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

22 months ago[libc] Add POSIX functions dup, dup2, and GNU extension function dup3.
Siva Chandra Reddy [Tue, 13 Sep 2022 06:01:54 +0000 (06:01 +0000)]
[libc] Add POSIX functions dup, dup2, and GNU extension function dup3.

Reviewed By: lntue

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

22 months agoBe more careful to maintain quoting information when parsing commands.
Jim Ingham [Wed, 31 Aug 2022 17:13:05 +0000 (10:13 -0700)]
Be more careful to maintain quoting information when parsing commands.

This is particularly a problem for alias construction, where you might
want to have a backtick surrounded option in the alias.  Before this
patch:

command alias expression -Z \`argc\` -- argv

for instance would be rendered as:

expression -Z argc -- argv

and would fail to work.

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

22 months agoAdd pointer-to-member example to AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwa...
Scott Linder [Mon, 12 Sep 2022 22:53:52 +0000 (22:53 +0000)]
Add pointer-to-member example to AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md

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

22 months agoFix typo in AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Scott Linder [Mon, 12 Sep 2022 22:53:19 +0000 (22:53 +0000)]
Fix typo in AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md

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

22 months agodos2unix AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Scott Linder [Mon, 12 Sep 2022 22:52:51 +0000 (22:52 +0000)]
dos2unix AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md

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

22 months ago[RISCV] Implement isMaskAndCmp0FoldingBeneficial hook
Alex Bradbury [Tue, 13 Sep 2022 15:58:07 +0000 (16:58 +0100)]
[RISCV] Implement isMaskAndCmp0FoldingBeneficial hook

This hook is currently only used by CodeGenPrepare, which will sink *and
duplicate* an 'and' into a block that has an 'icmp 0' user of it if the
hook returns true.

This hook is less useful for RISC-V than for targets like AArch64 that
have a TBZ (test bit and branch if zero instruction), but may still be
profitable if Zbs is available and a BEXTI can be selected.

Conservatively, we return false even if Zbs is enabled for any masks
that fit in the ANDI immediate because it's possible the only use is a
branch on the result, and ANDI+BNEZ => BEXTI+BNEZ isn't a profitable
transformation.

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

22 months ago[gn build] port a3172df59c32 (check-lldb)
Zequan Wu [Fri, 9 Sep 2022 19:39:29 +0000 (12:39 -0700)]
[gn build] port a3172df59c32 (check-lldb)

https://reviews.llvm.org/rGa3172df59c32aac48c113eb7d6a1324aaa95c474 breaks
check-lldb gn build.

Reviewed By: thakis

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

22 months ago[lldb] Fixed a number of typos
Gabriel Ravier [Tue, 13 Sep 2022 16:32:02 +0000 (09:32 -0700)]
[lldb] Fixed a number of typos

I went over the output of the following mess of a command:

  (ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel
  --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E
  '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' |
  aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

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

22 months ago[MLIR] Remove unused lit test replacements.
Christian Sigg [Wed, 7 Sep 2022 09:31:31 +0000 (11:31 +0200)]
[MLIR] Remove unused lit test replacements.

The following replacements have been changed to `%mlir_lib_dir`:

- `%linalg_test_lib_dir`
- `%cuda_wrapper_library_dir`
- `%spirv_wrapper_library_dir`
- `%vulkan_wrapper_library_dir`
- `%mlir_runner_utils_dir`
- `%mlir_integration_test_dir`

If there are no requests to delay submission, I plan to submit this on 9/13/2002 (Tuesday).

See also PSA: https://discourse.llvm.org/t/psa-removing-mlir-lit-test-replacements/65124

Reviewed By: herhut

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

22 months ago[llvm-remarkutil] Make tryParseRemarksFromInputFile static
Jessica Paquette [Tue, 13 Sep 2022 17:19:17 +0000 (10:19 -0700)]
[llvm-remarkutil] Make tryParseRemarksFromInputFile static

All the functions in this file should be static to avoid ODR violations.

22 months ago[lld-macho] Sort data-in-code entries
Daniel Bertalan [Fri, 9 Sep 2022 15:18:10 +0000 (17:18 +0200)]
[lld-macho] Sort data-in-code entries

Previously, we would add entries to DataInCodeSection in the order they
appeared in input files. Because of this, entries would not be sorted if
sections were reordered due to e.g. `-order_file` or call graph profile
sorting. ld64 always keeps data-in-code information sorted.

This commit also fixes an incorrect assertion. The original assertion
from D103006 used to check that data-in-code entries are sorted in the
input objects -- likely because we use binary search on that data. In
D115556, the assertion was moved into `collectDataInCodeEntries`, but
the checked variable's name was not changed, so it ended up checking the
final contents of the DataInCodeSection.

We no longer crash when building LLVM with PGO using an asserts build of
LLD as the linker.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1265937

Numbers for linking the Chromium Framework reproducer from #48001, which
has 6829 data-in-code entries:

  x before
  + after
      N           Min           Max        Median           Avg        Stddev
  x  20     2.1076453     2.3059683     2.1132485     2.1350302   0.049905767
  +  20     2.1069031     2.3915262       2.14465     2.1728429   0.084065898
  No difference proven at 95.0% confidence

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

22 months ago[mlir][arith] Canonicalization patterns for subi.
Slava Zakharin [Fri, 9 Sep 2022 20:33:23 +0000 (13:33 -0700)]
[mlir][arith] Canonicalization patterns for subi.

subi(addi(a, b), b) -> a
subi(addi(a, b), a) -> b
subi(subi(a, b), a) -> subi(0, b)

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

22 months agolldb: Add support for R_386_32 relocations to ObjectFileELF
David M. Lary [Tue, 13 Sep 2022 15:26:32 +0000 (17:26 +0200)]
lldb: Add support for R_386_32 relocations to ObjectFileELF

I encountered an issue where `p &variable` was finding an incorrect address for
32-bit PIC ELF files loaded into a running process.  The problem was that the
R_386_32 ELF relocations were not being applied to the DWARF section, so all
variables in that file were reporting as being at the start of their respective
section.  There is an assert that catches this on debug builds, but silently
ignores the issue on non-debug builds.

In this changeset, I added handling for the R_386_32 relocation type to
ObjectFileELF, and a supporting function to ELFRelocation to differentiate
between DT_REL & DT_RELA in ObjectFileELF::ApplyRelocations().

Demonstration of issue:
```
[dmlary@host work]$ cat rel.c
volatile char padding[32] = "make sure var isnt at .data+0";
volatile char var[] = "test";
[dmlary@host work]$ gcc -c rel.c -FPIC -fpic -g -m32

[dmlary@host work]$ lldb ./exec
(lldb) target create "./exec"
Current executable set to '/home/dmlary/src/work/exec' (i386).
(lldb) process launch --stop-at-entry
Process 21278 stopped
* thread #1, name = 'exec', stop reason = signal SIGSTOP
    frame #0: 0xf7fdb150 ld-2.17.so`_start
ld-2.17.so`_start:
->  0xf7fdb150 <+0>: movl   %esp, %eax
    0xf7fdb152 <+2>: calll  0xf7fdb990                ; _dl_start

ld-2.17.so`_dl_start_user:
    0xf7fdb157 <+0>: movl   %eax, %edi
    0xf7fdb159 <+2>: calll  0xf7fdb140
Process 21278 launched: '/home/dmlary/src/work/exec' (i386)

(lldb) image add ./rel.o
(lldb) image load --file rel.o .text 0x40000000 .data 0x50000000
section '.text' loaded at 0x40000000
section '.data' loaded at 0x50000000

(lldb) image dump symtab rel.o
Symtab, file = rel.o, num_symbols = 13:
               Debug symbol
               |Synthetic symbol
               ||Externally Visible
               |||
Index   UserID DSX Type            File Address/Value Load Address       Size               Flags      Name
------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
[    0]      1     SourceFile      0x0000000000000000                    0x0000000000000000 0x00000004 rel.c
[    1]      2     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    2]      3     Invalid         0x0000000000000000 0x50000000 0x0000000000000020 0x00000003
[    3]      4     Invalid         0x0000000000000025                    0x0000000000000000 0x00000003
[    4]      5     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    5]      6     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    6]      7     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    7]      8     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    8]      9     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    9]     10     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   10]     11     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   11]     12   X Data            0x0000000000000000 0x50000000 0x0000000000000020 0x00000011 padding
[   12]     13   X Data            0x0000000000000020 0x50000020 0x0000000000000005 0x00000011 var

(lldb) p &var
(volatile char (*)[5]) $1 = 0x50000000
```

Reviewed By: labath

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

22 months ago[Vectorize] Fix a warning
Kazu Hirata [Tue, 13 Sep 2022 16:30:06 +0000 (09:30 -0700)]
[Vectorize] Fix a warning

This patch fixes:

  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5879:5: error:
  expression result unused [-Werror,-Wunused-value]

22 months ago[SimplifyCFG] Don't hoist allocas
Arthur Eubanks [Mon, 12 Sep 2022 22:05:00 +0000 (15:05 -0700)]
[SimplifyCFG] Don't hoist allocas

D129370 started hoisting allocas across stacksave/stackrestore
boundaries which is wrong.

Reviewed By: chill, rnk

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

22 months ago[SLP] Unify main/alternate selection for CmpInst instructions
Valery N Dmitriev [Tue, 6 Sep 2022 21:42:28 +0000 (14:42 -0700)]
[SLP] Unify main/alternate selection for CmpInst instructions

Make main/alternate operation selection logic for CmpInst
consistent across SLP vectorizer.

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

22 months ago[LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in Expand...
Craig Topper [Tue, 13 Sep 2022 16:07:56 +0000 (09:07 -0700)]
[LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in ExpandIntRes_ADDSUB.

This is the ultimate fallback code if UADDO isn't supported.

If the target uses 0/1 we used one compare, but if the target doesn't
use 0/1 we emitted two compares. Regardless of boolean constants we
should only need to check that the Result is less than one of the
original operands. So we only need one compare.

Reviewed By: spatel

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

22 months ago[ValueTypes] Define MVTs for v256i2/v128i4.
Hendrik Greving [Fri, 9 Sep 2022 17:32:52 +0000 (10:32 -0700)]
[ValueTypes] Define MVTs for v256i2/v128i4.

Adds MVT::v256i2, MVT::v128i4.

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

22 months ago[mlir] optional verbose debug messages for transform application
Alex Zinenko [Tue, 13 Sep 2022 14:24:51 +0000 (16:24 +0200)]
[mlir] optional verbose debug messages for transform application

Introduce the additional "transform-dialect-print-top-level-after-all" debug
category that allows the user to print the paylaod IR after each transformation
performed by the transform dialect. This is useful for understanding and
debugging the effects of individual transformations in complex transformations
scripts, including in downstreams, without having to modify the transformation
script itself.

Reviewed By: mravishankar

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

22 months ago[RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for...
Alex Bradbury [Tue, 13 Sep 2022 15:50:08 +0000 (16:50 +0100)]
[RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for resulting canonicalisation

As the Zbs extension includes bext[i] for bit extract, we can
unconditionally return true from this hook. This hook causes the DAG
combiner to perform the following canonicalisation:

  and (not (srl X, C)), 1 --> (and X, 1<<C) == 0
  and (srl (not X), C)), 1 --> (and X, 1<<C) == 0

As simply changing the hook causes a codegen regression, this patch also
modifies a BEXTI pattern to match this canonicalised form.

As BSETINVMask is now used for BEXT as well as BSET and BINV, it has
been renamed to the more generic SingleBitSetMask.

There is one codegen change in bittest.ll for bittest_31_i64 (NOT+BEXTI
rather than NOT+SRLIW). This is neutral in terms of code quality.

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

22 months ago[RISCV] Fix a bug in i32 FP_TO_UINT_SAT lowering on RV64.
Craig Topper [Tue, 13 Sep 2022 15:41:32 +0000 (08:41 -0700)]
[RISCV] Fix a bug in i32 FP_TO_UINT_SAT lowering on RV64.

We use the saturating behavior of fcvt.wu.h/s/d but forgot to
take into account that fcvt.wu will sign extend the saturated
result. According to computeKnownBits a promoted FP_TO_UINT_SAT
is expected to zero extend the saturated value.

In many case the upper bits aren't be demanded so this wouldn't
be an issue. But if we computeKnownBits caused an AND to be removed
it would be a bug.

This patch inserts an AND during to zero the upper bits.

Unfortunately, this pessimizes code if we aren't able to tell if
the upper bits are demanded. To fix that we could custom type
promote the FP_TO_UINT_SAT with SEXT_INREG after it, but I'll
leave that for future work.

I haven't found a failure from this, I was revisiting the code to
add vector support and spotted it.

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

22 months ago[mlir][Vector] Support broadcast vector type in distribution of vector.warp_execute_...
Nicolas Vasilache [Tue, 13 Sep 2022 07:51:56 +0000 (00:51 -0700)]
[mlir][Vector] Support broadcast vector type in  distribution of vector.warp_execute_on_lane_0.

This revision significantly improves and tests the broadcast behavior of vector.warp_execute_on_lane_0.

Previously, the implementation of the broadcast behavior of vector.warp_execute_on_lane_0
assumed that the broadcasted value was always of scalar type.

This is not necessarily the case.

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

22 months agoCorrect the __has_c_attribute value for fallthrough
Aaron Ballman [Tue, 13 Sep 2022 15:06:01 +0000 (11:06 -0400)]
Correct the __has_c_attribute value for fallthrough

The original proposal was seen in Apr 2019 and we accidentally used
that date (201904L) as the feature testing value. However, WG14 N2408
was adopted at the Oct 2019 meeting and so that's the correct date for
the feature testing macro. The committee draft for C2x shows 201910L
for this value, so this changes brings us in line with the standard.

22 months ago[mlir] improve the error message in expensive transform checks
Alex Zinenko [Tue, 13 Sep 2022 13:57:14 +0000 (15:57 +0200)]
[mlir] improve the error message in expensive transform checks

Include the transform op being applied when reporting it using an invalidated
handle. This was missing previously and made it harder for the user to
understand where the handle is being used, especially if the transform script
included some sort of iteration.

Reviewed By: guraypp

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

22 months ago[gn build] port 30578c08568bc
Nico Weber [Tue, 13 Sep 2022 14:48:33 +0000 (10:48 -0400)]
[gn build] port 30578c08568bc

22 months ago[AArch64] Sink splat(s/zext(..)) to uses
David Green [Tue, 13 Sep 2022 14:47:41 +0000 (15:47 +0100)]
[AArch64] Sink splat(s/zext(..)) to uses

If the Shuffle is a splat and the operand is a zext/sext, sinking the
operand and the s/zext can help create indexed s/umull. This is
especially useful to prevent i64 mul being scalarized.

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

22 months agoLiveRegUnits: Break register loop when a clobber is encountered
Matt Arsenault [Tue, 13 Sep 2022 13:57:22 +0000 (09:57 -0400)]
LiveRegUnits: Break register loop when a clobber is encountered

22 months ago[MLIR] Only substitute `mlir-spirv-cpu-runner` tool if enabled
Christian Sigg [Tue, 13 Sep 2022 07:32:54 +0000 (09:32 +0200)]
[MLIR] Only substitute `mlir-spirv-cpu-runner` tool if enabled

This tool is only used if `MLIR_ENABLE_SPIRV_CPU_RUNNER` was specified and should only be substituted in that case. Alternatively, we could make the substitution optional.

Reviewed By: mehdi_amini

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

22 months agoUpdate the C Status page for the Clang 15 release
Aaron Ballman [Tue, 13 Sep 2022 13:36:54 +0000 (09:36 -0400)]
Update the C Status page for the Clang 15 release

Now that Clang 15 is out, we can swap all the unreleased entries over.