Commit Graph

455458 Commits

Author SHA1 Message Date
Thomas Lively
dd0bbae5ef [WebAssembly] Fix epilogue insertion for indirect tail calls
Previously epilogues were incorrectly inserted after indirect tail calls because
they did not have the `isTerminator` property. Add that property and test that
they get correct epilogues. To be safe, also add other properties that were
defined for direct tail calls.

Differential Revision: https://reviews.llvm.org/D146569
2023-03-22 09:28:48 -07:00
Mark de Wever
d868135691 [libc++] Qualifies ptrdiff_t and max_align_t.
This has been done using the following commands
  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)ptrdiff_t)|\1std::\2|' \{} \;
  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)max_align_t)|\1std::\2|' \{} \;

The std module doesn't export declarations in the global namespaace.,
This is a preparation for that module.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D146550
2023-03-22 17:27:57 +01:00
Arthur Eubanks
3f23c7f5be [InstSimplify] Actually use NewOps for calls in simplifyInstructionWithOperands
Resolves a TODO.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D146599
2023-03-22 09:22:00 -07:00
Thomas Lively
0528087663 [NFC][WebAssembly] Autogenerate test expectations for tailcall.ll
A follow-on commit will add tests to this file and using the
update_llc_test_checks script will make that easier.

Differential Revision: https://reviews.llvm.org/D146568
2023-03-22 09:21:12 -07:00
Caroline Concatto
65890469ce [AArch64] Add asm aliases for MOV, LDR, STR with predicate-as-counter
In the 2022-12 release of the A64 ISA it was updated that the assembler must
also accept predicate-as-counter register names for the source predicate
register and the destination predicate register for:
 * *MOV: Move predicate (unpredicated)*
 * *LDR (predicate): Load predicate register*
 * *STR (predicate): Store predicate register*

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D146311
2023-03-22 16:05:10 +00:00
Luke Lau
06f16232b1 [RISCV][NFC] Make interleaved access test more vectorizable
The previous test case stored the result of a deinterleaved load and add
into the same source address, which resulted in some scatters which we
weren't testing for and made the tests harder to understand.
Store it at a separate address, which will make the tests easier to read
when the cost model is changed after D145085 is landed

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D146442
2023-03-22 16:02:44 +00:00
Caleb Zulawski
71dc3de533 [ARM] Improve min/max vector reductions on Arm
This patch adds some more efficient lowering for vecreduce.min/max under NEON,
using sequences of pairwise vpmin/vpmax to reduce to a single value.

This nearly resolves issues such as #50466, #40981, #38190.

Differential Revision: https://reviews.llvm.org/D146404
2023-03-22 16:00:19 +00:00
Simon Pilgrim
ada0356526 [X86] Extend all_of(icmp_eq()) / any_of(icmp_ne()) -> scalar integer fold to AVX512 targets
Extends 1bb95a3a99 to combine on AVX512 targets where the vXi1 type is legal

Continues work on addressing Issue #53419
2023-03-22 15:56:23 +00:00
Jun Zhang
299f3ac523 Regenerate checks for bswap.ll, NFC
Signed-off-by: Jun Zhang <jun@junz.org>
2023-03-22 23:42:54 +08:00
Doru Bercea
65a0d669b4 Fix accessing of aligned arrays in offloaded target regions 2023-03-22 11:11:23 -04:00
LLVM GN Syncbot
553bff0e9c [gn build] Port 883dbb9c86 2023-03-22 14:45:00 +00:00
Nikita Popov
883dbb9c86 Revert "[MemProf] Context disambiguation cloning pass [patch 1a/3]"
This reverts commit d6ad4f01c3.

Fails to build on at least gcc 12.2:

/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:482:1: error: no declaration matches ‘ContextNode<DerivedCCG, FuncTy, CallTy>* CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(const CallInfo&)’
  482 | CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:393:16: note: candidate is: ‘CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode* CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(const CallInfo&)’
  393 |   ContextNode *getNodeForInst(const CallInfo &C);
      |                ^~~~~~~~~~~~~~
/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:99:7: note: ‘class CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>’ defined here
   99 | class CallsiteContextGraph {
      |       ^~~~~~~~~~~~~~~~~~~~
2023-03-22 15:43:46 +01:00
Johannes de Fine Licht
ed114b6ffc [MLIR][LLVM] Copy byval attributes during inlining.
Support inlining of function calls with the byval attribute on function
arguments by copying the pointee into a newly alloca'ed pointer at the
callsite before inlining.

The alignment attribute is not yet taken into account.

Reviewed By: ftynse, gysit

Differential Revision: https://reviews.llvm.org/D146616
2023-03-22 15:38:16 +01:00
LLVM GN Syncbot
a2033ff3cc [gn build] Port e4ceb5a7bb 2023-03-22 14:28:29 +00:00
Nikita Popov
e7618a6361 [GVN] Fix change reporting when removing assume (PR61574)
Report a change when removing a true/false assume.

Fixes https://github.com/llvm/llvm-project/issues/61574.
2023-03-22 15:23:31 +01:00
Luo, Yuanke
e4ceb5a7bb [X86] Create extra prolog/epilog for stack realignment
Fix some bugs and reland e4c1dfed38 and 614c63bec6.
1. Run argument stack rebase pass before the reserved physical register
   is finalized.
2. Add LEA pseudo instruction to prevent the instruction being
   eliminated.
3. Don't support X32.
2023-03-22 22:20:27 +08:00
OCHyams
f2252726c4 [Assignment Tracking] Fix mem2reg misidentifying unlinked stores
updateForDeletedStore updates the assignment tracking debug info for a store
that is about to be deleted by mem2reg. For each variable backed by the target
alloca, if a dbg.assign exists it is kept (well - it's downgraded to a
dbg.value). A dbg.value is inserted if there's not a linked dbg.assign for a
variable which is backed by the target alloca. This patch fixes a bug whereby a
store with a linked dbg.assign that describes a fragment different to the one
linked to the alloca was not counted for the variable, leading to both keeping
the dbg.assign (downgrading it) and inserting a new dbg.value.

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D146299
2023-03-22 14:18:41 +00:00
OCHyams
a17b71d17f [NFC] Add DebugVariableAggregate class
A DebugVariableAggregate is a DebugVariable that discards FragmentInfo; it
represents a whole variable instance.

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D146298
2023-03-22 14:18:41 +00:00
LLVM GN Syncbot
d4eb996e6f [gn build] Port d6ad4f01c3 2023-03-22 14:06:06 +00:00
Teresa Johnson
d6ad4f01c3 [MemProf] Context disambiguation cloning pass [patch 1a/3]
Support for building, printing, and displaying CallsiteContextGraph
which represents the MemProf metadata contexts. Uses CRTP to enable
support for both IR (regular LTO) and summary (ThinLTO). This patch
includes the support for building it in regular LTO mode (from
memprof and callsite metadata), and the next patch will add the
handling for building it from ThinLTO summaries.

Also includes support for dumping the graph to text and to dot files.

Follow-on patches will contain the support for cloning on the graph and
in the IR.

The graph represents the call contexts in all memprof metadata on
allocation calls, with nodes for the allocations themselves, as well as
for the calls in each context. The graph is initially built from the
allocation memprof metadata (or summary) MIBs. It is then updated to
match calls with callsite metadata onto the nodes, updating it to
reflect any inlining performed on those calls.

Each MIB (representing an allocation's call context with allocation
behavior) is assigned a unique context id during the graph build. The
edges and nodes in the graph are decorated with the context ids they
carry. This is used to correctly update the graph when cloning is
performed so that we can uniquify the context for a single (possibly
cloned) allocation.

Depends on D140786.

Differential Revision: https://reviews.llvm.org/D140908
2023-03-22 07:05:27 -07:00
Stephen Tozer
ee5617dc71 [Dexter] Add timeout options
Adds a pair of options for Dexter that allow the user to specify a
timeout duration. These options are:

* --timeout-total: Times out if the total run-time of the debugger session
  exceeds <timeout-total> seconds.
* --timeout-breakpoint: Times out if the time without hitting a
  breakpoint exceeds <timeout-breakpoint> seconds.

Reviewed By: Orlando

Differential Revision: https://reviews.llvm.org/D145063
2023-03-22 13:50:00 +00:00
Saleem Abdulrasool
893ce5759f docs: add some documentation on Windows SDK search
Add some documentation on the flags and the process by which clang
identifies the headers and libraries for the Windows environment.  It
should identify the flags and their interactions as well as the order in
which the various sources of information are consulted.

Differential Revision: https://reviews.llvm.org/D146165
Reviewed By: hans, mstorjo
2023-03-22 09:46:36 -04:00
Tom Eccles
acf6a32249 [flang] add -flang-experimental-hlfir flag to flang-new
This flag instructs flang-new to use the new HLFIR lowering. It is
marked as experimental and not included in --help.

This was added to make it more convenient to test the performance of
code generated by the HLFIR lowering.

Extra diffs are from running clang-format on CLOptions.inc (which was
being forced by CI).

Differential Revision: https://reviews.llvm.org/D146278
2023-03-22 13:36:54 +00:00
Nikita Popov
3a3ad9fe18 [SimplifyCFG][LICM] Add metadata speculation tests (NFC) 2023-03-22 14:32:49 +01:00
Florian Hahn
256c6729d3 [ConstraintElim] Add tests with GEP constant expressions. 2023-03-22 13:12:49 +00:00
Dmitry Chernenkov
f0111f2039 [libc][Bazel] Bazel fix for 494734b06d 2023-03-22 12:50:22 +00:00
Nicolas Vasilache
255ba1c334 [mlir][AffineMap] NFC - Refactor getProjectedMap and split into projectDims and projectSymbols
The default behavior of getProjectedMap may be surprising as it implicitly compresses the dims and
the unused symbols.

Make these explicit in the API and refactor to more idiomatic implementations with better reuse.

Differential Revision: https://reviews.llvm.org/D146611
2023-03-22 05:30:48 -07:00
Alexander Belyaev
c8117eb964 [mlir] Add a pattern to fold tensor.cast into scf.forall.
Differential revision: https://reviews.llvm.org/D146558
2023-03-22 13:26:22 +01:00
Zhongyunde
7949a2a802 [InstCombine] enhance icmp with sub folds
The new IR with And removes a use of the input variable, which is better for analysis.
Fix https://github.com/llvm/llvm-project/issues/60818

Reviewed By: nikic, spatel

Differential Revision: https://reviews.llvm.org/D145846
2023-03-22 19:53:12 +08:00
Zhongyunde
e2f6ebe8ca [tests] precommit tests for D145846 2023-03-22 19:47:35 +08:00
Florian Hahn
ea929a07b6 [LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).
This avoids having to cast the result of the builder to
GetElementPtrInst.
2023-03-22 11:29:57 +00:00
Serguei Katkov
c96269055f [LoopPredication] Add a test demonstrating bug.
LoopPredication may introduce undefined behavior.
2023-03-22 18:14:00 +07:00
Uday Bondhugula
d25e022cd1 [MLIR][Affine] Fix assumption on int type in memref elt size method
Fix assumption on memref element type being int/float in memref elt size
related method and affine data copy generate.

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

Differential Revision: https://reviews.llvm.org/D146495
2023-03-22 16:23:59 +05:30
Nikita Popov
1a9d49524a [GVN] Regenerate test checks (NFC) 2023-03-22 11:40:07 +01:00
Nikita Popov
a5788836b9 [IR] Rename dropUndefImplying to dropUBImplying (NFC)
Clarify that this is only about immediate undefined behavior,
not about undef or poison.
2023-03-22 11:16:22 +01:00
Sam McCall
ee2cd606ab [dataflow] Log flow condition to the correct stream.
Differential Revision: https://reviews.llvm.org/D146527
2023-03-22 10:57:21 +01:00
David Spickett
b7165fdc7e [llvm][ARM] Fix bounds check after use in ARMAsmParser
Fixes #61605
2023-03-22 09:49:02 +00:00
David Spickett
eb78886246 [lldb] Add test for unavailable registers
Prior to this the only check was that we did not print
this message when reading registers that should exist.

I thought there was an indentation bug here so I wrote a test
for it. There is not, but we could do with the coverage anyway.

Reviewed By: rupprecht

Differential Revision: https://reviews.llvm.org/D145940
2023-03-22 09:42:21 +00:00
Tobias Gysi
56d94a90db [mlir][llvm] Add experimental alias scope decl intrinsic.
The revision adds the llvm.experimental.noalias.scope.decl intrinsic
to the LLVM dialect and updates the import and export accordingly.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D146504
2023-03-22 10:21:09 +01:00
Matthias Springer
9297b9f8ee [mlir][Transforms][NFC] Improve builder/listener API of OperationFolder
The constructor of `OperationFolder` takes a listener. Therefore, the remaining API should not take any builder/rewriters. This could lead to double notifications in case a listener is attached to the builder/rewriter.

As an internal cleanup, `OperationFolder` now has an `IRRewriter` instead of a `RewriterBase::Listener`. In most cases, `OperationFolder` no longer has to notify/deal with listeners. This is done by the rewriter.

Differential Revision: https://reviews.llvm.org/D146134
2023-03-22 09:24:47 +01:00
Adrian Kuegel
57c128e4c0 [mlir][Bazel] Add missing dependency. 2023-03-22 09:20:35 +01:00
Max Kazantsev
7b83a1438f [GuardWidening] Improve analysis of potential widening into hotter block, try 2
The initial version was reverted because it looped infinitely if the likely successor
isn't properly dominated by the predecessor. In practice it means that we went up the
CFG through backedge and looped infinitely.

I also added some paranoid assertion checks to make sure that every other invariant
holds. I also found a hypothetical situation when we may go past the dominated block
while following the likely successors (it means that in fact the dominated block is
dynamically not reachable from dominating block) and explicitly prohibited this, though
I don't have a motivating test showing that it's a real problem.

https://reviews.llvm.org/D146276
2023-03-22 15:15:26 +07:00
Tobias Gysi
f809eb4db2 [mlir] Argument and result attribute handling during inlining.
The revision adds the handleArgument and handleResult handlers that
allow users of the inlining interface to implement argument and result
conversions that take argument and result attributes into account. The
motivating use cases for this revision are taken from the LLVM dialect
inliner, which has to copy arguments that are marked as byval and that
also has to consider zeroext / signext when converting integers.

All type conversions are currently handled by the
materializeCallConversion hook. It runs before isLegalToInline and
supports only the introduction of a single cast operation since it may
have to rollback. The new handlers run shortly before and after
inlining and cannot fail. As a result, they can introduce more complex
ir such as copying a struct argument. At the moment, the new hooks
cannot be used to perform type conversions since all type conversions
have to be done using the materializeCallConversion. A follow up
revision will either relax this constraint or drop
materializeCallConversion in favor of the new and more flexible
handlers.

The revision also extends the CallableOpInterface to provide access
to the argument and result attributes if available.

Reviewed By: rriddle, Dinistro

Differential Revision: https://reviews.llvm.org/D145582
2023-03-22 09:02:15 +01:00
Matthias Springer
9c16eef1ec [mlir][IR] Add ReverseDominanceIterator for IR walkers
Blocks are enumerated depth-first, but post-order. I.e., a block is enumerated when its successors have been enumerated. This iteration style is suitable when deleting blocks in a regions: in the absence of cycles, uses are deleted before their definitions.

Differential Revision: https://reviews.llvm.org/D146125
2023-03-22 09:01:58 +01:00
Balazs Benics
558b46fde2 [analyzer] Fix crashing getSValFromInitListExpr for nested initlists
In the following example, we will end up hitting the `llvm_unreachable()`:
https://godbolt.org/z/5sccc95Ec
```lang=C++
enum class E {};
const E glob[] = {{}};
void initlistWithinInitlist() {
  clang_analyzer_dump(glob[0]); // crashes at loading from `glob[0]`
}
```

We should just return `std::nullopt` instead for these cases.
It's better than crashing.

Reviewed By: xazax.hun

Differential Revision: https://reviews.llvm.org/D146538
2023-03-22 08:43:09 +01:00
Kazu Hirata
9bb96fd874 [llvm] Use llvm::isNullConstant (NFC) 2023-03-22 00:31:48 -07:00
Max Kazantsev
e603285316 [Test] Add hanging test for D146276
The patch was reverted because of hang, adding the test so that this doesn't
happen again.
2023-03-22 14:26:44 +07:00
Kazu Hirata
1fe6a8a584 [X86] Use llvm::isOneConstant (NFC) 2023-03-22 00:25:13 -07:00
Ethan Luis McDonough
823ddba1b3 [flang] Feature list plugin
Plugin that counts the number of times each tree node occurs in a given program.  Used for test coverage.

Updated to fix build issues.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D143704
2023-03-22 01:27:55 -05:00
paperchalice
792bb70d29 [MCContext] Use const Twine & in symbol creation methods. NFC
All of these methods will invoke `getOrCreateSymbol(const Twine &Name)`, using `Twine` here makes these methods more flexible.

Differential Revision: https://reviews.llvm.org/D145923
2023-03-21 23:13:59 -07:00