platform/upstream/llvm.git
21 months agoRevert "Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify"
Florian Hahn [Mon, 17 Oct 2022 11:48:50 +0000 (12:48 +0100)]
Revert "Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify"

This reverts commit 333246b48ea4a70842e78c977cc92d365720465f.

It looks like this patch causes a mis-compile:
https://github.com/llvm/llvm-project/issues/58401

Fixes #58401.

21 months ago[flang][OpenMP] Fix the use-associated bug in threadprivate directive lowering
Peixin Qiao [Mon, 17 Oct 2022 11:46:18 +0000 (19:46 +0800)]
[flang][OpenMP] Fix the use-associated bug in threadprivate directive lowering

The symbol may be used by use-association for multiple times such
as one in module specification part and one in module procedure.
Then in module procedure, the variable instantiation will be called
for multiple times. But we only need to threadprivatize it once and
use the threadprivatized value for the second time.

Fix #58379.

Reviewed By: kiranchandramohan

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

21 months ago[LoopFlatten] Enable it by default
Sjoerd Meijer [Mon, 17 Oct 2022 09:06:30 +0000 (14:36 +0530)]
[LoopFlatten] Enable it by default

LoopFlatten has been in the code base off by default for years, but this
enables it to run by default. Downstream this has been running for
years, so it has been exposed to quite some code. Then around the time
we switched to the NPM, several fixes went in related to updating the
MemorySSA state and we moved it to a loop pass manager, which both
helped preventing rerunning certain analysis passes, and thus helped a
bit with compile-times.

About compile-times, adding a pass isn't free, but this should see only
very minor increases. The pass is relatively simple and there shouldn't
be anything algorithmically expensive because all it does is looking at
inner/outer loops and it checks assumptions on loop increments and
indices. If we see increases, I expect this to mainly come from
invalidation of analysis info, and perhaps subsequent passes to trigger
and do more. Despite its simplicity/restrictions, it triggers in most
code-bases, which makes it worth to enable this by default.

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

21 months ago[demangler] Simplify OutputBuffer initialization
Nathan Sidwell [Mon, 28 Feb 2022 18:13:44 +0000 (10:13 -0800)]
[demangler] Simplify OutputBuffer initialization

Every non-testcase use of OutputBuffer contains code to allocate an
initial buffer (using either 128 or 1024 as initial guesses). There's
now no need to do that, given recent changes to the buffer extension
heuristics -- it allocates a 1k(ish) buffer on first need.

Just pass in a buffer (if any) to the constructor.  Thus the
OutputBuffer's ownership of the buffer starts at its own lifetime
start. We can reduce the lifetime of this object in several cases.

That new constructor takes a 'size_t *' for the size argument, as all
uses with a non-null buffer are passing through a malloc'd buffer from
their own caller in this manner.

The buffer reset member function is never used, and is deleted.

Some adjustment to a couple of uses is needed, due to the lazy buffer
creation of this patch.

a) the Microsoft demangler can demangle empty strings to nothing,
which it then memoizes.  We need to avoid the UB of passing nullptr to
memcpy.

b) a unit test checks insertion of no characters into an empty buffer.
We need to avoid UB when converting that to std::string.

The original buffer initialization code would return a failure code if
that first malloc failed.  Existing code either ignored that, called
std::terminate with a FIXME, or returned an error code.

But that's not foolproof anyway, as a subsequent buffer extension
failure ends up calling std::terminate. I am working on addressing
that unfortunate failure mode in a manner more consistent with the C++
ABI design.

Reviewed By: dblaikie

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

21 months agoRevert "[llvm] Remove redundaunt typename (NFC)"
David Spickett [Mon, 17 Oct 2022 10:55:50 +0000 (10:55 +0000)]
Revert "[llvm] Remove redundaunt typename (NFC)"

This reverts commit 3577e606dad0fa8f54e29e24673ff63bb7dfa880.

Due to buildbot failures on Arm and Arm64.

https://lab.llvm.org/buildbot/#/builders/96/builds/30231

21 months agoRevert "[lldb] Use std::underlying_type_t (NFC)"
David Spickett [Mon, 17 Oct 2022 10:55:19 +0000 (10:55 +0000)]
Revert "[lldb] Use std::underlying_type_t (NFC)"

This reverts commit 921a4d5be4bbe3c337419dfcc313b3eb892c2870.

Due to buildbot failures on Arm and Arm64.

https://lab.llvm.org/buildbot/#/builders/96/builds/30231

21 months ago[compiler-rt] Relax pthread_getaffinity test to account for cgroups/docker
David Spickett [Tue, 11 Oct 2022 14:44:11 +0000 (14:44 +0000)]
[compiler-rt] Relax pthread_getaffinity test to account for cgroups/docker

Fixes #58283

When running in a docker container you can have fewer cores assigned
to you than get_nrpoc would suggest.

Since the test just wants to know that interception worked, allow
any result > 0 and <= the global core count.

Reviewed By: MaskRay, vitalybuka

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

21 months ago[mlir] Simplify DestinationStyleOpInterface.
Alexander Belyaev [Fri, 14 Oct 2022 17:59:55 +0000 (19:59 +0200)]
[mlir] Simplify DestinationStyleOpInterface.

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

21 months ago[BasicAA] Support loop phis in pointsToConstantMemory()
Nikita Popov [Mon, 17 Oct 2022 10:34:55 +0000 (12:34 +0200)]
[BasicAA] Support loop phis in pointsToConstantMemory()

When looking for underlying objects, if we encounter one that we
have already seen, then we should skip it (as it has already been
checked) rather than bail out. In particular, this adds support
for the case where we have a loop use of a phi recurrence.

21 months ago[BasicAA] Add tests for constant memory with loop phi (NFC)
Nikita Popov [Mon, 17 Oct 2022 10:31:02 +0000 (12:31 +0200)]
[BasicAA] Add tests for constant memory with loop phi (NFC)

21 months ago[AMDGPU] Common up some generated checks in fnearbyint.ll
Jay Foad [Mon, 17 Oct 2022 10:01:56 +0000 (11:01 +0100)]
[AMDGPU] Common up some generated checks in fnearbyint.ll

Also remove -mattr=-flat-for-global which is not needed for generated
checks.

21 months ago[flang] Introduce option to lower expression to HLFIR
Jean Perier [Mon, 17 Oct 2022 07:57:16 +0000 (09:57 +0200)]
[flang] Introduce option to lower expression to HLFIR

Preliminary work on HLFIR. Introduce option that will allow testing
lowering via HLFIR until this is ready to replace the current expression
lowering.

See https://reviews.llvm.org/D134285 for more context about the plan.

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

21 months ago[NFC] Judge if we have std c++ modules in RenderModulesOptions
Chuanqi Xu [Mon, 17 Oct 2022 07:48:13 +0000 (15:48 +0800)]
[NFC] Judge if we have std c++ modules in RenderModulesOptions

This patch moves the judgement if the std c++ modules feature is enabled
into the RenderModulesOptions function. It simplify the code a little
bit further more. It also helps further patches.

21 months ago[Test] Add tests showing that instcombine does not deal with freeze(load !range)
Max Kazantsev [Mon, 17 Oct 2022 05:08:49 +0000 (12:08 +0700)]
[Test] Add tests showing that instcombine does not deal with freeze(load !range)

21 months ago[Test][NFC] Regenerate test check using update_tests script
Max Kazantsev [Mon, 17 Oct 2022 05:07:46 +0000 (12:07 +0700)]
[Test][NFC] Regenerate test check using update_tests script

21 months ago[C++20] [Coroutines] Add ReleaseNotes about addressing thread identifiaction problems
Chuanqi Xu [Mon, 17 Oct 2022 02:46:07 +0000 (10:46 +0800)]
[C++20] [Coroutines] Add ReleaseNotes about addressing thread identifiaction problems

The thread identification problems in coroutines are addressed now in
1cedc51ff5a2a4f51a4c7e8bb04bd. Although the original problem occurs in
LLVM optimizer. The C++ users have strong feeling about it. So it may be
necessary to add a ReleaseNote in clang for it.

Closes https://github.com/llvm/llvm-project/issues/47177
Closes https://github.com/llvm/llvm-project/issues/47179

21 months ago[Coroutines] Don't merge readnone calls in presplit coroutines
Chuanqi Xu [Mon, 17 Oct 2022 02:22:43 +0000 (10:22 +0800)]
[Coroutines] Don't  merge readnone calls in presplit coroutines

Another alternative to fix the thread identification problem in
coroutines.

We plan to fix this problem by unifying memory effecting attributes. See
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579.
But it may be a long-term project. And it is a pity that the coroutines
can't resume in different threads for years. So this one is temporary
fix. It may cause unnecessary performance regression for coroutines. But
correctness are more important. And this one is planned to be reverted
after we are able to unify the memory effecting attributes actually.

Reviewed By: jdoerfert, rjmccall

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

21 months ago[clang][PowerPC] PPC64 VAArg fix right-alignment for aggregates fit in register
Ting Wang [Mon, 17 Oct 2022 02:01:47 +0000 (22:01 -0400)]
[clang][PowerPC] PPC64 VAArg fix right-alignment for aggregates fit in register

PPC64 ABI pass aggregates smaller than a register into the least
significant bits of the register. In the case of variadic functions,
they will end up right-aligned in their argument slots in the argument
area on big-endian targets. Apply right-alignment for these aggregates.

Fixes #55900.

Reviewed By: rjmccall

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

21 months ago[llvm] Use llvm::find (NFC)
Kazu Hirata [Sun, 16 Oct 2022 23:21:00 +0000 (16:21 -0700)]
[llvm] Use llvm::find (NFC)

21 months ago[ConstraintElim] Fix signed integer overflow for inbounds GEP.
Florian Hahn [Sun, 16 Oct 2022 22:24:06 +0000 (23:24 +0100)]
[ConstraintElim] Fix signed integer overflow for inbounds GEP.

For inbounds GEPs, signed overflow yields poison, so it is fine for the
coefficients to wrap as well. This fixes an UBSan failure.

21 months ago[mlir][ods] Support default-valued attributes in optional groups
rkayaith [Fri, 14 Oct 2022 18:21:44 +0000 (14:21 -0400)]
[mlir][ods] Support default-valued attributes in optional groups

Add support for default-valued attributes as optional-group anchors. The
attribute is considered present if it holds a non-default value.

Reviewed By: Mogball

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

21 months ago[ConstraintElim] Replace custom GEP index handling by using existing code
Florian Hahn [Sun, 16 Oct 2022 20:53:11 +0000 (21:53 +0100)]
[ConstraintElim] Replace custom GEP index handling by using existing code

Instead of duplicating the existing decomposition code for GEP indices
just use the existing code by calling the existing decompose function on
the index expression and multiply the result's coefficients by the scale of
the index.

This both reduces code duplication and generalizes the pattern we can
handle.

21 months ago[CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
Fangrui Song [Sun, 16 Oct 2022 20:15:44 +0000 (13:15 -0700)]
[CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX

When Clang is used as a cross compiler, it should respect the target
platform default. Defaulting to a configure-time CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
does not make much sense.

When Clang is used as a single-platform compiler, we should use Clang
configuration file (https://discourse.llvm.org/t/configuration-files/42529
https://clang.llvm.org/docs/UsersManual.html#configuration-files).

The Gentoo needs from D34365 has been satisfied by a configuration file.

Reviewed By: mgorny

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

21 months ago[ELF] Remove RelocationScanner::target. NFC
Fangrui Song [Sun, 16 Oct 2022 19:39:37 +0000 (12:39 -0700)]
[ELF] Remove RelocationScanner::target. NFC

21 months ago[clang] Use llvm::find (NFC)
Kazu Hirata [Sun, 16 Oct 2022 19:33:47 +0000 (12:33 -0700)]
[clang] Use llvm::find (NFC)

21 months ago[ConstraintElim] Support `add nsw` for unsigned preds with positive ops.
Florian Hahn [Sun, 16 Oct 2022 19:24:16 +0000 (20:24 +0100)]
[ConstraintElim] Support `add nsw` for unsigned preds with positive ops.

If both operands of an `add nsw` are known positive, it can be treated
the same as `add nuw` and added to the unsigned system.

https://alive2.llvm.org/ce/z/6gprff

21 months ago[NFC][X86] Test commit, add test with bad mask vector legalization
Roman Lebedev [Sun, 16 Oct 2022 18:38:59 +0000 (21:38 +0300)]
[NFC][X86] Test commit, add test with bad mask vector legalization

Inspired by codegen of `@test`
from `llvm/test/Analysis/CostModel/X86/masked-interleaved-*-i16.ll`.

21 months ago[ELF] Move R_TPREL/R_TPREL_NEG check into handleTlsRelocation
Fangrui Song [Sun, 16 Oct 2022 19:19:57 +0000 (12:19 -0700)]
[ELF] Move R_TPREL/R_TPREL_NEG check into handleTlsRelocation

21 months ago[ELF] Set DF_STATIC_TLS for AArch64/PPC32/PPC64
Fangrui Song [Sun, 16 Oct 2022 19:08:08 +0000 (12:08 -0700)]
[ELF] Set DF_STATIC_TLS for AArch64/PPC32/PPC64

21 months ago[ELF][test] Improve AArch64 TLS IE tests
Fangrui Song [Sun, 16 Oct 2022 18:55:38 +0000 (11:55 -0700)]
[ELF][test] Improve AArch64 TLS IE tests

21 months ago[BPF] Add (failing) testcase for Issue #57872
Simon Pilgrim [Sun, 16 Oct 2022 17:15:44 +0000 (18:15 +0100)]
[BPF] Add (failing) testcase for Issue #57872

21 months ago[clang] Use std::clamp (NFC)
Kazu Hirata [Sun, 16 Oct 2022 17:11:29 +0000 (10:11 -0700)]
[clang] Use std::clamp (NFC)

Note that the constructor of MipsABIInfo guarantees that
MinABIStackAlignInBytes <= StackAlignInBytes, so we can use std::clamp
safely.

21 months ago[AMDGPU] Use llvm::any_of (NFC)
Kazu Hirata [Sun, 16 Oct 2022 16:19:09 +0000 (09:19 -0700)]
[AMDGPU] Use llvm::any_of (NFC)

21 months ago[clang] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 16 Oct 2022 16:19:08 +0000 (09:19 -0700)]
[clang] Use llvm::is_contained (NFC)

21 months ago[mlir][sparse] Move routines for generating memref.alloca to CodegenUtils.
bixia1 [Thu, 13 Oct 2022 15:34:36 +0000 (08:34 -0700)]
[mlir][sparse] Move routines for generating memref.alloca to CodegenUtils.

This is to allow the use of the routines in the rewrite pass.

Reviewed By: aartbik

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

21 months ago[InstCombine] try to determine "exact" for sdiv
Sanjay Patel [Sun, 16 Oct 2022 14:01:10 +0000 (10:01 -0400)]
[InstCombine] try to determine "exact" for sdiv

If the divisor is a power-of-2 or negative-power-of-2 and the dividend
is known to have >= trailing zeros than the divisor, the division is exact:
https://alive2.llvm.org/ce/z/UGBksM (general proof)
https://alive2.llvm.org/ce/z/D4yPS- (examples based on regression tests)

This isn't the most direct optimization (we could create ashr in these
examples instead of relying on existing folds for exact divides), but
it's possible that there's a more general constraint than just a pow2
divisor, so this might be extended in the future.

This should solve issue #58348.

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

21 months ago[InstCombine] add tests for sdiv with (neg)pow2 divisor; NFC
Sanjay Patel [Fri, 14 Oct 2022 16:23:16 +0000 (12:23 -0400)]
[InstCombine] add tests for sdiv with (neg)pow2 divisor; NFC

21 months ago[InstCombine] use isKnownNonNegative() for readability; NFCI
Sanjay Patel [Fri, 14 Oct 2022 14:47:16 +0000 (10:47 -0400)]
[InstCombine] use isKnownNonNegative() for readability; NFCI

This should be functionally equivalent - both calls are thin
wrappers around computeKnownBits(). We'll probably want to use
known-bits directly in follow-up patches because that could
determine "exact" for example (see issue #58348).

21 months ago[ConstraintElim] Add tests for add nsw with unsigned predicates.
Florian Hahn [Sun, 16 Oct 2022 14:51:33 +0000 (15:51 +0100)]
[ConstraintElim] Add tests for add nsw with unsigned predicates.

21 months ago[mlir][sparse] Add readCOOElement for reading a sparse tensor element from files.
bixia1 [Fri, 14 Oct 2022 23:39:54 +0000 (16:39 -0700)]
[mlir][sparse] Add readCOOElement for reading a sparse tensor element from files.

Use the routine for openSparseTensorCOO and getSparseTensorReaderNext.

Reviewed By: aartbik, wrengr

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

21 months ago[OpenMP][OpenMPIRBuilder] Migrate OffloadEntriesInfoManager from clang to OMPIRbuilder
Jan Sjodin [Wed, 12 Oct 2022 17:57:15 +0000 (13:57 -0400)]
[OpenMP][OpenMPIRBuilder] Migrate OffloadEntriesInfoManager from clang to OMPIRbuilder

This patch moves the implementation of the OffloadEntriesInfoManager
to the OMPIRbuilder. This class will later be used by flang as well.

    Reviewed By: jdoerfert

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

21 months ago[ELF] Move inputSections/ehInputSections into Ctx. NFC
Fangrui Song [Sun, 16 Oct 2022 07:49:48 +0000 (00:49 -0700)]
[ELF] Move inputSections/ehInputSections into Ctx. NFC

21 months ago[clang] Use llvm::reverse (NFC)
Kazu Hirata [Sun, 16 Oct 2022 04:54:13 +0000 (21:54 -0700)]
[clang] Use llvm::reverse (NFC)

21 months ago[mlir] Remove redundaunt typename (NFC)
Kazu Hirata [Sun, 16 Oct 2022 04:07:03 +0000 (21:07 -0700)]
[mlir] Remove redundaunt typename (NFC)

21 months ago[clang] Remove redundaunt typename (NFC)
Kazu Hirata [Sun, 16 Oct 2022 04:07:02 +0000 (21:07 -0700)]
[clang] Remove redundaunt typename (NFC)

21 months ago[AArch64][GlobalISel] When lowering signext i1 parameters, don't zero-extend to s8...
Amara Emerson [Mon, 5 Sep 2022 20:53:41 +0000 (21:53 +0100)]
[AArch64][GlobalISel] When lowering signext i1 parameters, don't zero-extend to s8 first.

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

21 months ago[CodeGen] Using ZExt for extractelement indices.
Peter Rong [Tue, 30 Aug 2022 21:55:59 +0000 (14:55 -0700)]
[CodeGen] Using ZExt for extractelement indices.

In https://github.com/llvm/llvm-project/issues/57452, we found that IRTranslator is translating `i1 true` into `i32 -1`.
This is because IRTranslator uses SExt for indices.

In this fix, we change the expected behavior of extractelement's index, moving from SExt to ZExt.
This change includes both documentation, SelectionDAG and IRTranslator.
We also included a test for AMDGPU, updated tests for AArch64, Mips, PowerPC, RISCV, VE, WebAssembly and X86

This patch fixes issue #57452.

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

21 months ago[libc++] Improve error message for invalid allocators
Nikolas Klauser [Wed, 12 Oct 2022 18:24:04 +0000 (20:24 +0200)]
[libc++] Improve error message for invalid allocators

Reviewed By: ldionne, #libc

Spies: libcxx-commits, rupprecht

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

21 months ago[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}
Kazu Hirata [Sat, 15 Oct 2022 22:06:37 +0000 (15:06 -0700)]
[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}

This patch introduces:

  StringRef::starts_with
  StringRef::starts_with_insensitive
  StringRef::ends_with
  StringRef::ends_with_insensitive

to be more compatible with std::string and std::string_view.

I'm planning to deprecate the existing functions in favor of the new
ones.

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

21 months ago[clangd] Use std::decay_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:59:23 +0000 (14:59 -0700)]
[clangd] Use std::decay_t (NFC)

21 months ago[Vectorize] Use std::conditional_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:52:25 +0000 (14:52 -0700)]
[Vectorize] Use std::conditional_t (NFC)

21 months ago[ADT] Simplify getAsInteger and consumeInteger (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:08:01 +0000 (14:08 -0700)]
[ADT] Simplify getAsInteger and consumeInteger (NFC)

This patch replaces the std::enable_if_t trick with a "constexpr if"
so that the resulting code looks more like "normal" C++ code.

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

21 months ago[Driver] Remove legacy cc1 alias -mlink-cuda-bitcode
Fangrui Song [Sat, 15 Oct 2022 21:02:13 +0000 (14:02 -0700)]
[Driver] Remove legacy cc1 alias -mlink-cuda-bitcode

r340193 added -mlink-builtin-bitcode as the canonical spelling.

21 months ago[ConstraintElim] Support unsigned decomposition of mul/shl nuw..const
Florian Hahn [Sat, 15 Oct 2022 20:28:07 +0000 (21:28 +0100)]
[ConstraintElim] Support unsigned decomposition of mul/shl nuw..const

Support decomposition for `mul/shl nuw` with constant operand for unsigned
queries. Those expressions should not wrap in the unsigned sense and can
be added directly to the unsigned system.

21 months ago[clang] Track the templated entity in type substitution.
Matheus Izvekov [Sun, 14 Aug 2022 11:48:18 +0000 (13:48 +0200)]
[clang] Track the templated entity in type substitution.

This is a change to how we represent type subsitution in the AST.
Instead of only storing the replaced type, we track the templated
entity we are substituting, plus an index.
We modify MLTAL to track the templated entity at each level.

Otherwise, it's much more expensive to go from the template parameter back
to the templated entity, and not possible to do in some cases, as when
we instantiate outer templates, parameters might still reference the
original entity.

This also allows us to very cheaply lookup the templated entity we saw in
the naming context and find the corresponding argument it was replaced
from, such as for implementing template specialization resugaring.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D131858

21 months ago[clang] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:50:34 +0000 (12:50 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/Sema/SemaLambda.cpp:922:39: warning: suggest parentheses
  around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[clang] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:48:23 +0000 (12:48 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/Basic/SourceManager.cpp:2131:72: warning: suggest
  parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[Object] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:43:12 +0000 (12:43 -0700)]
[Object] Fix a warning

This patch fixes:

  llvm/lib/Object/XCOFFObjectFile.cpp:1001:20: warning: suggest
  parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[mlir] Fix warnings
Kazu Hirata [Sat, 15 Oct 2022 19:40:02 +0000 (12:40 -0700)]
[mlir] Fix warnings

This patch fixes:

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:171:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:283:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[lldb] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:32:20 +0000 (12:32 -0700)]
[lldb] Fix a warning

This patch fixes:

  lldb/source/Commands/CommandObjectThread.cpp:66:61: warning:
  comparison of unsigned expression in ‘< 0’ is always false
  [-Wtype-limits]

21 months ago[llvm-reduce] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:28:11 +0000 (12:28 -0700)]
[llvm-reduce] Fix a warning

This patch fixes:

  llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp:96:21: warning:
  unused variable ‘Op’ [-Wunused-variable]

21 months ago[llvm] Remove redundaunt typename (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:59 +0000 (12:11 -0700)]
[llvm] Remove redundaunt typename (NFC)

21 months ago[mlir] Use std::underlying_type_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:58 +0000 (12:11 -0700)]
[mlir] Use std::underlying_type_t (NFC)

21 months ago[lldb] Use std::underlying_type_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:56 +0000 (12:11 -0700)]
[lldb] Use std::underlying_type_t (NFC)

21 months ago[ConstraintElim] Support signed decomposition of `add nsw`.
Florian Hahn [Sat, 15 Oct 2022 17:34:02 +0000 (18:34 +0100)]
[ConstraintElim] Support signed decomposition of `add nsw`.

Add support decomposition for `add nsw` for signed queries.
`add nsw` won't wrap and can be directly added to the signed
system.

21 months ago[Mips] Regenerate unalignedload.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:29:54 +0000 (18:29 +0100)]
[Mips] Regenerate unalignedload.ll

21 months ago[Mips] Regenerate return-struct.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:21:45 +0000 (18:21 +0100)]
[Mips] Regenerate return-struct.ll

21 months ago[Mips] Regenerate load-store-left-right.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:20:26 +0000 (18:20 +0100)]
[Mips] Regenerate load-store-left-right.ll

21 months ago[libc][cleanup] Docs clean up
Jeff Bailey [Sat, 15 Oct 2022 12:44:02 +0000 (12:44 +0000)]
[libc][cleanup] Docs clean up

 * Make consistent heading names
 * Factor out |check| into an include for reuse
 * Use it everywhere (No more YES or UTF-8)
 * Remove unneeded summary from pages. People know why they're there.
 * Ensure source location headers everywhere.

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

21 months ago[clang] Fix func-attr.c test
Yi Kong [Sat, 15 Oct 2022 14:10:53 +0000 (23:10 +0900)]
[clang] Fix func-attr.c test

The test was introduced by 84a9ec2ff1ee. The check is over-specific and
is broken on the Android buildbot. Fixed by relaxing the variable name
check.

21 months ago[LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags
wanglei [Sat, 15 Oct 2022 09:44:40 +0000 (17:44 +0800)]
[LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags

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

21 months ago[mlir][vector] Add a name prefix to tablegen for IteratorType in Vector dialect.
Oleg Shyshkov [Sat, 15 Oct 2022 07:01:29 +0000 (07:01 +0000)]
[mlir][vector] Add a name prefix to tablegen for IteratorType in Vector dialect.

Otherwise there is a risk of a name collision with IteratorType attributes in other dialect.

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

21 months ago[scudo] Fix implicitly narrow casting (NFC)
Chia-hung Duan [Fri, 14 Oct 2022 06:36:47 +0000 (06:36 +0000)]
[scudo] Fix implicitly narrow casting (NFC)

u16 may be promoted to int by arithmetic type conversion. Do an explicit
cast to avoid certain compiler's warning. This fixes the problem
introduced by 0fb2aeef5310eaba2915b30810464a744a80da15

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

21 months ago[objcopy][MachO] Clean up Section ctors, NFC
Alexander Shaposhnikov [Fri, 14 Oct 2022 22:37:35 +0000 (22:37 +0000)]
[objcopy][MachO] Clean up Section ctors, NFC

21 months ago[mlir:ODS] Disambiguate getContext call for the rare case of the op having an input...
Benjamin Kramer [Fri, 14 Oct 2022 23:56:01 +0000 (01:56 +0200)]
[mlir:ODS] Disambiguate getContext call for the rare case of the op having an input called context

21 months ago[VE] Change the way to lower select
Kazushi (Jam) Marukawa [Thu, 13 Oct 2022 14:11:48 +0000 (23:11 +0900)]
[VE] Change the way to lower select

Change to use VEISD::CMOV in combineSelect for better optimization.
Support VEISD::CMOV in combineTRUNCATE also to optimize trancate.
Merge functions to handle condition codes to VE.h.  And add basic
CMOV patterns to VEInstrInfo.td.  Update regression tests also.

Reviewed By: efocht

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

21 months ago[Hexagon] Clean up leftover instructions in HvxIdioms
Krzysztof Parzyszek [Fri, 14 Oct 2022 23:42:42 +0000 (16:42 -0700)]
[Hexagon] Clean up leftover instructions in HvxIdioms

Quick and dirty fix, because this is causing one builder to fail.

21 months ago[mlir][llvm] NoSideEffect -> Pure (NFC)
Jeff Niu [Fri, 14 Oct 2022 23:29:12 +0000 (16:29 -0700)]
[mlir][llvm] NoSideEffect -> Pure (NFC)

21 months ago[mlir][llvm] Add `llvm.intr.is.fpclass`
Jeff Niu [Fri, 14 Oct 2022 16:00:01 +0000 (09:00 -0700)]
[mlir][llvm] Add `llvm.intr.is.fpclass`

This intrinsic allows testing for inf, nan, etc. on floating point
values.

Reviewed By: rriddle

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

21 months ago[mlir][vector] Add distribution for extract from 0d vector
Thomas Raoux [Fri, 14 Oct 2022 23:04:24 +0000 (23:04 +0000)]
[mlir][vector] Add distribution for extract from 0d vector

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

21 months ago[mlir:ODS] Generate unwrapped operation attribute setters
River Riddle [Thu, 13 Oct 2022 01:01:03 +0000 (18:01 -0700)]
[mlir:ODS] Generate unwrapped operation attribute setters

This allows for setting an attribute using the underlying C++ type,
which is generally much nicer to interact with than the attribute type.

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

21 months ago[lldb][Breakpoint] Fix setting breakpoints on templates by basename
Michael Buch [Thu, 13 Oct 2022 21:20:23 +0000 (22:20 +0100)]
[lldb][Breakpoint] Fix setting breakpoints on templates by basename

This patch fixes a regression with setting breakpoints on template
functions by name. E.g.,:
```
$ cat main.cpp
template<typename T>
struct Foo {
  template<typename U>
  void func() {}
};

int main() {
  Foo<int> f;
  f.func<double>();
}

(lldb) br se -n func
```

This has regressed since `3339000e0bda696c2e29173d15958c0a4978a143`
where we started using the `CPlusPlusNameParser` for getting the
basename of the function symbol and match it exactly against
the name in the breakpoint command. The parser will include template
parameters in the basename, so the exact match will always fail

**Testing**

* Added API tests
* Added unit-tests

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

21 months ago[github] Fix minor lint warnings (NFC)
Keith Smiley [Sun, 9 Oct 2022 05:34:34 +0000 (22:34 -0700)]
[github] Fix minor lint warnings (NFC)

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

21 months ago[github] Update pip deps (NFC)
Keith Smiley [Sun, 9 Oct 2022 05:33:23 +0000 (22:33 -0700)]
[github] Update pip deps (NFC)

Minor dep updates identified in https://github.com/llvm/llvm-project/issues/57907

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

21 months ago[Hexagon] Report if changes were made in HvxIdioms pass
Krzysztof Parzyszek [Fri, 14 Oct 2022 22:44:24 +0000 (15:44 -0700)]
[Hexagon] Report if changes were made in HvxIdioms pass

This should fix
```
Pass modifies its input and doesn't report it: Hexagon Vector Combine
Pass modifies its input and doesn't report it UNREACHABLE executed at
[...hecks-debian/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1436!
```

21 months ago[llvm-objdump/mac] Add new function starts print mode
Keith Smiley [Sat, 5 Feb 2022 02:07:12 +0000 (18:07 -0800)]
[llvm-objdump/mac] Add new function starts print mode

This updates the `--function-starts` argument to now accept 3 different
modes, `addrs` for just printing the addresses of the function starts
(previous behavior), `names` for just printing the names of the function
starts, and `both` to print them both side by side.

In general if you're debugging function starts issues it's useful to see
the symbol name alongside the address. This also mirrors Apple's
`dyldinfo -function_starts` command which prints both.

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

21 months ago[llvm-objcopy][MachO] Add support for LC_DYLIB_CODE_SIGN_DRS
Keith Smiley [Fri, 14 Oct 2022 20:40:20 +0000 (13:40 -0700)]
[llvm-objcopy][MachO] Add support for LC_DYLIB_CODE_SIGN_DRS

This allows binaries containing the LC_DYLIB_CODE_SIGN_DRS to be
objcopy'd and stripped.

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

21 months ago[lldb][NFCish] Move DWARFDebugInfoEntry::GetQualifiedName() into DWARFASTParserClang
Arthur Eubanks [Thu, 4 Aug 2022 00:09:40 +0000 (17:09 -0700)]
[lldb][NFCish] Move DWARFDebugInfoEntry::GetQualifiedName() into DWARFASTParserClang

In D134378, we'll need the clang AST to be able to construct the qualified in some cases.

This makes logging in one place slightly less informative.

Reviewed By: dblaikie, Michael137

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

21 months agoRevert "[PGO] Make emitted symbols hidden"
Zequan Wu [Fri, 14 Oct 2022 22:22:26 +0000 (15:22 -0700)]
Revert "[PGO] Make emitted symbols hidden"

This reverts commit ecac223b0e4b05a65cf918f90824380db6b9ce64.

The commit causes instrprof-darwin-dead-strip.c to fail on mac.

21 months ago[Hexagon] Recognize idioms for fixed-point vector multiplication
Krzysztof Parzyszek [Wed, 28 Sep 2022 14:57:08 +0000 (07:57 -0700)]
[Hexagon] Recognize idioms for fixed-point vector multiplication

Recognize Q.15*Q.15 and Q.31*Q.31, with and without rounding.

21 months ago[clang-doc] Add typedef/using information.
Brett Wilson [Fri, 14 Oct 2022 21:28:43 +0000 (14:28 -0700)]
[clang-doc] Add typedef/using information.

Read typedef and "using" type alias declarations and serialize into the
internal structures. Emit this information in the YAML output. The HTML
and MD generators are unchanged.

Separate out the logic to create the parent namespace or record object
and insert the newly created child into it. This logic was previously
duplicated for every "info" type and is now shared.

To help this, a struct containing the child vectors was separated out so
children can be added generically and without having too many templates.

A small change was made to populateParentNamespaces() to allow using
types that aren't themselves DeclContexts (typedefs are the first
example of this).

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

21 months ago[RISCV] Merge rv32 and rv64 fixed vector stepvector tests
Philip Reames [Fri, 14 Oct 2022 21:53:51 +0000 (14:53 -0700)]
[RISCV] Merge rv32 and rv64 fixed vector stepvector tests

21 months ago[clang][Sema] Use size of char in bits for void types
Bill Wendling [Fri, 14 Oct 2022 21:20:54 +0000 (14:20 -0700)]
[clang][Sema] Use size of char in bits for void types

The extension that allows for pointer arithmetic on 'void' types treats
the 'void' as a 'char'. We should use the 'char' size in bits instead of
1 (the number of bytes) to allow warning when pointer arithmetic would
go out of bounds.

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

21 months agoReapply [AArch64] Fix aligning the stack after calling __chkstk
Martin Storsjö [Tue, 11 Oct 2022 12:20:59 +0000 (15:20 +0300)]
Reapply [AArch64] Fix aligning the stack after calling __chkstk

Whenever a call to __chkstk was made, the frame lowering previously
omitted the aligning (as NumBytes was reset to zero before doing
alignment).

This fixes https://github.com/llvm/llvm-project/issues/56182.

The initial version of this produced invalid code for small
functions with no local stack allocations, if those functions
were marked with the "stackrealign" attribute. If building
with -mstack-alignment=16 (which otherwise mostly would be a
no-op), this attribute is added on the main function.

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

21 months ago[Hexagon] Fix isTypeForHVX for vector predicates
Krzysztof Parzyszek [Mon, 10 Oct 2022 22:53:10 +0000 (15:53 -0700)]
[Hexagon] Fix isTypeForHVX for vector predicates

HexagonSubtarget::isTypeFixHVX would stop breaking the type up when it
reached 64 bits in width. HVX vector predicates can be shorter than that,
for example <32 x i1> would have a bitwidth of 32, and it's still a valid
HVX type.

21 months ago[mlir][sparse] Reorganize tests for the sparse_tensor.convert operator.
bixia1 [Thu, 13 Oct 2022 21:43:07 +0000 (14:43 -0700)]
[mlir][sparse] Reorganize tests for the sparse_tensor.convert operator.

Rename conversion_sparse2dense.mlir and conversion_sparse2sparse.mlir to
convert_sparse2dense.mlir/sparse2sparse.mlir.

Add convert_dense2sparse.mlir. Move the sparse_tensor.convert operator tests
out of conversion.mlir.

Reviewed By: aartbik

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

21 months ago[clang][macho] Add support for -darwin-target-variant-sdk-version in cc1as
Daniel Rodríguez Troitiño [Tue, 11 Oct 2022 23:38:39 +0000 (16:38 -0700)]
[clang][macho] Add support for -darwin-target-variant-sdk-version in cc1as

D121868 provided support for -darwin-target-variant-triple, but the
support for -darwin-target-variant-sdk-version was still missing for
cc1as. These changes build upon the previous and provides such support.

- Extracted the common code to handle -darwin-target-variant-triple and
  -darwin-target-variant-sdk-version in the Darwin toolchain to a method
  that can be used for both the cc1 and the cc1as job construction.
  cc1as does not support some of the parameters that were provided to
  cc1, so the same code cannot be used for both.
- Invoke that new common code when constructing a cc1as invocation.
- Parse the new -darwin-target-variant-sdk-version in the cc1as driver.
  Apply its value to the MCObjectFileInfo to generate the right values
  in the object files.
- Includes two new tests that check that cc1as uses the provided values
  in -darwin-target-variant-sdk and that the Clang driver creates the
  jobs with the correct arguments.

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

21 months ago[llvm-cov] Allow branch coverage to be skipped when exporting for LCOV
Alan Phipps [Fri, 14 Oct 2022 21:08:34 +0000 (16:08 -0500)]
[llvm-cov] Allow branch coverage to be skipped when exporting for LCOV

This small patch adds a '--skip-branches' option to the llvm-cov export
options. This option allows branch coverage information to be skipped from the
exported LCOV directives if it's not needed. For now, this only works when
exporting LCOV (which is noted in the option description), but it can be
extended for JSON later if it makes sense.

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

21 months ago[Hexagon] Lower funnel shifts for HVX
Krzysztof Parzyszek [Mon, 10 Oct 2022 22:52:38 +0000 (15:52 -0700)]
[Hexagon] Lower funnel shifts for HVX

HVX v62+ has bidirectional shifts, which do not mask the shift amount to
the bit width. Instead, the shift amount is sign-extended from the log(BW)
bit value, and a negative value causes a shift in the other direction.
For the shift amount being -log(BW), this reversed shift will shift all
bits out, inserting 0s or sign bits depending on the type and direction.

21 months ago[Loop] Move block and loop dispo invalidation to makeLoopInvariant.
Florian Hahn [Fri, 14 Oct 2022 20:58:14 +0000 (21:58 +0100)]
[Loop] Move block and loop dispo invalidation to makeLoopInvariant.

makeLoopInvariant may recursively move its operands to make them
invariant, before moving the passed in instruction. Those recursively
moved instructions are currently missed when invalidating block and loop
dispositions.

To address this, move the invalidation code to Loop::makeLoopInvariant.

Fixes #58314.

Reviewed By: nikic

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