platform/upstream/llvm.git
20 months ago[ADT] Remove redundant typename (NFC)
Kazu Hirata [Mon, 24 Oct 2022 07:14:56 +0000 (00:14 -0700)]
[ADT] Remove redundant typename (NFC)

20 months ago[LoongArch] Add support for ISD::FRAMEADDR and ISD::RETURNADDR
gonglingqin [Mon, 24 Oct 2022 06:49:04 +0000 (14:49 +0800)]
[LoongArch] Add support for ISD::FRAMEADDR and ISD::RETURNADDR

For now, only support lowering frame/return address for current frame.

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

20 months ago[mlir][Bazel] Port 3bef1e0f4c1d7fd901b58abe0c5c0e67da764ba2
Adrian Kuegel [Mon, 24 Oct 2022 07:10:30 +0000 (09:10 +0200)]
[mlir][Bazel] Port 3bef1e0f4c1d7fd901b58abe0c5c0e67da764ba2

20 months ago[mlir:LLVM] Add attribute/op definitions for debug info
River Riddle [Sat, 22 Oct 2022 21:13:20 +0000 (14:13 -0700)]
[mlir:LLVM] Add attribute/op definitions for debug info

This adds a subset of the necessary metadata for defining
debug info in the LLVM dialect. It doesn't import everything,
but just enough to start actually generating LLVM debug info
the expected way. Export/Import to LLVMIR will be added in a
followup.

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

20 months ago[mlir] Refactor alias generation to support nested aliases
River Riddle [Sat, 22 Oct 2022 21:01:41 +0000 (14:01 -0700)]
[mlir] Refactor alias generation to support nested aliases

We currently only support one level of aliases, which isn't great
in situations where an attribute/type can have multiple duplicated
components nested within it(e.g. debuginfo metadata). This commit
refactors alias generation to support nested aliases, which requires
changing alias grouping to take into account the depth of child
aliases, to ensure that attributes/types aren't printed before the
aliases they use.

The only real user facing change here was that we no longer print
0 as an alias suffix, which would be unnecessarily expensive to keep
in the new alias generation method (and isn't that valuable of a
behavior to preserve).

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

20 months ago[mlir] Better handling for bit groups in enum parser/printer
River Riddle [Sat, 22 Oct 2022 20:57:15 +0000 (13:57 -0700)]
[mlir] Better handling for bit groups in enum parser/printer

We currently wrap all multi-bit cases with a string, but this is
overly restrictive. This commit refactors to use keywords when
we know they are valid, and only degrade to string when the validity
of the bitgroup is unknown.

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

20 months ago[lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments
Michael Buch [Mon, 24 Oct 2022 06:42:01 +0000 (07:42 +0100)]
[lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments

Tests that `CPlusPlusLanguage::MethodName` can parse demangled
names that contain references to C-arrays.

Example taken from libcxx API in the wild.

20 months ago[LIT] Add AArch64/Windows to LP64 feature
Muhammad Omair Javaid [Mon, 17 Oct 2022 11:32:40 +0000 (16:32 +0500)]
[LIT] Add AArch64/Windows to LP64 feature

This patch adds AArch64 to the LP64 feature to avoid running LLP64
incompatible test on AArch64/Windows platform.

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

20 months ago[AMDGPU] Autogenerate icmp codegen test
Pierre van Houtryve [Fri, 21 Oct 2022 13:19:31 +0000 (13:19 +0000)]
[AMDGPU] Autogenerate icmp codegen test

Switch to autogenerated tests so we can use the same test for GISel and DAGIsel.

Reviewed By: arsenm

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

20 months ago[mlir] Fix a warning
Kazu Hirata [Mon, 24 Oct 2022 06:24:59 +0000 (23:24 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/IR/PatternMatch.h:1092:63: warning: parameter
  ‘values’ set but not used [-Wunused-but-set-parameter]

20 months ago[Clang] Change AnonStructIds in MangleContext to per-function based
Rong Xu [Mon, 24 Oct 2022 05:31:10 +0000 (22:31 -0700)]
[Clang] Change AnonStructIds in MangleContext to per-function based

Clang is generating different mangled names for the same lambda
function in slightly changed builds (like with non-related
source/Macro change). This is due to the fact that clang uses a
cross-translation-unit sequential string "$_<n>" in lambda's
mangled name. Here, "n" is the AnonStructIds field in MangleContext.

Different mangled names for a unchanged function is undesirable:
it makes perf comparison harder, and can cause some unnecessary
profile mismatch in SampleFDO.

This patch makes mangled name for lambda functions more stable
by changing AnonStructIds to a per-function based seq number if the
DeclContext is a function.

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

20 months ago[llvm-debuginfo-analyzer] Fix shared build. NFC.
Michael Liao [Mon, 24 Oct 2022 05:32:34 +0000 (01:32 -0400)]
[llvm-debuginfo-analyzer] Fix shared build. NFC.

20 months ago[llvm-debuginfo-analyzer] (06/09) - Warning and internal options
Carlos Alberto Enciso [Mon, 24 Oct 2022 04:55:47 +0000 (05:55 +0100)]
[llvm-debuginfo-analyzer] (06/09) - Warning and internal options

The 'clang-ppc64le-linux-multistage24452' buildbot fails with:

  https://lab.llvm.org/buildbot#builders/121/builds/24452
  undefined reference to `llvm::dwarf::TagString(unsigned int)'

Add 'DebugInfoDWARF' in the CMakeLists.txt CMake file.

20 months ago[NFC][X86] Fix typo: stric => strict
Sheng [Mon, 24 Oct 2022 04:56:26 +0000 (04:56 +0000)]
[NFC][X86] Fix typo: stric => strict

20 months ago[gn build] Port 2c155d379960
LLVM GN Syncbot [Mon, 24 Oct 2022 04:14:21 +0000 (04:14 +0000)]
[gn build] Port 2c155d379960

20 months ago[llvm-debuginfo-analyzer] (06/09) - Warning and internal options
Carlos Alberto Enciso [Fri, 21 Oct 2022 05:08:48 +0000 (06:08 +0100)]
[llvm-debuginfo-analyzer] (06/09) - Warning and internal options

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader

Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

Warning and internal options
- Support for '--warning' options.
- Support for '--internal' options.

Reviewed By: psamolysov, probinson

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

20 months ago[mlir] Support overriding LLVM_LIT_ARGS in standalone builds
Michał Górny [Sun, 23 Oct 2022 17:08:47 +0000 (19:08 +0200)]
[mlir] Support overriding LLVM_LIT_ARGS in standalone builds

Introduce LLVM_LIT_ARGS cache variable in standalone builds, to let
the caller override the options passed by LLVM to lit calls.  Once
defined, this is automatically handled by LLVM's cmake logic.

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

20 months ago[NFC][M68k] Update the status of ISA implementation
Sheng [Mon, 24 Oct 2022 01:37:48 +0000 (09:37 +0800)]
[NFC][M68k] Update the status of ISA implementation

LINK/UNLNK have been implemented in 64d326c33c6d3f008.

20 months ago[flang] Add atomic_define and atomic_ref to list of intrinsics
Katherine Rasmussen [Tue, 20 Sep 2022 22:35:48 +0000 (15:35 -0700)]
[flang] Add atomic_define and atomic_ref to list of intrinsics

Add the atomic subroutines, atomic_define and atomic_ref, to the
list of intrinsic subroutines. Add a new function
CheckAtomicDefineAndRef to check that for each of these procedures,
that their value arguments are the same type as their atom
arguments, and that their 3rd argument is not coindexed.

Reviewed By: PeteSteinfeld

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

20 months ago[clang] Fix time profile in "isIntegerConstantExpr"
Evgeny Shulgin [Sun, 23 Oct 2022 11:00:41 +0000 (11:00 +0000)]
[clang] Fix time profile in "isIntegerConstantExpr"

The time profiler in `Expr::isIntegerConstantExpr` used to
call `Loc->printToString`, it was inconsistent with other time
profiles in the file and caused segfaults if `Loc` was `nullptr`.

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

Reviewed By: dyung, jloser

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

20 months agollvm-reduce: Add conditional reduction passes
Matt Arsenault [Thu, 13 Oct 2022 21:42:15 +0000 (14:42 -0700)]
llvm-reduce: Add conditional reduction passes

Copy this technique from bugpoint. Before trying to blindly
delete blocks, try to fold branch conditions. This intuitively
makes more sense for a faster reduction, since you can find
dead paths in the function to prune out before trying to bisect
blocks in source order.

Seems to provide some speedup on my multi-hour reduction samples.

This does have the potential to produce testcases with unreachable
blocks. This is already a problem with the existing block
reduction pass. I'm struggling dealing with invalid reductions
in these cases, so in the future this should probably start
deleting those. However, I do sometimes try to reduce failures
in code that becomes unreachable, so I'm not totally sure
what to do here.

20 months agollvm-reduce: Fix opcode reduction leaving behind dead instructions
Matt Arsenault [Sat, 22 Oct 2022 16:38:33 +0000 (09:38 -0700)]
llvm-reduce: Fix opcode reduction leaving behind dead instructions

ce3c3cb2912425bb4367bfbe9a4c68a6d6f0a04a broke this by
speculatively making transforms before checking shouldKeep.
Originally I tried to roll back changes to the IR, but it's probably
best to not touch it before querying.

20 months ago[M68k][NFC] Use OS and ABI agnostic triple in codegen tests
Min-Yih Hsu [Sun, 23 Oct 2022 21:36:35 +0000 (14:36 -0700)]
[M68k][NFC] Use OS and ABI agnostic triple in codegen tests

Use 'm68k' (i.e. m68k-unknown-unknown) in all codegen tests rather
than m68k-linux-gnu. NFC.

20 months ago[gn build] Port 596fdf75d99f
LLVM GN Syncbot [Sun, 23 Oct 2022 22:17:33 +0000 (22:17 +0000)]
[gn build] Port 596fdf75d99f

20 months ago[gn build] Port 27902eea0f0a
LLVM GN Syncbot [Sun, 23 Oct 2022 22:17:32 +0000 (22:17 +0000)]
[gn build] Port 27902eea0f0a

20 months agoCodeExtractor: Fix assertion with non-0 alloca address spaces
Matt Arsenault [Wed, 19 Oct 2022 04:00:33 +0000 (21:00 -0700)]
CodeExtractor: Fix assertion with non-0 alloca address spaces

emitCallAndSwitchStatement creates placeholder allocas to pass
to these, so the types need to match.

20 months agollvm-reduce: Remove okToRemove logic in block reduction
Matt Arsenault [Tue, 18 Oct 2022 23:51:50 +0000 (16:51 -0700)]
llvm-reduce: Remove okToRemove logic in block reduction

This was making decisions based on BBsToDelete, while being
used to determine BBsToDelete which doesn't really work.
Additionally, this is a lot of logic just to avoid deleting
the entry block when we can just skip it.

20 months agollvm-reduce: Fix some broken test checks
Matt Arsenault [Sun, 23 Oct 2022 17:40:08 +0000 (10:40 -0700)]
llvm-reduce: Fix some broken test checks

20 months agollvm-reduce: Add a reduction to replace atomics with non-atomics
Matt Arsenault [Fri, 21 Oct 2022 21:59:07 +0000 (14:59 -0700)]
llvm-reduce: Add a reduction to replace atomics with non-atomics

Make load and store non-atomic. Make the others monotonic.

We could probably try to incrementally relax the orderings; not sure
how useful that would be.

20 months agollvm-reduce: Add atomic syncscope reduction
Matt Arsenault [Fri, 21 Oct 2022 21:45:28 +0000 (14:45 -0700)]
llvm-reduce: Add atomic syncscope reduction

20 months agollvm-reduce: Add volatile reduction pass
Matt Arsenault [Fri, 21 Oct 2022 21:03:51 +0000 (14:03 -0700)]
llvm-reduce: Add volatile reduction pass

Removing volatile may help optimization passes do more to the IR. However,
this will increase scheduler freedom.

20 months agollvm-reduce: Add flag reduction pass
Matt Arsenault [Fri, 21 Oct 2022 17:37:52 +0000 (10:37 -0700)]
llvm-reduce: Add flag reduction pass

Try to remove each flag from instructions. It may make more
sense to introduce these flags instead.

20 months agollvm-reduce: Don't use unreachable blocks in remove-bbs test
Matt Arsenault [Wed, 19 Oct 2022 17:59:34 +0000 (10:59 -0700)]
llvm-reduce: Don't use unreachable blocks in remove-bbs test

A future change will skip the reduction for functions with
unreachable blocks. Also stop using the hard to follow python based
interestingness check in favor of FileCheck.

20 months ago[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain
Petr Hosek [Fri, 7 Oct 2022 18:20:34 +0000 (18:20 +0000)]
[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain

All our users have migrated to ld64.lld so we no longer need libLTO.

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

20 months ago[ORC] Remove reference to incomplete type in debugging output.
Lang Hames [Sun, 23 Oct 2022 21:29:12 +0000 (14:29 -0700)]
[ORC] Remove reference to incomplete type in debugging output.

20 months ago[RISCV] Make selectShiftMask look for negate opportunities after looking through...
Craig Topper [Sun, 23 Oct 2022 21:08:31 +0000 (14:08 -0700)]
[RISCV] Make selectShiftMask look for negate opportunities after looking through AND.

Previously we would only look for an AND or a negate. But its
possible there is a negate after looking through the AND.

20 months agoRevert "[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation."
Alexander Kornienko [Sun, 23 Oct 2022 20:54:47 +0000 (22:54 +0200)]
Revert "[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation."

This reverts commit 74e4f778cf16cbf7163b5c6de6027a43f5e9169f, which caused a
~40% increase in SLoc address space utilization on certain cases. See
https://reviews.llvm.org/D136539#3877872.

20 months agoRevert "[TokenLexer][NFC] Rename the InstLoc to ExpandLoc"
Alexander Kornienko [Sun, 23 Oct 2022 20:52:39 +0000 (22:52 +0200)]
Revert "[TokenLexer][NFC] Rename the InstLoc to ExpandLoc"

This reverts commit f83347b0bedb22ea676861c8e4e2ed9c31371ade. This is necessary
to revert 74e4f778cf16cbf7163b5c6de6027a43f5e9169f, which caused a ~40% increase
in SLoc address space utilization on certain cases. See
https://reviews.llvm.org/D136539#3877872.

20 months ago[ORC] Reset MaterializationUnit::InitSymbol if the init symbol is discarded.
Lang Hames [Sun, 23 Oct 2022 20:26:24 +0000 (13:26 -0700)]
[ORC] Reset MaterializationUnit::InitSymbol if the init symbol is discarded.

Discarding the init symbol is expected to be uncommon (it represents metadata
in the MaterializationUnit that is relevant to dlopen, and this will not
usually be fully duplicated in some other location), however if a client has
marked an InitSymbol as weak and it is selected to be discarded then we should
keep the data structure consistent.

20 months ago[ORC] Force linking of eh-frame registration functions from LLJIT.cpp.
Lang Hames [Sun, 23 Oct 2022 20:07:52 +0000 (13:07 -0700)]
[ORC] Force linking of eh-frame registration functions from LLJIT.cpp.

Since aedeb8d5570, which switched to EPC-based eh-frame registrationin LLJIT,
the eh-frame registration functions need to be forcibly linked into the target
process.

Failure to link the eh-frame registration functions triggered a test failure in
https://green.lab.llvm.org/green/job/clang-stage1-RA/31497, which was fixed by
forcibly linking the registration functions into that test case in saf2b2214b4
(rdar://101083784), however it has also caused some tests (e.g. the C API unit
tests) that depend on successful construction of an LLJIT instance to be
skipped.

Moving the forcible registration into LLJIT.cpp fixes the general issue.

20 months ago[test] Use new pass manager syntax in some tests
Arthur Eubanks [Sun, 23 Oct 2022 20:43:39 +0000 (13:43 -0700)]
[test] Use new pass manager syntax in some tests

To prepare for upcoming change.

20 months ago[SLP][NFC] Added test to check resulting mask in shufflevector as per order of phinodes
skc7 [Sun, 23 Oct 2022 15:21:59 +0000 (15:21 +0000)]
[SLP][NFC] Added test to check resulting mask in shufflevector as per order of phinodes

Reviewed By: ABataev

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

20 months ago[X86] Add abs(sext_inreg(x)) test coverage for Issue #43370
Simon Pilgrim [Sun, 23 Oct 2022 17:15:58 +0000 (18:15 +0100)]
[X86] Add abs(sext_inreg(x)) test coverage for Issue #43370

20 months ago[mlir] Fix a warning
Kazu Hirata [Sun, 23 Oct 2022 17:11:20 +0000 (10:11 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp:128:10: warning:
  variable ‘llvm2xI32’ set but not used [-Wunused-but-set-variable]

The last use of llvm2xI32 was removed on July 6, 2022 in commit
63295622491a31eaccb6c534ba5caa836beb843f.

20 months ago[clang] Fix a warning
Kazu Hirata [Sun, 23 Oct 2022 16:34:49 +0000 (09:34 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/AST/Interp/ByteCodeExprGen.cpp:978:24: warning: variable
  ‘T’ set but not used [-Wunused-but-set-variable]

T and ReturnType were introduced on August 19, 2022 in commit
8e41e6a4eafa2b667ec37ece33a85493fe0156c2.

Their last uses were removed on October 13, 2022 in commit
0e754cfadc9487282d9b6119c41962c5c6c3660f.

20 months ago[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())
Simon Pilgrim [Sun, 23 Oct 2022 13:47:19 +0000 (14:47 +0100)]
[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())

On AVX512, extract legal bool vectors as bool subvectors before bitcasting to scalars to avoid spilling to stack.

This helps rust which internally represents bool vectors as bool arrays

It also exposes more missed opportunities to use the KADD instruction to add masks together before moving to gpr

Fixes #58546

20 months ago[tests] precommit tests for D136015
zhongyunde [Sat, 22 Oct 2022 12:30:29 +0000 (20:30 +0800)]
[tests] precommit tests for D136015

Address the commit https://reviews.llvm.org/D136015#inline-1313479

Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D136340

20 months ago[X86] Add test case for Issue #58546
Simon Pilgrim [Sun, 23 Oct 2022 13:27:37 +0000 (14:27 +0100)]
[X86] Add test case for Issue #58546

20 months ago[ADT] APInt.h - remove <cmath> include. NFC.
Simon Pilgrim [Sun, 23 Oct 2022 11:44:14 +0000 (12:44 +0100)]
[ADT] APInt.h - remove <cmath> include. NFC.

We only need this for std::abs, but since we're also testing the sign of the same value, then its not really necessary.

As detailed in https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html - APInt.h is the generic header with the highest expanded size, due to the dependency on <cmath>

20 months ago[ADT] APInt.cpp - remove <cstring> duplicate. NFC.
Simon Pilgrim [Sun, 23 Oct 2022 11:40:13 +0000 (12:40 +0100)]
[ADT] APInt.cpp - remove <cstring> duplicate. NFC.

This is already included in APInt.h

20 months ago[spirv] Remove unused include
Benjamin Kramer [Sun, 23 Oct 2022 11:23:40 +0000 (13:23 +0200)]
[spirv] Remove unused include

20 months ago[DAG] Add freeze(sign/zero_extend_vector_inreg(x)) -> sign/zero_extend_vector_inreg...
Simon Pilgrim [Sun, 23 Oct 2022 11:19:36 +0000 (12:19 +0100)]
[DAG] Add freeze(sign/zero_extend_vector_inreg(x)) -> sign/zero_extend_vector_inreg(freeze(x)) folding

20 months agoclean up std::iterator in LibcBenchmark.h
Schrodinger ZHU Yifan [Sun, 23 Oct 2022 10:30:37 +0000 (10:30 +0000)]
clean up std::iterator in LibcBenchmark.h

Reviewed By: gchatelet

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

20 months ago[libc] Add missing is_unsigned in type_traits.h
Guillaume Chatelet [Sun, 23 Oct 2022 10:08:44 +0000 (12:08 +0200)]
[libc] Add missing is_unsigned in type_traits.h

20 months ago[clang][unittest] Resolve ClangSupportTest link time errors
John McIver [Sun, 23 Oct 2022 09:53:17 +0000 (09:53 +0000)]
[clang][unittest] Resolve ClangSupportTest link time errors

Resolves undefined references to vtable for clang::ASTConsumer,
PCHContainerOperations::PCHContainerOperations(), and
CodeGenOptions::CodeGenOptions().

Reviewed By: Izaron

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

20 months ago[X86] Add test coverage for sign_extend_vector_inreg/zero_extend_vector_inreg with...
Simon Pilgrim [Sat, 22 Oct 2022 21:00:29 +0000 (22:00 +0100)]
[X86] Add test coverage for sign_extend_vector_inreg/zero_extend_vector_inreg with freeze

20 months ago[X86] Add freeze(pshufd/permilps(x,imm)) -> pshufd/permilps(freeze(x),imm) folding
Simon Pilgrim [Sat, 22 Oct 2022 20:33:37 +0000 (21:33 +0100)]
[X86] Add freeze(pshufd/permilps(x,imm)) -> pshufd/permilps(freeze(x),imm) folding

Add X86 isGuaranteedNotToBeUndefOrPoisonForTargetNode / canCreateUndefOrPoisonForTargetNode overrides and add X86ISD::PSHUFD/VPERMILPI handling.

20 months ago[X86] Add test coverage for permilps with freeze
Simon Pilgrim [Sat, 22 Oct 2022 20:21:51 +0000 (21:21 +0100)]
[X86] Add test coverage for permilps with freeze

Its going to be easier to add some basic target shuffle handling than generic ISD::SHUFFLE_VECTOR nodes which is going to need special handling for unused/undef operands.

Both freeze_pshufd and freeze_permilps tests lower to vpermilps, but only in domain switching later on.

20 months ago[mlir] Fix a warning
Kazu Hirata [Sun, 23 Oct 2022 08:03:56 +0000 (01:03 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/Tools/mlir-translate/Translation.h:93:35: warning:
  extra ‘;’ [-Wpedantic]

20 months ago[InstCombine] Bail out of casting calls when a conversion from/to byval is involved.
Mike Hommey [Sun, 23 Oct 2022 07:49:16 +0000 (09:49 +0200)]
[InstCombine] Bail out of casting calls when a conversion from/to byval is involved.

Fixes #58307

Reviewed By: nikic

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

20 months ago[ADT] Remove redundant typename (NFC)
Kazu Hirata [Sun, 23 Oct 2022 07:43:17 +0000 (00:43 -0700)]
[ADT] Remove redundant typename (NFC)

20 months ago[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.
Craig Topper [Sun, 23 Oct 2022 05:01:03 +0000 (22:01 -0700)]
[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.

If the divisor is even, we can first shift the dividend and divisor
right by the number of trailing zeros. Now the divisor is odd and we
can do the original algorithm to calculate a remainder. Then we shift
that remainder left by the number of trailing zeros and add the bits
that were shifted out of the dividend.

Reviewed By: RKSimon

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

20 months agoRevert "[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))"
Craig Topper [Sun, 23 Oct 2022 05:50:43 +0000 (22:50 -0700)]
Revert "[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))"

This reverts commit e8b3ffa532b8ebac5dcdf17bb91b47817382c14d.

The AMDGPU/mad_64_32.ll seems to fail on some of the build bots but
passes locally. I'm really confused.

20 months ago[RISCV] Fix unused variable warning. NFC
Craig Topper [Sun, 23 Oct 2022 05:28:57 +0000 (22:28 -0700)]
[RISCV] Fix unused variable warning. NFC

20 months ago[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))
Craig Topper [Sun, 23 Oct 2022 04:35:38 +0000 (21:35 -0700)]
[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))

(sra X, BW-1) is either 0 or -1. So the multiply is a conditional
negate of Y.

This pattern shows up when type legalizing wide multiplies involving
a sign extended value.

Fixes PR57549.

Reviewed By: RKSimon

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

20 months ago[Clang] fold expression is considered atomic during constraints normalization
Yuanfang Chen [Sun, 23 Oct 2022 03:17:06 +0000 (20:17 -0700)]
[Clang] fold expression is considered atomic during constraints normalization

`|| fold` is not disjunction; `&& fold` is not conjunction. Both are atomic per
current wording. See http://cplusplus.github.io/concepts-ts/ts-active.html#28.

D128750 accidentally tried to partially addresss this which is not desirable.
This patch reverts that part and associated test cases.

20 months ago[DAGCombiner][RISCV] Make foldBinOpIntoSelect work correctly with opaque constants.
Craig Topper [Sun, 23 Oct 2022 01:54:48 +0000 (18:54 -0700)]
[DAGCombiner][RISCV] Make foldBinOpIntoSelect work correctly with opaque constants.

The CanFoldNonConst doesn't work correctly with opaque constants
because getNode won't constant fold constants if one is opaque. Even
if the operation is AND/OR. This can lead to infinite loops.

This patch does the folding manually in the DAGCombine. Alternatively,
we could improve getNode but that seemed likely to have bigger impact
and possibly increase compile time for the additional checks. We wouldn't
want to directly constant fold because we need to preserve the opaque flag.

Fixes PR58511.

Reviewed By: spatel

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

20 months ago[SelectionDAG] Update stale comment on isOneOrOneSplat. NFC
Craig Topper [Sun, 23 Oct 2022 01:38:13 +0000 (18:38 -0700)]
[SelectionDAG] Update stale comment on isOneOrOneSplat. NFC

20 months ago[mlir][spirv] Add conversion from GPU WMMA ops to SPIRV Cooperative matrix
Nirvedh Meshram [Fri, 21 Oct 2022 00:32:17 +0000 (17:32 -0700)]
[mlir][spirv] Add conversion from GPU WMMA ops to SPIRV Cooperative matrix

Reviewed By: ThomasRaoux

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

20 months ago[Hexagon] Improve handling of 32-bit mulh/mul_lohi on HVX
Krzysztof Parzyszek [Wed, 12 Oct 2022 15:09:25 +0000 (08:09 -0700)]
[Hexagon] Improve handling of 32-bit mulh/mul_lohi on HVX

Handle MULH[US] by normalizing them into newly invented nodes
HexagonISD::(S|U|US)MUL_LOHI. On HVX v60, if only the high part of
SMUL_LOHI is used, use the original MULHS expansion. In all other
cases, expand the full product.
On HVX v62, always expand the full product.

Introduce Hexagon-specific LLVM IR intrinsics for 32x32 multiplication
returning low/high parts.

20 months ago[Hexagon] Use helper function introduced in prior commit, NFC
Krzysztof Parzyszek [Sat, 22 Oct 2022 22:05:38 +0000 (15:05 -0700)]
[Hexagon] Use helper function introduced in prior commit, NFC

20 months ago[RISCV] Make sure we always call tryShrinkShlLogicImm for ISD:AND during isel.
Craig Topper [Sat, 22 Oct 2022 21:25:17 +0000 (14:25 -0700)]
[RISCV] Make sure we always call tryShrinkShlLogicImm for ISD:AND during isel.

There was an early out that prevented us from calling this for
(and (sext_inreg (shl X, C1), i32), C2).

20 months agoFix #58322: Handlers for debug actions with equal parameter types must not override...
Tomás Longeri [Sat, 22 Oct 2022 21:17:49 +0000 (14:17 -0700)]
Fix #58322: Handlers for debug actions with equal parameter types must not override each other

Also clean up redundant public access specifiers.

Reviewed By: mehdi_amini, rriddle

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

20 months ago[libc] Add cpp::byte
Guillaume Chatelet [Wed, 19 Oct 2022 21:40:40 +0000 (21:40 +0000)]
[libc] Add cpp::byte

This provides the equivalent of std::byte.
std::byte is a distinct type that implements the concept of byte as specified in the C++ language definition.
https://en.cppreference.com/w/cpp/types/byte

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

21 months ago[mlir][tensor] ExtractSliceFromReshape: handle collapsing of unit dim edge cases
Christopher Bate [Sun, 16 Oct 2022 19:57:18 +0000 (13:57 -0600)]
[mlir][tensor] ExtractSliceFromReshape: handle collapsing of unit dim edge cases

Prior to this change, the "ExtractSliceFromReshape" pattern would transform

```
%collapsed = tensor.collapse_shape %input [[0, 1], [2]]
                : tensor<1x11x100xf32> into tensor<11x100xf32>
%slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 100] [1, 1]
                : tensor<11x100xf32> to tensor<?x100xf32>
```

into a loop that iterated over the range `%size - %offt`, that pieces
together multiple sub-slices of `%input` along the first dimension. This
is correct but obviously inefficient. The technical condition is that
collapsing at-most-one non-unit dimension of `%src` will not result in a
subsequent slice along the corresponding dimension of `%collapsed`
mapping across discontinuities in the index space of `%src`. Thus, the
definition of a "linearized dimension" (from the perspective of
`tensor.collapse_shape`) is updated to reflect this condition.

The transform will now generate

```
%slice = tensor.extract_slice %input [0, %offt, 0][1, %size, 100] [1, 1]
            : tensor<1x11x100xf32> to tensor<1x?x100xf32>
%result = tensor.collapse_shape [[0, 1], [2]]
            : tensor<1x?x100xf32> to tensor<?x100xf32>
```

which can be further canonicalized.

Additional tests are added to check this family of edge cases.

Reviewed By: ThomasRaoux

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

21 months ago[DAG] visitFREEZE - pull out Operands array. NFCI.
Simon Pilgrim [Sat, 22 Oct 2022 19:14:56 +0000 (20:14 +0100)]
[DAG] visitFREEZE - pull out Operands array. NFCI.

Initial tidyup and it will make it easier to adjust additional Operands in a future patch.

21 months ago[X86] Add test coverage for shuffle with freeze
Simon Pilgrim [Sat, 22 Oct 2022 19:12:32 +0000 (20:12 +0100)]
[X86] Add test coverage for shuffle with freeze

21 months ago[mlir][nfc] Fully spell mlir typename in generated code.
Ivan Butygin [Sat, 22 Oct 2022 17:39:18 +0000 (19:39 +0200)]
[mlir][nfc] Fully spell mlir typename in generated code.

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

21 months ago[DAG] canCreateUndefOrPoison - add freeze(fsh(x,y,z)) -> fsh(freeze(x),freeze(y)...
Simon Pilgrim [Sat, 22 Oct 2022 17:39:52 +0000 (18:39 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(fsh(x,y,z)) -> fsh(freeze(x),freeze(y),freeze(z)) support

The funnel-shift amount is always modulo, so won't introduce poison/undef

21 months ago[X86] Add test coverage for fshl/fshr with freeze
Simon Pilgrim [Sat, 22 Oct 2022 17:09:22 +0000 (18:09 +0100)]
[X86] Add test coverage for fshl/fshr with freeze

Unlike most other freeze tests in the file, this is showing a missing SimplifyDemandedBits simplification instead of a merge of the ops

21 months agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sat, 22 Oct 2022 16:29:40 +0000 (09:29 -0700)]
Ensure newlines at the end of files (NFC)

21 months ago[flang] Disable test until it can be properly configured
Peter Klausler [Sat, 22 Oct 2022 16:28:15 +0000 (09:28 -0700)]
[flang] Disable test until it can be properly configured

21 months ago[DAG] canCreateUndefOrPoison - add freeze(rot(x,y)) -> rot(freeze(x),freeze(y)) support
Simon Pilgrim [Sat, 22 Oct 2022 16:11:53 +0000 (17:11 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(rot(x,y)) -> rot(freeze(x),freeze(y)) support

The rotation amount is always modulo, so won't introduce poison/undef

21 months ago[llvm] Use llvm::is_contained (NFC)
Kazu Hirata [Sat, 22 Oct 2022 15:57:37 +0000 (08:57 -0700)]
[llvm] Use llvm::is_contained (NFC)

21 months ago[X86] Add test coverage for rotl/rotr with freeze
Simon Pilgrim [Sat, 22 Oct 2022 15:44:41 +0000 (16:44 +0100)]
[X86] Add test coverage for rotl/rotr with freeze

21 months agoRevert "[flang] Fix one Unexpectedly Passed test on X86"
Peixin Qiao [Sat, 22 Oct 2022 15:19:02 +0000 (23:19 +0800)]
Revert "[flang] Fix one Unexpectedly Passed test on X86"

This reverts commit c1bf4c3c5d8bac68e738d93c7dc28d9326410728.

21 months ago[clang][LTO][NFC] Adding More Tests for AIX Options
Qiongsi Wu [Sat, 22 Oct 2022 15:01:42 +0000 (11:01 -0400)]
[clang][LTO][NFC] Adding More Tests for AIX Options

This patch adds more tests for AIX. It follows https://reviews.llvm.org/D134820 which added a minimal set of tests for the newly added AIX options. These new tests were originally created by https://reviews.llvm.org/D119109. Since we do not plan to land https://reviews.llvm.org/D119109 in its current shape to add the AIX specific options, we incorporate the relevant tests developed.

Reviewed By: w2yehia

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

21 months ago[X86] Fix a missing `-` from AMX-FP16 feature string
Phoebe Wang [Sat, 22 Oct 2022 15:05:15 +0000 (23:05 +0800)]
[X86] Fix a missing `-` from AMX-FP16 feature string

Fixes #58545

21 months ago[InstCombine] use freeze to enable poison-safe logic->select fold
Sanjay Patel [Sat, 22 Oct 2022 14:12:34 +0000 (10:12 -0400)]
[InstCombine] use freeze to enable poison-safe logic->select fold

Without a freeze, this transform can leak poison to the output:
https://alive2.llvm.org/ce/z/GJuF9i

This makes the transform as uniform as possible, and it can help
reduce patterns like issue #58313 (although that particular
example probably still needs another transform).

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

21 months ago[InstCombine] add test for logical-ands to select; NFC
Sanjay Patel [Sat, 22 Oct 2022 13:07:21 +0000 (09:07 -0400)]
[InstCombine] add test for logical-ands to select; NFC

21 months ago[lld-macho][nfc] Use llvm::enumerate + destructuring in more places
Jez Ng [Sat, 22 Oct 2022 14:41:10 +0000 (10:41 -0400)]
[lld-macho][nfc] Use llvm::enumerate + destructuring in more places

I love C++17!

chromium_framework_less_dwarf on my 16-core Mac Pro shows no stat sig change in wall time but a slight decrease in user time:

```
           base           diff           difference (95% CI)
sys_time   1.759 ± 0.037  1.761 ± 0.033  [  -0.9% ..   +1.1%]
user_time  4.920 ± 0.043  4.886 ± 0.051  [  -1.2% ..   -0.2%]
wall_time  5.950 ± 0.117  5.900 ± 0.116  [  -1.8% ..   +0.2%]
samples    26             37
```

Reviewed By: #lld-macho, thakis

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

21 months ago[InstCombine][test] Add tests for mul combinations
Paweł Bylica [Sat, 22 Oct 2022 13:53:34 +0000 (13:53 +0000)]
[InstCombine][test] Add tests for mul combinations

Tests taken from https://reviews.llvm.org/D56214 and ported to
InstCombine for https://reviews.llvm.org/D136015.

21 months ago[DebugInfo] Fix potential CU mismatch for attachRangesOrLowHighPC
DianQK [Sat, 22 Oct 2022 12:39:21 +0000 (20:39 +0800)]
[DebugInfo] Fix potential CU mismatch for attachRangesOrLowHighPC

When a CU attaches some ranges for a subprogram or an inlined code, the CU should be that of the subprogram/inlined code that was emitted.
If not, then these emitted ranges will use the incorrect base of the CU in `emitRangeList`.

A reproducible example is:
When linking these two LLVM IRs,  dsymutil will report no mapping for range or inconsistent range data warnings.

`foo.swift`
```swift
import AppKit.NSLayoutConstraint

public class Foo {

    public var c: Int {
        get {
            Int(NSLayoutConstraint().constant)
        }
        set {
        }
    }

}
```

`main.swift`
```swift
// no mapping for range
let f: Foo! = nil
// inconsistent range data
//let l: Foo = Foo()
```

Reviewed By: dblaikie

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

21 months ago[NFC] Fixed several misspellings of "Splitter" in Scalarizer
Thomas Symalla [Sat, 22 Oct 2022 13:13:56 +0000 (15:13 +0200)]
[NFC] Fixed several misspellings of "Splitter" in Scalarizer

Spliiter => Splitter

21 months ago[InstCombine] allow more matches for logical-ands --> select
Sanjay Patel [Sat, 22 Oct 2022 11:55:19 +0000 (07:55 -0400)]
[InstCombine] allow more matches for logical-ands --> select

This allows patterns with real 'and' instructions because
those are safe to transform:
https://alive2.llvm.org/ce/z/7-U_Ak

21 months agoRevert "[MachineVerifier] Try harder to verify LiveVariables"
Jay Foad [Sat, 22 Oct 2022 11:17:09 +0000 (12:17 +0100)]
Revert "[MachineVerifier] Try harder to verify LiveVariables"

This reverts commit d4650d0938e290ca9d6544d6b07da2fb7156762d.

Reverted because it causes several X86 CodeGen test failures in a build
with LLVM_ENABLE_EXPENSIVE_CHECKS=ON.

21 months ago[lldb][Test] Add C-array test-cases to CPlusPlusNameParser unit-tests
Michael Buch [Sat, 22 Oct 2022 11:14:28 +0000 (12:14 +0100)]
[lldb][Test] Add C-array test-cases to CPlusPlusNameParser unit-tests

Make sure we test the code path where we parse
function templates instantiated with C-arrays.

21 months ago[flang] Fix one Unexpectedly Passed test on X86
Peixin Qiao [Sat, 22 Oct 2022 10:57:05 +0000 (18:57 +0800)]
[flang] Fix one Unexpectedly Passed test on X86

The test case, kinds04_q10.f90, should run only for X86. Now it is
unexpected passed since 8686ff1d0d47ba8c980f5ea6bb53f77786478e23.
Add "-triple x86_64-unknown-linux-gnu" so that the test is for
testing the target X86 linux.

21 months ago[X86] Add v2i64/v8i16/v16i8 + AVX2 coverage to saturated shift tests
Simon Pilgrim [Sat, 22 Oct 2022 10:35:37 +0000 (11:35 +0100)]
[X86] Add v2i64/v8i16/v16i8 + AVX2 coverage to saturated shift tests

To help better test the effects of D136478

21 months ago[clang][Interp][NFC] Unify Call() implementations
Timm Bäder [Thu, 13 Oct 2022 15:17:44 +0000 (17:17 +0200)]
[clang][Interp][NFC] Unify Call() implementations

The type parameter we used to pass to call() was unused. Use the same
implementation for void and value-returning function calls.