platform/upstream/llvm.git
2 years ago[InstCombine] fold icmp equality with udiv and large constant
Sanjay Patel [Thu, 26 May 2022 12:23:36 +0000 (08:23 -0400)]
[InstCombine] fold icmp equality with udiv and large constant

With large compare constant:
(X u/ Y) == C --> (X == C) && (Y == 1)
(X u/ Y) != C --> (X != C) || (Y != 1)

https://alive2.llvm.org/ce/z/EhKwh6

There are various potential missing icmp (div) transforms shown here:
https://github.com/llvm/llvm-project/issues/55695

This is a generalization for part of the udiv + equality.
I didn't check in detail, but some of those may only make sense as
codegen transforms.

This results in one extra instruction in IR, but it is better for
analysis, and looks much better in codegen on all targets that I tried.

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

2 years ago[InstCombine] add tests for icmp with udiv operand; NFC
Sanjay Patel [Wed, 25 May 2022 18:22:56 +0000 (14:22 -0400)]
[InstCombine] add tests for icmp with udiv operand; NFC

This covers a generalization of one of the transforms
suggested in #55695.

2 years ago[libc++abi] Use from-scratch testing configs for libc++abi by default
Louis Dionne [Mon, 9 May 2022 15:54:10 +0000 (11:54 -0400)]
[libc++abi] Use from-scratch testing configs for libc++abi by default

Like we have been doing for libc++ for a while now, start using
from-scratch testing configurations for libc++abi.

As a fly-by fix, remove the LIBCXXABI_NO_TIMER macro, which was defined
but never used.

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

2 years ago[DAG] Generalize (sra (trunc (sra x, c1)), c2) -> (trunc (sra x, c1 + c2)) constant...
Simon Pilgrim [Thu, 26 May 2022 13:05:00 +0000 (14:05 +0100)]
[DAG] Generalize (sra (trunc (sra x, c1)), c2) -> (trunc (sra x, c1 + c2)) constant folding

Remove local (uniform) constant folding and rely on getNode() to perform it

Minor cleanup step toward adding non-uniform shift amount support

2 years ago[clang-format] Fix QualifierAlignment with global namespace qualified types.
Marek Kurdej [Fri, 20 May 2022 22:05:51 +0000 (00:05 +0200)]
[clang-format] Fix QualifierAlignment with global namespace qualified types.

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

Reviewed By: MyDeveloperDay

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

2 years agoFix failing test case with strict prototype changes
Aaron Ballman [Thu, 26 May 2022 12:46:11 +0000 (08:46 -0400)]
Fix failing test case with strict prototype changes

Amends 681c50c62e9338afdf58ebfd663f8e3ff43439fb and hopefully fixes:

https://lab.llvm.org/buildbot/#/builders/109/builds/39347
https://lab.llvm.org/buildbot/#/builders/188/builds/14634
and others

2 years agoImprove the strict prototype diagnostic behavior
Aaron Ballman [Thu, 26 May 2022 11:52:19 +0000 (07:52 -0400)]
Improve the strict prototype diagnostic behavior

Post-commit feedback on https://reviews.llvm.org/D122895 pointed out
that the diagnostic wording for some code was using "declaration" in a
confusing way, such as:

int foo(); // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x

int foo(int arg) { // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x
  return 5;
}

And that we had other minor issues with the diagnostics being somewhat
confusing.

This patch addresses the confusion by reworking the implementation to
be a bit more simple and a bit less chatty. Specifically, it changes
the warning and note diagnostics to be able to specify "declaration" or
"definition" as appropriate, and it changes the function merging logic
so that the function without a prototype is always what gets warned on,
and the function with a prototype is sometimes what gets noted.
Additionally, when diagnosing a K&R C definition that is preceded by a
function without a prototype, we don't note the prior declaration, we
warn on it because it will also be changing behavior in C2x.

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

2 years ago[analyzer][solver] Handle UnarySymExpr in SMTConv
Gabor Marton [Fri, 13 May 2022 13:52:48 +0000 (15:52 +0200)]
[analyzer][solver] Handle UnarySymExpr in SMTConv

Dependent patch adds UnarySymExpr, now I'd like to handle that for SMT
conversions like refutation.

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

2 years ago[analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver
Gabor Marton [Wed, 11 May 2022 15:40:25 +0000 (17:40 +0200)]
[analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

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

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

2 years ago[analyzer] Add UnarySymExpr
Gabor Marton [Tue, 10 May 2022 15:13:07 +0000 (17:13 +0200)]
[analyzer] Add UnarySymExpr

This patch adds a new descendant to the SymExpr hierarchy. This way, now
we can assign constraints to symbolic unary expressions. Only the unary
minus and bitwise negation are handled.

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

2 years ago[analyzer] Return from reAssume if State is posteriorly overconstrained
Gabor Marton [Wed, 25 May 2022 19:27:29 +0000 (21:27 +0200)]
[analyzer] Return from reAssume if State is posteriorly overconstrained

Depends on D124758. That patch introduced serious regression in the run-time in
some special cases. This fixes that.

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

2 years ago[AMDGPU][GFX9] Support base+soffset+offset SMEM loads.
Ivan Kosarev [Thu, 26 May 2022 11:41:55 +0000 (12:41 +0100)]
[AMDGPU][GFX9] Support base+soffset+offset SMEM loads.

Resolves part of
https://github.com/llvm/llvm-project/issues/38652

Reviewed By: dp

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

2 years agoUse the canonical type when matching a generic selection association
Aaron Ballman [Thu, 26 May 2022 11:40:10 +0000 (07:40 -0400)]
Use the canonical type when matching a generic selection association

This ensures that a deduced type like __auto_type matches the correct
association instead of matching all associations.

This addresses a regression from e4a42c5b64d044ae28d9483b0ebd12038d5b5917

Fixes #55702

2 years ago[DAG] Cleanup "and/or of cmp with single bit diff" fold to use ISD::matchBinaryPredicate
Simon Pilgrim [Thu, 26 May 2022 11:34:02 +0000 (12:34 +0100)]
[DAG] Cleanup "and/or of cmp with single bit diff" fold to use ISD::matchBinaryPredicate

Prep work as I'm investigating some cases where TLI::convertSetCCLogicToBitwiseLogic should accept vectors.

2 years ago[FileCheck] GetCheckTypeAbbreviation() to handle the misspelled case.
Ivan Kosarev [Thu, 26 May 2022 11:20:15 +0000 (12:20 +0100)]
[FileCheck] GetCheckTypeAbbreviation() to handle the misspelled case.

Also fix directives not covered by D125604.

2 years ago[MachineSink] replace MachineLoop with MachineCycle
Chen Zheng [Tue, 19 Apr 2022 07:40:17 +0000 (03:40 -0400)]
[MachineSink] replace MachineLoop with MachineCycle

reapply 62a9b36fcf728b104ea87e6eb84c0be69b779df7 and fix module build
failue:
1: remove MachineCycleInfoWrapperPass in MachinePassRegistry.def
   MachineCycleInfoWrapperPass is a anylysis pass, should not be there.
2: move the definition for MachineCycleInfoPrinterPass to cpp file.

Otherwise, there are module conflicit for MachineCycleInfoWrapperPass
in MachinePassRegistry.def and MachineCycleAnalysis.h after
62a9b36fcf728b104ea87e6eb84c0be69b779df7.

MachineCycle can handle irreducible loop. Natural loop
analysis (MachineLoop) can not return correct loop depth if
the loop is irreducible loop. And MachineSink is sensitive
to the loop depth, see MachineSinking::isProfitableToSinkTo().

This patch tries to use MachineCycle so that we can handle
irreducible loop better.

Reviewed By: sameerds, MatzeB

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

2 years ago[FileCheck] Catch missspelled directives.
Ivan Kosarev [Thu, 26 May 2022 08:48:01 +0000 (09:48 +0100)]
[FileCheck] Catch missspelled directives.

Reviewed By: MaskRay

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

2 years ago[mlir] Use-after-free checker for the Transform dialect
Alex Zinenko [Wed, 25 May 2022 13:57:22 +0000 (15:57 +0200)]
[mlir] Use-after-free checker for the Transform dialect

The Transform dialect uses the side effect modeling mechanism to record the
effects of the transform ops on the mapping between Transform IR values and
Payload IR ops. Introduce a checker pass that warns if a Transform IR value is
used after it has been freed (consumed). This pass is mostly intended as a
debugging aid in addition to the verification/assertion mechanisms in the
transform interpreter. It reports all potential use-after-free situations.
The implementation makes a series of simplifying assumptions to be simple and
conservative. A more advanced implementation would rely on the data flow-like
analysis associated with a side-effect resource rather than a value, which is
currently not supported by the analysis infrastructure.

Reviewed By: springerm

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

2 years ago[X86] Add non-uniform vector tests for 'one bit diff' comparison fold
Simon Pilgrim [Thu, 26 May 2022 10:13:13 +0000 (11:13 +0100)]
[X86] Add non-uniform vector tests for 'one bit diff' comparison fold

2 years ago[AArch64] Add additional tests for sinking free shuffles for FMAs.
Florian Hahn [Thu, 26 May 2022 09:35:38 +0000 (10:35 +0100)]
[AArch64] Add additional tests for sinking free shuffles for FMAs.

2 years ago[llvm][DWARF] Move test using X86 triple into X86 tests
David Spickett [Thu, 26 May 2022 09:27:23 +0000 (09:27 +0000)]
[llvm][DWARF] Move test using X86 triple into X86 tests

Fixes failure seen when building without X86 backend:
https://lab.llvm.org/buildbot/#/builders/171/builds/15124

2 years ago[AArch64] Costmodel tests for llvm.vscale intrinsics. NFC
David Green [Thu, 26 May 2022 09:16:21 +0000 (10:16 +0100)]
[AArch64] Costmodel tests for llvm.vscale intrinsics. NFC

These shows that the cost of a @llvm.vscale is indeed 1, not 10.

2 years ago[RISCV][NFC] Add braces to 'else' to match braced 'if'
Fraser Cormack [Thu, 26 May 2022 09:00:33 +0000 (10:00 +0100)]
[RISCV][NFC] Add braces to 'else' to match braced 'if'

2 years ago[gn build] Port 569d6630204d
LLVM GN Syncbot [Thu, 26 May 2022 08:51:13 +0000 (08:51 +0000)]
[gn build] Port 569d6630204d

2 years ago[libc++] Implement ranges::equal
Nikolas Klauser [Wed, 25 May 2022 09:09:43 +0000 (11:09 +0200)]
[libc++] Implement ranges::equal

Reviewed By: var-const, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[SimpleLoopUnswitch] Always skip trivial select and set condition.
Florian Hahn [Thu, 26 May 2022 08:46:23 +0000 (09:46 +0100)]
[SimpleLoopUnswitch] Always skip trivial select and set condition.

When updating the branch instruction outside the loopduring non-trivial
 unswitching, always skip trivial selects and update the condition.

Otherwise we might create invalid IR, because the trivial select is
inside the loop, while the condition is outside the loop.

Fixes #55697.

2 years ago[RISCV] Fix state persistence bugs (PR55548)
Kito Cheng [Fri, 20 May 2022 02:47:15 +0000 (10:47 +0800)]
[RISCV] Fix state persistence bugs (PR55548)

We didn't implement RISCVELFStreamer::reset and cause some very strange
section output for attribute section...just reference D15950 to see how
ARM implement that.

Reviewed By: MaskRay

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

2 years ago[LV] Fix indentation in tryToCreateWidenRecipe (NFC).
Florian Hahn [Thu, 26 May 2022 07:53:33 +0000 (08:53 +0100)]
[LV] Fix indentation in tryToCreateWidenRecipe (NFC).

2 years agoRevert "Defer source path remap tilde expansion until source file use"
Jason Molenda [Thu, 26 May 2022 07:46:54 +0000 (00:46 -0700)]
Revert "Defer source path remap tilde expansion until source file use"

This reverts commit c274b6e5830ea88d3f55d6dc1d2b99e38cf6595e.

The x86_64 debian bot got a failure with this patch,
https://lab.llvm.org/buildbot#builders/68/builds/33078
where
SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
is crashing here -

 #2 0x0000000000425a9f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f57160e9140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007f570d911e43 lldb_private::SourceManager::GetFile(lldb_private::FileSpec const&) crtstuff.c:0:0
 #5 0x00007f570d914270 lldb_private::SourceManager::DisplaySourceLinesWithLineNumbers(lldb_private::FileSpec const&, unsigned int, unsigned int, unsigned int, unsigned int, char const*, lldb_private::Stream*, lldb_private::SymbolContextList const*) crtstuff.c:0:0
 #6 0x00007f570da662c8 lldb_private::StackFrame::GetStatus(lldb_private::Stream&, bool, bool, bool, char const*) crtstuff.c:0:0

I don't get a failure here my mac, I'll review this method more
closely tomorrow.

2 years agoDefer source path remap tilde expansion until source file use
Jason Molenda [Thu, 26 May 2022 07:30:12 +0000 (00:30 -0700)]
Defer source path remap tilde expansion until source file use

When reading source path remappings out of a dSYM, lldb currently
does tilde expansion -- expanding the tilde-username and checking
that the destination pathname exists, for each dSYM with the path
remappings.  This cost happens during lldb's initial process launch
/ load, an especially perf-sensitive time.  Inside Apple, we have
dSYMs with source path remappings pointing to NFS directories where
these extra stats for every dSYM can be very expensive if the network
is slow.

This patch instead keeps the source path mapping in the original
tilde-username terms and does the tilde expansion when we need
to read a specific source file from one of the modules.  We'll
be stat'ing all of those inodes to load the source file anyway,
so the fact that we do the tilde expansion on every source file
we load, it doesn't cost us significantly.

Differential Revision: https://reviews.llvm.org/D126435
rdar://77091379

2 years agoUpdate three tests to realpath paths that we compare to dyld paths
Jason Molenda [Thu, 26 May 2022 07:19:57 +0000 (00:19 -0700)]
Update three tests to realpath paths that we compare to dyld paths

I get to my work directory through a symlink, so the pathnames the
tests get for their build artifacts etc are via that symlink.  There
are three tests which compare those symlink paths to a directory
received from dyld on macOS, which is the actual real pathname.

These tests have always failed for me on my dekstop but I finally
sat down to figure out why. Easy quick fix.

2 years ago[MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC
Fangrui Song [Thu, 26 May 2022 07:14:08 +0000 (00:14 -0700)]
[MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC

2 years ago[scudo] Link against libatomic on all MIPS targets
John Paul Adrian Glaubitz [Thu, 26 May 2022 07:00:16 +0000 (00:00 -0700)]
[scudo] Link against libatomic on all MIPS targets

Reviewed By: MaskRay

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

2 years agoReplace the custom linked list in LeaderTableEntry with TinyPtrVector.
Owen Anderson [Mon, 9 May 2022 05:34:43 +0000 (22:34 -0700)]
Replace the custom linked list in LeaderTableEntry with TinyPtrVector.

The purpose of the custom linked list was to optimize for the case
of a single-element list. It turns out that TinyPtrVector handles
the same basic scenario even better, reducing the size of
LeaderTableEntry by 33%, and requiring only log2(N) allocations
as the size of the list grows. The only downside is that we have
to store the Value's and BasicBlock's in separate vectors, which
is slightly awkward in a few cases. Fortunately that ends up being
entirely encapsulated inside helper functions.

Reviewed By: asbirlea

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

2 years ago[GuardWidening] Remove nuw/nsw flags for hoisted instructions
Serguei Katkov [Wed, 25 May 2022 06:37:06 +0000 (13:37 +0700)]
[GuardWidening] Remove nuw/nsw flags for hoisted instructions

When we hoist instructions over guard we must clear flags due to these flags
might be implied using this guard, so they make sense only after the guard.

As an example of the bug due to current behavior.
L is known to be in range say [0, 100)
c1 = x u< L
guard (c1)
x1 = add x, 1
c2 = x1 u< L
guard(c2)

basing on guard(c1) we can say that x1 = add nuw nsw x, 1
after guard widening we get
c1 = x u< L
x1 = add nuw nsw x, 1
c2 = x1 u< L
c = and c1, c2
guard(c)

now, basing on fact that x + 1 < L and x >= 0 due to x + 1 is nuw
we can prove that x + 1 u< L implies that x u< L, so we can just remove c1
x1 = add nuw nsw x, 1
c2 = x1 u< L
guard(c2)

But that is not correct due to we will pass x == -1 value.

Reviewed By: mkazantsev
Subscribers: llvm-commits, nikic
Differential Revision: https://reviews.llvm.org/D126354

2 years ago[iwyu] Handle regressions in libLLVM header include
serge-sans-paille [Wed, 25 May 2022 20:29:51 +0000 (16:29 -0400)]
[iwyu] Handle regressions in libLLVM header include

Running iwyu-diff on LLVM codebase since 7030654296a0416bd9402a0278 detected a few
regressions, fixing them.

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

2 years ago[GuardWidening] Add test showing incorrect behavior with nuw/nsw flags
Serguei Katkov [Wed, 25 May 2022 06:37:06 +0000 (13:37 +0700)]
[GuardWidening] Add test showing incorrect behavior with nuw/nsw flags

when we move instruction over the guard we must clear nuw/nsw flags
but we do not.

2 years ago[GuardWidening] Update test with update_test_checks.py
Serguei Katkov [Thu, 26 May 2022 05:17:16 +0000 (12:17 +0700)]
[GuardWidening] Update test with update_test_checks.py

2 years ago[mlir:Printer][NFC] Add utility methods for printing escaped/hex strings
River Riddle [Tue, 24 May 2022 08:55:27 +0000 (01:55 -0700)]
[mlir:Printer][NFC] Add utility methods for printing escaped/hex strings

This simplifies quite a few cases where we manually duplicate the
escaping logic.

2 years ago[mlir:LSP] Link the test dialect into mlir-lsp-server
River Riddle [Sat, 21 May 2022 01:20:13 +0000 (18:20 -0700)]
[mlir:LSP] Link the test dialect into mlir-lsp-server

This allows for more easily interacting with lit files that utilize
the test dialect.

2 years ago[mlir][bufferization] Clean up imports and code comments
Matthias Springer [Wed, 25 May 2022 22:37:51 +0000 (00:37 +0200)]
[mlir][bufferization] Clean up imports and code comments

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

2 years ago[NFC][LoopCacheAnalysis] Update test cases to make sure the outputs follow the right...
Congzhe Cao [Thu, 26 May 2022 03:31:17 +0000 (23:31 -0400)]
[NFC][LoopCacheAnalysis] Update test cases to make sure the outputs follow the right order

In this patch we change test cases from using "CHECK" to using
"CHECK-NEXT", which is to ensure the order of loops output by
loop cache analysis is correct. After D124725 we fixed the
non-deterministic output order hence we did not use "CHECK-DAG"
anymore, and now we should really use "CHECK-NEXT" to make sure
the loops in the output loop vector follow the right order.

Reviewed By: bmahjour, #loopoptwg

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

2 years ago[InstCombine] [NFC] refector foldXorOfICmps
Chenbing Zheng [Thu, 26 May 2022 03:07:18 +0000 (11:07 +0800)]
[InstCombine] [NFC] refector foldXorOfICmps

Reviewed By: nikic

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

2 years ago[InstCombine] bitcast(logic(bitcast(X), bitcast(Y))) -> bitcast'(logic(bitcast'(X...
Chenbing Zheng [Thu, 26 May 2022 02:16:54 +0000 (10:16 +0800)]
[InstCombine] bitcast(logic(bitcast(X), bitcast(Y))) -> bitcast'(logic(bitcast'(X), Y))

This patch break foldBitCastBitwiseLogic limite the destination
must have an integer element type, and eliminate one bitcast by
doing the logic op in the type of the input that has an integer
element type.

Reviewed By: spatel

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

2 years ago[RISCV] Replace ISD::FP_EXTEND and ISD::FP_ROUND with RVV VL op.
jacquesguan [Wed, 11 May 2022 09:17:43 +0000 (09:17 +0000)]
[RISCV] Replace ISD::FP_EXTEND and ISD::FP_ROUND with RVV VL op.

This patch tries to solve the incoordination between the direct and intermediate  cast caused by D123975.
This patch replaces ISD::FP_EXTEND and ISD::FP_ROUND with RVV VL op in the lowering of FP scalable vector direct cast to unify with the intermediate cast.
And it also changes the FP widenning pattern with the VL op.

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

2 years ago[llvm-ml] Add support for the .S extension
Alan Zhao [Wed, 25 May 2022 22:06:08 +0000 (18:06 -0400)]
[llvm-ml] Add support for the .S extension

Even though MASM files typically have the .asm extension, there are some
use cases [0] where they have the .S extension. MSVC ml assembles such
files with no problems, so llvm-ml should as well.

Additionally, fix the implementation of the /Ta flag and add a test for
it.

[0]: https://crrev.com/c/3668287

Reviewed By: epastor

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

2 years ago[LegalizeTypes][VP] Add widen and split support for VP_TRUNCATE
Lian Wang [Thu, 19 May 2022 07:11:18 +0000 (07:11 +0000)]
[LegalizeTypes][VP] Add widen and split support for VP_TRUNCATE

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Remove solved TODO for combining constant shifts
Haocong.Lu [Thu, 26 May 2022 01:54:52 +0000 (09:54 +0800)]
[RISCV][NFC] Remove solved TODO for combining constant shifts

Reviewed By: benshi001, asb

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

2 years ago[flang] Allow forward reference to ENTRY from generic interface
Peter Klausler [Wed, 25 May 2022 23:44:58 +0000 (16:44 -0700)]
[flang] Allow forward reference to ENTRY from generic interface

The CreateEntry() function in name resolution needs to allow for the name
of an alternate entry point already having been declared in the outer scope
as the homonymous specific procedure of a generic interface; e.g.,

  interface foo
    module procedure foo
  end interface
  subroutine bar
    entry foo
  end subroutine

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

2 years ago[flang] Update intrinsic module source files
V Donaldson [Wed, 25 May 2022 22:32:02 +0000 (15:32 -0700)]
[flang] Update intrinsic module source files

The f18 standard defines several intrinsic modules containing definitions
and declarations for various constants, types, and procedures.  This PR adds
declarations for missing procedures in these modules.

2 years ago[mlir][sparse] Add more complex operations.
bixia1 [Tue, 24 May 2022 23:07:31 +0000 (16:07 -0700)]
[mlir][sparse] Add more complex operations.

Support complex operations sqrt, expm1, and tanh.

Add tests.

Reviewed By: aartbik

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

2 years agoLower complex.expm1 to standard dialect.
bixia1 [Wed, 25 May 2022 19:39:37 +0000 (12:39 -0700)]
Lower complex.expm1 to standard dialect.

Add a test.

Reviewed By: pifon2a

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

2 years agoSkip testing of watchpoint hit-count/ignore-count on multithreaded
Jason Molenda [Wed, 25 May 2022 23:05:16 +0000 (16:05 -0700)]
Skip testing of watchpoint hit-count/ignore-count on multithreaded

Skip all watchpoint hit-count/ignore-count tests for multithreaded
API tests for now on arm64 Darwin.

On AArch64, insns that trigger a WP are rolled back and we are
notified.  lldb needs to disable the WP, insn step, re-enable it,
then report it to the user.  lldb only does this full step action
for the "selected thread", and so when a program stops with
multiple threads hitting a stop reason, some of them watchpoints,
any non-selected-thread will not be completed in this way.  But
all threads with the initial watchpoint exception will have their
hit-count/ignore-counts updated.  When we resume execution, the
other threads sitting at the instruction will again execute &
trigger the WP exceptoin again, repeating until we've gone through
all of the threads.

This bug is being tracked in llvm.org/pr49433 and inside apple
in rdar://93863107

2 years ago[NFC][llvm-ml] Rename rip-relative-addressing.asm to rip_relative_addressing.asm
Alan Zhao [Wed, 25 May 2022 22:12:35 +0000 (18:12 -0400)]
[NFC][llvm-ml] Rename rip-relative-addressing.asm to rip_relative_addressing.asm

All the other tests here use underscores, so we should rename this file
to be consistent.

2 years ago[gn build] Fix D126415 to only set `llvm_have_mallinfo2 = true` on linux
Arthur Eubanks [Wed, 25 May 2022 21:47:30 +0000 (14:47 -0700)]
[gn build] Fix D126415 to only set `llvm_have_mallinfo2 = true` on linux

Otherwise mac builds are broken, e.g. http://45.33.8.238/macm1/36056/step_4.txt

../../llvm/lib/Support/Unix/Process.inc:35:10: fatal error: 'malloc.h' file not found
 #include <malloc.h>

2 years ago[flang] Fix crash from a blank BIND(C,NAME="") on subprogram
Peter Klausler [Wed, 25 May 2022 20:32:52 +0000 (13:32 -0700)]
[flang] Fix crash from a blank BIND(C,NAME="") on subprogram

A recent change fixed the processing of BIND(C,NAME=expr) character
expressions so that they are evaluated as constants in the scope of
the subprogram.  However, when the character name expression results
in an empty value after trimming, the compiler emits a warning message,
and this message is now causing a crash due to a lack of statement
context.  To fix, extend the deferred processing of the BIND(C,NAME="")
so that a basic statement context exists.

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

2 years ago[gn build] Manually port bed9efed71
Arthur Eubanks [Wed, 25 May 2022 21:36:42 +0000 (14:36 -0700)]
[gn build] Manually port bed9efed71

2 years ago[SLP]Do not try to generate ScatterVectorize if it will be scalarized.
Alexey Bataev [Wed, 25 May 2022 14:21:55 +0000 (07:21 -0700)]
[SLP]Do not try to generate ScatterVectorize if it will be scalarized.

SLP should build ScatterVectorize nodes only if they actually end up
with masked gather rather than with scalarization. In the second
scenario better to build a gather node.

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

2 years ago[bazel] Unset REVISION as if LLVM_APPEND_VC_REV=OFF, for now.
NAKAMURA Takumi [Wed, 25 May 2022 21:14:16 +0000 (06:14 +0900)]
[bazel] Unset REVISION as if LLVM_APPEND_VC_REV=OFF, for now.

We could implement retrieving the revision here, but we may avoid
"Just the same but only different revision hash string".

2 years ago[bazel] Bump to 15.0.0git
NAKAMURA Takumi [Wed, 25 May 2022 21:10:22 +0000 (06:10 +0900)]
[bazel] Bump to 15.0.0git

2 years ago[memprof] Keep and display symbol names in the RawMemProfReader.
Snehasish Kumar [Tue, 24 May 2022 23:58:36 +0000 (23:58 +0000)]
[memprof] Keep and display symbol names in the RawMemProfReader.

Extend the Frame struct to hold the symbol name if requested
when a RawMemProfReader object is constructed. This change updates the
tests and removes the need to pass --debug to obtain the mapping from
GUID to symbol names.

Reviewed By: tejohnson

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

2 years ago[SLP]Fix PR55688: Miscompile due to incorrect nuw/nsw handling.
Alexey Bataev [Wed, 25 May 2022 11:37:51 +0000 (04:37 -0700)]
[SLP]Fix PR55688: Miscompile due to incorrect nuw/nsw handling.

Need to use all ReductionOps when propagating flags for the reduction
ops, otherwise transformation is not correct. Plus, need to drop nuw/nsw
flags.

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

2 years ago[clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas
Eric Li [Wed, 25 May 2022 20:15:46 +0000 (20:15 +0000)]
[clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas

When constructing the `Environment`, the `this` pointee is established
for a `CXXMethodDecl` by looking at its parent. However, inside of
lambdas, a `CXXThisExpr` refers to the captured `this` coming from the
enclosing member function.

When establishing the `this` pointee for a function, we check whether
the function is a lambda, and check for an enclosing member function
to establish the `this` pointee storage location.

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

2 years ago[clang][dataflow] Relax assert on existence of `this` pointee storage
Eric Li [Wed, 25 May 2022 19:21:08 +0000 (19:21 +0000)]
[clang][dataflow] Relax assert on existence of `this` pointee storage

Support for unions is incomplete (per 99f7d55e) and the `this` pointee
storage location is not set for unions. The assert in
`VisitCXXThisExpr` is then guaranteed to trigger when analyzing member
functions of a union.

This commit changes the assert to an early-return. Any expression may
be undefined, and so having a value for the `CXXThisExpr` is not a
postcondition of the transfer function.

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

2 years ago[gn build] Set llvm_have_mallinfo2 to true by default
Arthur Eubanks [Wed, 25 May 2022 20:30:37 +0000 (13:30 -0700)]
[gn build] Set llvm_have_mallinfo2 to true by default

If you are using an old enough glibc which doesn't have mallinfo2, set
`llvm_have_mallinfo2 = false`.

At this point it's likely that most people using the gn build are
compiling against a recent enough glibc (glibc 2.33 which was released
in Feb 2021).

Reviewed By: peterwaller-arm

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

2 years ago[MCDisassembler] Disambiguate Size parameter in tryAddingSymbolicOperand()
Maksim Panchenko [Thu, 19 May 2022 20:23:40 +0000 (13:23 -0700)]
[MCDisassembler] Disambiguate Size parameter in tryAddingSymbolicOperand()

MCSymbolizer::tryAddingSymbolicOperand() overloaded the Size parameter
to specify either the instruction size or the operand size depending on
the architecture. However, for proper symbolic disassembly on X86, we
need to know both sizes, as an instruction can have two operands, and
the instruction size cannot be reliably calculated based on the operand
offset and its size. Hence, split Size into OpSize and InstSize.

For X86, the new interface allows to fix a couple of issues:
  * Correctly adjust the value of PC-relative operands.
  * Set operand size to zero when the operand is specified implicitly.

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

2 years ago[BOLT][DWARF] Convert dwarf5-df-* tests to assembly tests
zr33 [Wed, 25 May 2022 20:40:11 +0000 (13:40 -0700)]
[BOLT][DWARF] Convert dwarf5-df-* tests to assembly tests

Reviewed By: ayermolo

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

2 years agoRound up zero-sized symbols to 1 byte in `.debug_aranges`.
Patrick Walton [Wed, 25 May 2022 20:30:49 +0000 (13:30 -0700)]
Round up zero-sized symbols to 1 byte in `.debug_aranges`.

This commit modifies the AsmPrinter to avoid emitting any zero-sized symbols to
the .debug_aranges table, by rounding their size up to 1. Entries with zero
length violate the DWARF 5 spec, which states:

> Each descriptor is a triple consisting of a segment selector, the beginning
> address within that segment of a range of text or data covered by some entry
> owned by the corresponding compilation unit, followed by the non-zero length
> of that range.

In practice, these zero-sized entries produce annoying warnings in lld and
cause GNU binutils to truncate the table when parsing it.

Other parts of LLVM, such as DWARFDebugARanges in the DebugInfo module
(specifically the appendRange method), already avoid emitting zero-sized
symbols to .debug_aranges, but not comprehensively in the AsmPrinter. In fact,
the AsmPrinter does try to avoid emitting such zero-sized symbols when labels
aren't involved, but doesn't when the symbol to emitted is a difference of two
labels; this patch extends that logic to handle the case in which the symbol is
defined via labels.

Reviewed By: dblaikie

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

2 years ago[Clang] Introduce `--offload-link` option to perform offload device linking
Joseph Huber [Wed, 25 May 2022 17:22:26 +0000 (13:22 -0400)]
[Clang] Introduce `--offload-link` option to perform offload device linking

The new driver uses an augmented linker wrapper to perform the device
linking phase, but to the user looks like a regular linker invocation.
Contrary to the old driver, the new driver contains all the information
necessary to produce a linked device image in the host object itself.
Currently, we infer the usage of the device linker by the user
specifying an offloading toolchain, e.g. (--offload-arch=...) or
(-fopenmp-targets=...), but this shouldn't be strictly necessary.
This patch introduces a new option `--offload-link` to tell
 the driver to use the offloading linker instead. So a compilation flow
 can now look like this,

```
clang foo.cu --offload-new-driver -fgpu-rdc --offload-arch=sm_70 -c
clang foo.o --offload-link -lcudart
```

I was considering if this could be merged into the `-fuse-ld` option,
but because the device linker wraps over the users linker it would
conflict with that. In the future it's possible to merge this into `lld`
completely or `gold` via a plugin and we would use this option to
enable the device linking feature. Let me know what you think for this.

Reviewed By: tra

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

2 years ago[mlir][bufferization][NFC] Remove dead code
Matthias Springer [Wed, 25 May 2022 20:25:27 +0000 (22:25 +0200)]
[mlir][bufferization][NFC] Remove dead code

There were two copies of AlwaysCopyAnalysisState. (Must have been a merge conflict mistake...)

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

2 years ago[LLDB][NativePDB] Check for missing type info to avoid crash.
Zequan Wu [Wed, 18 May 2022 01:23:35 +0000 (18:23 -0700)]
[LLDB][NativePDB] Check for missing type info to avoid crash.

NativePDB often assumes that all debug info are available.
This is one step to make it more pervasive.

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

2 years ago[AMDGPU] gfx11 FLAT Instructions
Joe Nash [Tue, 10 May 2022 18:46:57 +0000 (14:46 -0400)]
[AMDGPU] gfx11 FLAT Instructions

MachineCode Support for FLAT type instructions

Contributors:
Sebastian Neubauer <sebastian.neubauer@amd.com>

Patch 12/N for upstreaming of AMDGPU gfx11 architecture.

Depends on D125989

Reviewed By: rampitec, #amdgpu

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

2 years agoFix conversion error to Expected
Thomas Preud'homme [Wed, 25 May 2022 18:37:15 +0000 (19:37 +0100)]
Fix conversion error to Expected

On Ubuntu 18.04 with GCC 7.5 Intel trace code fails to build due to
failure to convert from
lldb_private::process_linux::IntelPTPerThreadProcessTraceUP to
Expected<lldb_private::process_linux::IntelPTPerThreadProcessTraceUP>.
This commit explicitely marks those unique_ptr values as being moved
which fixes the conversion error.

Reviewed By: wallace

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

2 years ago[clang] Fix the begin location of concepts specialization expression
Alex Lorenz [Tue, 24 May 2022 20:41:39 +0000 (13:41 -0700)]
[clang] Fix the begin location of concepts specialization expression

The concept specialization expression should start at the location of
the  nested qualifiers when it has nested qualifiers.
This ensures that libclang reports correct source ranges that include
all subexpressions when visiting the expression.

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

2 years ago[mlir][PDLL] Allow numeric result indexing for unregistered op
Chia-hung Duan [Wed, 25 May 2022 19:21:48 +0000 (19:21 +0000)]
[mlir][PDLL] Allow numeric result indexing for unregistered op

If we don't specify the result index while matching operand with the
result of certain operation, it's supposed to match all the results of
the operation with the operand. For registered op, it's easy to do that
by either indexing with number or name. For unregistered op, this commit
enables the numeric result indexing for this use case.

Reviewed By: rriddle

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

2 years ago[AMDGPU] gfx11 vinterp instructions MC support
Joe Nash [Wed, 27 Apr 2022 13:17:25 +0000 (09:17 -0400)]
[AMDGPU] gfx11 vinterp instructions MC support

A new instruction encoding. Some of these instructions were previously VOP3
encoded.

Contributors:
Carl Ritson <carl.ritson@amd.com>

Patch 11/N for upstreaming of AMDGPU gfx11 architecture.

Depends on D125824

Reviewed By: critson

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

2 years ago[AMDGPU] gfx11 export instructions
Joe Nash [Mon, 25 Apr 2022 17:58:14 +0000 (13:58 -0400)]
[AMDGPU] gfx11 export instructions

Contributors:
Jay Foad <jay.foad@amd.com>
Dmitry Preobrazhensky <d-pre@mail.ru>

Patch 10/N for upstreaming of AMDGPU gfx11 architecture.

Depends on D125822

Reviewed By: dp

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

2 years ago[LLVM] Add rcp.approx.ftz.f32 intrinsic
Christian Sigg [Wed, 25 May 2022 11:41:53 +0000 (13:41 +0200)]
[LLVM] Add rcp.approx.ftz.f32 intrinsic

Split out from https://reviews.llvm.org/D126158.

Reviewed By: tra

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

2 years ago[compiler-rt][test] Fix flake in symbolize_stack test
Paul Kirth [Mon, 23 May 2022 18:22:40 +0000 (18:22 +0000)]
[compiler-rt][test] Fix flake in symbolize_stack test

Addresses tests flakes described in
https://github.com/llvm/llvm-project/issues/55460

The test being updated can fail in FileCheck to match when given long
enough stack traces. This can be problematic when file system paths
become long enough to cause the majority of the long function name to
become truncated. We found in our CI that the truncated output would
often fail to match, thereby causing the test to fail when it should not.

Here we change the test to match on sybolizer output that should be more
reliable than matching inside the long function name.

Reviewed By: vitalybuka

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

2 years ago[flang] Address regression (calls to assumed-length character function dummy procedures)
Peter Klausler [Wed, 25 May 2022 16:19:19 +0000 (09:19 -0700)]
[flang] Address regression (calls to assumed-length character function dummy procedures)

A recent fix beefed up semantics checking to catch the case of a call
to an external assumed-length character function; this check has false
positives in the case of an assumed-length character function that is
a dummy procedure.  These do have a length that is passed in extra
compiler-created arguments.  This patch refines the check and undoes some
changes to tests.

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

2 years agoC++ DR2394: Const-default-constructible for members.
James Y Knight [Wed, 25 May 2022 18:19:59 +0000 (14:19 -0400)]
C++ DR2394: Const-default-constructible for members.

Const class members may be initialized with a defaulted default
constructor under the same conditions it would be allowed for a const
object elsewhere.

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

2 years agoReapply "[RISCV] Enable strict assertions in InsertVSETVLI data flow"
Philip Reames [Wed, 25 May 2022 18:07:31 +0000 (11:07 -0700)]
Reapply "[RISCV] Enable strict assertions in InsertVSETVLI data flow"

be2cb8 fixes the case which triggered the revert.  Reapply, and let's see if anything else falls out.

Original commit message:

These asserts are believed to hold after several recent miscompiles have been fixed.  If you see an assertion failure on this change, please toggle the default back and make sure you file a bug with a reproducer.  We may have as yet uncaught miscompiles lurking in this code.

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

2 years ago[pseudo] Fix pseudo-gen usage when cross-compiling
Shoaib Meenai [Wed, 25 May 2022 17:22:10 +0000 (10:22 -0700)]
[pseudo] Fix pseudo-gen usage when cross-compiling

Use the LLVM build system's cross-compilation support for the tool, so
that the build works for both host and cross-compilation scenarios.

Reviewed By: sammccall

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

2 years ago[clang][extract-api] Don't emit symbols prefixed with an underscore
Daniel Grumberg [Mon, 16 May 2022 10:46:36 +0000 (11:46 +0100)]
[clang][extract-api] Don't emit symbols prefixed with an underscore

These symbols are understood to not be used for client API consumption
by convention so they should not appear in the generated symbol graph.

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

2 years agoDWARFVerifier: Change vector of IntervalMap to vector of unique_ptrs
Krzysztof Parzyszek [Wed, 25 May 2022 13:46:25 +0000 (06:46 -0700)]
DWARFVerifier: Change vector of IntervalMap to vector of unique_ptrs

This is a workaround for compilation issue on FreeBSD. See comments in
https://reviews.llvm.org/rG0d8cb8b399ad for more information.

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

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

2 years ago[mlir][bufferize] Remove hoisting functionality from One-Shot Bufferize
Matthias Springer [Wed, 25 May 2022 17:39:57 +0000 (19:39 +0200)]
[mlir][bufferize] Remove hoisting functionality from One-Shot Bufferize

The same functionality is already provided by `-buffer-hoisting` and `-buffer-loop-hoisting`.

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

2 years ago[SLP] add minimum test for miscompile (PR55688); NFC
Sanjay Patel [Wed, 25 May 2022 17:43:13 +0000 (13:43 -0400)]
[SLP] add minimum test for miscompile (PR55688); NFC

2 years ago[riscv] Remove mutation of prior vsetvli from insertion dataflow
Philip Reames [Wed, 25 May 2022 17:37:26 +0000 (10:37 -0700)]
[riscv] Remove mutation of prior vsetvli from insertion dataflow

This moves mutation entirely out of the main algorithm.

The immediate trigger is that we hit another case of the same issue I thought we'd fixed in 72925d9. It turns out we hadn't considered the cross block case.

As a brief summary, the issue being fixed is that if we mutate a previous vsetvli in phase 3, there's a possibility that some later use of that vsetvli changes "compatibility". In the cross_block_mutate test, this later vsetvli occurs in another block (and is thus visit order dependent too!). This causes us to fail strict asserts. (To be explicit, the current on by default workaround should compensate. It's only when we turn that off that we have problems.)

Now, I want to explicitly call out an alternate workaround. We could leave the mutation in phase 3, and simplify restrict it to the case where the previous vsetvli's GPR result is unused. That covers the case we've actually seen. (I'll note that codegen regressions with a simple form of this were significant. We might have to check specifically for the use outside block case to keep them reasonable, which complicates the workaround slightly.)

Personally, I'm at the point where I want the mutation pulled out just for robustness sake. I'm worried there's yet one more form of this bug we haven't thought about.

The other motivation for this change is that it does give us a couple of minor codegen wins. None appear to be hugely significant, but improvements never hurt right?

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

2 years agoRemoving this as part of the revert done in 69da3b6aead2e7a18a2578aad661d6d36b8d30cf
Aaron Ballman [Wed, 25 May 2022 17:45:17 +0000 (13:45 -0400)]
Removing this as part of the revert done in 69da3b6aead2e7a18a2578aad661d6d36b8d30cf

This appears to have been added in a follow-up commit that I missed.

2 years agoRevert "[OpenMP] atomic compare fail : Parser & AST support"
Aaron Ballman [Wed, 25 May 2022 17:33:30 +0000 (13:33 -0400)]
Revert "[OpenMP] atomic compare fail : Parser & AST support"

This reverts commit 232bf8189ef7d574a468bd5bfd1e84e962f7f16e.

It broke the sanitize buildbot: https://lab.llvm.org/buildbot/#/builders/5/builds/24074

It also reproduces on Windows debug builds as a crash.

2 years ago[OpenMP] Add diagnostic for unterminated 'omp [begin] declare target'
Mike Rice [Tue, 24 May 2022 20:57:41 +0000 (13:57 -0700)]
[OpenMP] Add diagnostic for unterminated 'omp [begin] declare target'

Warns when end-of-file is reached without seeing all matching
'omp end declare target' directives. The diagnostic shows the
location of the related begin directive.

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

2 years ago[Clang][Docs] Document `-Xoffload-linker` flag
Joseph Huber [Wed, 25 May 2022 17:32:25 +0000 (13:32 -0400)]
[Clang][Docs] Document `-Xoffload-linker` flag

Summary:
I added the `-Xoffload-linker` flag and did not provide additional
documentation. This patch adds it.

2 years agoAMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane
Nicolai Hähnle [Tue, 10 May 2022 15:10:36 +0000 (10:10 -0500)]
AMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane

A later change will add a 3rd user, so factoring out the common code
seems useful.

Reorganizing the executeInWaterfallLoop causes some more COPYs to be
generated, but those all fold away during instruction selection.
Generating the comparisons uses generic instructions over machine
instructions now which admittedly shouldn't make a difference
(though it should make it easier to move the waterfall loop generation
to another place).

(Resubmit with missing test added.)

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

2 years agoRevert "AMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane"
Nicolai Hähnle [Wed, 25 May 2022 17:03:23 +0000 (12:03 -0500)]
Revert "AMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane"

This reverts commit 2a28467e5389c4d741d1825fadd39ae84ecaa5dc.

2 years agoReland "[llvm-pdbutil] Add options to only dump symbol record at specified offset...
Zequan Wu [Fri, 29 Apr 2022 23:38:56 +0000 (16:38 -0700)]
Reland "[llvm-pdbutil] Add options to only dump symbol record at specified offset and its parents or children with spcified depth."

This reverts commit cfb4e782520ce59602a34732386ebbdf58136cfb.

2 years ago[lldb] Fix an unused function warning
Kazu Hirata [Wed, 25 May 2022 16:49:05 +0000 (09:49 -0700)]
[lldb] Fix an unused function warning

This patch fixes:

  .../llvm-project/lldb/source/Host/common/PseudoTerminal.cpp:106:20:
  error: unused function 'use_ptsname' [-Werror,-Wunused-function]

2 years ago[mlir] Fix Tensor_InsertSliceOp description
Logan Chien [Tue, 24 May 2022 01:04:30 +0000 (18:04 -0700)]
[mlir] Fix Tensor_InsertSliceOp description

This commit fixes `Tensor_InsertSliceOp` `sizes` inputs/attributes
description.

Before this commit, the description says the `sizes` inputs/attributes
denote the size of the return type. But according to the
`InsertSliceOpConstantArgumentFolder` in
`lib/Dialect/Tensor/IR/TensorOps.cpp`, the `sizes` inputs/attributes
actually denote the size of the source type.

I had an off-line discussion with the authors of `TensorOps.td` and
`TensorOps.cpp`. We concluded that it was a typo in the Op description.

This commit updates the Op description to match the actual usage.

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

2 years agoAMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane
Nicolai Hähnle [Tue, 10 May 2022 15:10:36 +0000 (10:10 -0500)]
AMDGPU/GISel: Factor out AMDGPURegisterBankInfo::buildReadFirstLane

A later change will add a 3rd user, so factoring out the common code
seems useful.

Reorganizing the executeInWaterfallLoop causes some more COPYs to be
generated, but those all fold away during instruction selection.
Generating the comparisons uses generic instructions over machine
instructions now which admittedly shouldn't make a difference
(though it should make it easier to move the waterfall loop generation
to another place).

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

2 years agoAllow pointer types for atomicrmw xchg
Takafumi Arakaki [Wed, 25 May 2022 16:12:11 +0000 (16:12 +0000)]
Allow pointer types for atomicrmw xchg

This adds support for pointer types for `atomic xchg` and let us write
instructions such as `atomicrmw xchg i64** %0, i64* %1 seq_cst`. This
is similar to the patch for allowing atomicrmw xchg on floating point
types: https://reviews.llvm.org/D52416.

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

2 years ago[RISCV] Preserve fast math flags in lowerVPOp.
Craig Topper [Wed, 25 May 2022 16:16:07 +0000 (09:16 -0700)]
[RISCV] Preserve fast math flags in lowerVPOp.

Update test to check MIR after finalize-isel instead of debug output.

This is of course not the only place we should preserve FMF, but
it's the most obvious one.

Reviewed By: frasercrmck

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