Commit Graph

437760 Commits

Author SHA1 Message Date
Nikita Popov 0f32f0e147 Revert "[InstCombine] Switch foldOpIntoPhi() to use InstSimplify"
This reverts commit b20e34b39f.

This causes RAUW type mismatch assertions on some buildbots,
reverting for now.
2022-10-04 11:17:09 +02:00
Nikita Popov 45dec8f5fd [ValueTracking] Avoid known bits fallthrough for freeze (NFCI)
The known bits logic should never produce a better result than
the direct recursive non-zero query here, so skip the fallthrough.
2022-10-04 11:02:31 +02:00
Nikita Popov 9c0314f54e [ValueTracking] Switch isKnownNonZero() to switch over opcodes (NFCI)
The change in the assume-queries-counter.ll test is because we skip
and unnecessary known bits query for arguments.
2022-10-04 10:54:28 +02:00
Matthias Springer 81ca5aa452 [mlir][tensor][NFC] Rename linalg.init_tensor to tensor.empty
tensor.empty/linalg.init_tensor produces an uninititalized tensor that can be used as a destination operand for destination-style ops (ops that implement `DestinationStyleOpInterface`).

This change makes it possible to implement `TilingInterface` for non-destination-style ops without depending on the Linalg dialect.

RFC: https://discourse.llvm.org/t/rfc-add-tensor-from-shape-operation/65101

Differential Revision: https://reviews.llvm.org/D135129
2022-10-04 17:25:35 +09:00
Nikita Popov b20e34b39f [InstCombine] Switch foldOpIntoPhi() to use InstSimplify
foldOpIntoPhi() currently only folds operations into the phi if all
but one operands constant-fold. The two exceptions to this are freeze
and select, where we allow more general simplification.

This patch makes foldOpIntoPhi() generally simplification based and
removes all the instruction-specific logic. We just try to simplify
the instruction for each operand, and for the (potentially) one
non-simplified operand, we move it into the new block with adjusted
operands.

This fixes https://github.com/llvm/llvm-project/issues/57448, which
was my original motivation for the change.
2022-10-04 10:12:14 +02:00
Valentin Clement 9d99b482cd
[flang] Lower polymorphic entities types in dummy argument and function result
This patch updates lowering to produce the correct fir.class types for
various polymorphic and unlimited polymoprhic entities cases. This is only the
lowering. Some TODOs have been added to the CodeGen part to avoid errors since
this part still need to be updated as well.
The fir.class<*> representation for unlimited polymorphic entities mentioned in
the document has been updated to fir.class<none> to avoid useless work in pretty
parse/printer.

This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md

Depends on D134957

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D134959
2022-10-04 09:43:59 +02:00
Florian Hahn db720dc17c
[LAA] Use LoopAccessInfoManager in legacy pass.
Simplify LoopAccessLegacyAnalysis by using LoopAccessInfoManager from
D134606. As a side-effect this also removes printing support from
LoopAccessLegacyAnalysis.

Depends on D134606.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134608
2022-10-04 08:37:11 +01:00
LLVM GN Syncbot 1303abe658 [gn build] Port 6d9eb53329 2022-10-04 07:16:10 +00:00
Balázs Kéri 6d9eb53329 [clang-tidy] Add checker 'bugprone-suspicious-realloc-usage'.
Add a check to detect usages of `realloc` where the result is assigned
to the same variable (or field) as passed to the first argument.

Reviewed By: steakhal, martong

Differential Revision: https://reviews.llvm.org/D133119
2022-10-04 09:14:46 +02:00
Nicolas Vasilache 46869eebdc [mlir][Memref] NFC - Addresult pretty printing to MemrefOps
Differential Revision: https://reviews.llvm.org/D134968
2022-10-04 00:05:16 -07:00
Lang Hames 7ec6dde83a [llvm-jitlink] Teach InProcessDeltaMapper to honor -slab-page-size option.
The -slab-page-size option is used to set a simulated page size in -no-exec
tests. In order for this to work we need to use read/write permissions only
on all simulated pages in order to ensure that no simulated page is made
read-only by a permission change to the underlying real page.

The aim of this patch is to make it safe to enable ExecutionEngine regression
tests on arm64. Those tests will be enabled in a follow-up patch.
2022-10-03 21:50:01 -07:00
Lang Hames 3019f488f4 [ORC] Don't unnecessarily copy collection element. 2022-10-03 21:50:01 -07:00
Craig Topper 05df15965b [RISCV] Use _TIED form of VFWADD(U)_WV/VFWSUB(U)_WV to avoid early clobber.
One of the sources is the same size as the destination so that source
doesn't have an overlap with the destination register. By using the _TIED
form we avoid an early clobber contraint for that source.

This matches what was already done for instrinsics. ConvertToThreeAddress
will fix it if it can't stay tied.
2022-10-03 21:44:08 -07:00
Craig Topper b41fe90dc3 [RISCV] Correct the setcc in vp.floor/ceil/round/roundeven lowering.
We want to emit a masked setcc that preserves zeros in all of the bits
where the original mask is zero. To do this we need to pass the original
mask as the passthru operand as well. Otherwise, we'll use the mask agnostic
policy and replace the zeros with 1s on some CPUs.

Differential Revision: https://reviews.llvm.org/D135122
2022-10-03 20:58:05 -07:00
Lang Hames ff85a1879c [ORC] Fix typo in 543790add8. 2022-10-03 20:43:48 -07:00
Lang Hames 516397e144 [ORC] More attempts to fix Windows bots after d3d9f7caf9.
Move getWindowsProtectionFlags inside namespace to make MemProt type accessible.
2022-10-03 20:31:31 -07:00
Lang Hames 543790add8 [ORC] Attempt to fix Windows bots after d3d9f7caf9.
That patch failed to include an update to the Windows side of
ExecutorSharedMemoryMapperService.
2022-10-03 20:15:58 -07:00
LLVM GN Syncbot 3688102aab [gn build] Port d3d9f7caf9 2022-10-04 02:36:02 +00:00
Lang Hames d3d9f7caf9 [ORC][JITLink] Move MemoryFlags.h (MemProt, AllocGroup,...) from JITLink to ORC.
Moving these types to OrcShared eliminates the need for the separate
WireProtectionFlags type.
2022-10-03 19:35:34 -07:00
changkaiyan bd561ca66b [bug] The additional patch committed file was deleted.
Differential Revision: https://reviews.llvm.org/D134696

	deleted:    202209301111.patch
2022-10-04 10:19:59 +08:00
Jez Ng 6ffdb67b53 [MC][test] Update arm64-leaf-compact-unwind.s to use llvm-objdump
This addresses the long-standing FIXME in the test. I would like to
update the test, and objdump's output is a lot more readable / editable
than readobj's.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134690
2022-10-03 22:16:40 -04:00
Jakub Kuderski 247c84aef6 [mlir] Reduce call stack depth in LogicalResult. NFC.
When debuging a crash or conversion failure in a deep pass pipeline,
there are often many interleaved frames with `failed` and `succeeded`.
`LogicalResult` is used through the pass infrastructure, so by not implementing
failure in terms of a call to succeess, this patch noticeably reduces the total
total call stack depth and improves the debugging experience.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D135116
2022-10-03 21:59:02 -04:00
Jordan Rupprecht de471fee27 [bazel] port d033ece0c9 2022-10-03 18:49:14 -07:00
changkaiyan c4cc755c72 [mlir][mlir-translation] patch for standalone-translation command line description missing.
Differential Revision: https://reviews.llvm.org/D134696

	modified:   mlir/examples/standalone/standalone-translate/standalone-translate.cpp
	modified:   mlir/include/mlir/Tools/mlir-translate/Translation.h
	modified:   mlir/lib/Target/Cpp/TranslateRegistration.cpp
	modified:   mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
	modified:   mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp
	modified:   mlir/lib/Target/SPIRV/TranslateRegistration.cpp
	modified:   mlir/lib/Tools/mlir-translate/Translation.cpp
2022-10-04 09:14:40 +08:00
Jim Ingham 852a4bdb25 Change the Sanitizer report breakpoint callbacks to asynchronous.
The synchronous callbacks are not intended to start the target running
during the callback, and doing so is flakey.  This patch converts them
to being regular async callbacks, and adds some testing for sequential
reports that have caused problems in the field.

Differential Revision: https://reviews.llvm.org/D134927
2022-10-03 18:10:28 -07:00
Nemanja Ivanovic 4ea121c904 [PowerPC] Fix a number of inefficiencies and issues with atomic code gen
There are a few issues with the code we generate for atomic operations and the way we generate it:

- Hard coded CR0 for compares
- Order of operands for compares not conducive to
  emitting compare-immediate or for CSE of compares
- Missing MachineMemOperand for st[bhwd]cx intrinsics
- Missing intrinsic properties for the same
- Unnecessary blocks with store conditional
  instructions to clear reservation (which ends
  up hindering performance)
- Move from CR instructions just to compare the
  result of a store conditional with zero (even
  though it is a record-form)

This patch aims to resolve all of those issues.

Differential revision: https://reviews.llvm.org/D134783
2022-10-03 19:55:29 -05:00
Victor Michel 9cf60d8479 [llvm-gsymutil] Fix tracking of currently open file
Prior to this change, `CurrentGSYMPath` was never updated. As a consequence, the GSYM file was reopened for every frame, even if all frames were relative to the same GSYM file.

This change brings a 13x speedup on a test I'm doing (symbolizing ~25K frames from libxul)

(This is my first-ever LLVM change - sorry if I missed something in the process!)

Reviewed By: simon.giesecke, clayborg

Differential Revision: https://reviews.llvm.org/D132912
2022-10-03 17:49:12 -07:00
Sam Clegg 0a9756fc15 [lld][WebAssemlby] Improve support for -L / -l and add testing
- Add support -Bdynamic/-Bstatic and their aliases
- Add support for `--library` and `--library-path` long form args
- Add test based on test/ELF/libsearch.s
- In `-Bdynamic` mode search for `.so` files in preference to `.a`.
- Unlike ELF continue to default to static mode until `-pie` or
  `-shared` are used.

Differential Revision: https://reviews.llvm.org/D135087
2022-10-03 16:53:30 -07:00
Jeff Niu d67def8704 [mlir][analysis] Remove empty files (NFC) 2022-10-03 16:52:53 -07:00
Nico Weber fb5a63e9af [gn build] port d033ece0c9 for now 2022-10-03 19:50:21 -04:00
Yuanfang Chen 1fb728e95c [c++] implements tentative DR1432 for partial ordering of function template
D128745 handled DR1432 for the partial ordering of partial specializations, but
missed the handling for the partial ordering of function templates. This patch
implements the latter. While at it, also simplifies the previous implementation to
be more close to the wording without functional changes.

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

Reviewed By: erichkeane, #clang-language-wg, mizvekov

Differential Revision: https://reviews.llvm.org/D133683
2022-10-03 16:30:27 -07:00
Jessica Paquette c7652dbed4 NFC: Fix legalizer-info-validation again
Also fix some lines that should have been DEBUG-NEXT, which made it a bit harder to
see what was happening here.
2022-10-03 16:24:12 -07:00
Michael Holman 513f89dc8d Add functionality to load dynamic libraries temporarily
Previously, it was possible to load dynamic libraries which would be unloaded on llvm_shutdown(), but recently ManagedStatic removal changed this so that loaded libraries really can't ever be unloaded. This functionality was very useful, and so to add it back in a more explicit way, I've added new getLibrary() and closeLibrary() methods to allow callers to use the very convenient platform independent abstraction that LLVM has for dynamic libraries.

As a specific use case, the onnx-mlir project was using this functionality with an API that allows instancing LLVM so you can compile a shared library, and then load that library, and eventually close the instance (and library) and compile something else. This change to llvm_shutdown causes libraries to leak and also locks the libraries for the entire duration of the program which prevents reusing library names.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D134763
2022-10-03 16:20:22 -07:00
Daniel Thornburgh d033ece0c9 [llvm-objdump] Find debug information with Build ID/debuginfod.
Uses the library introduced in https://reviews.llvm.org/D132504 to add build ID fetching to llvm-objdump. This allows viewing source when disassembling stripped objects.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D131224
2022-10-03 16:17:45 -07:00
Nico Weber 8c45e80298 [lld/mac] Port typo correction for undefined symbols from ELF port
Ports:
- core feature: https://reviews.llvm.org/D67039
- case mismatch: https://reviews.llvm.org/D70506
- extern "C" suggestions: https://reviews.llvm.org/D69592,
  https://reviews.llvm.org/D69650

Does not port https://reviews.llvm.org/D71735 since I believe that that doesn't
apply to lld/Mach-O.

Differential Revision: https://reviews.llvm.org/D135038
2022-10-03 18:53:55 -04:00
Nico Weber d55dd57124 [gn build] port 5585d99835 2022-10-03 18:48:30 -04:00
Fangrui Song def48cae45 [test] Clean up Driver/baremetal.cpp
* Remove -no-canonical-prefixes. See 980679981f
* Test a.out and %t.out in few tests and remove excess `-o %t.o`
* Avoid wrapping lines too aggresstively
* Replace `"{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}"` with `ld{{(.exe)?}}"`. The new pattern supports more CLANG_DEFAULT_LINKER.
2022-10-03 15:35:18 -07:00
Jessica Paquette b70d2d57cd NFC: Update legalizer-info-validation.mir 2022-10-03 15:29:43 -07:00
Zibi Sarbinowski 36dde913b0 [SystemZ][z/OS] Add ASCII and 32-bit variants for libc++.
This patch enables libc++ build as shared library in all combinations of ASCII/EBCDIC and 32-bit/64-bit variants. In particular it introduces:

  # ASCII version of libc++ named as libc++_a.so
  # Script to rename DLL name inside the generated side deck
  # Various names for dataset members where DLL libraries and their side decks will reside
  # Add the following options:

   - LIBCXX_SHARED_OUTPUT_NAME
   - LIBCXX_ADDITIONAL_COMPILE_FLAGS
   - LIBCXX_ADDITIONAL_LIBRARIES
   - LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
   - LIBCXXABI_ADDITIONAL_LIBRARIES

**Background and rational of this patch**

The linker on z/OS creates a list of exported symbols in a file called side deck. The list contains the symbol name as well as the name of the DLL which implements the symbol. The name of the DLL depends on what is specified in the -o command line option. If it points to a USS file, than the DLL name in the side deck will be the USS file name. If it points to a member of a dataset then the DLL name in the side deck is the member name.

If CMake could deal with z/OS datasets we could use -o that points to a dataset member name, but this does not seem to work so we have to produce a USS file as the DLL and then copy the content of the produced side deck to a dataset as well as rename the USS file name in the side deck to a dataset member name that corresponds to that DLL.

Reviewed By: muiez, SeanP, ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D118503
2022-10-03 17:24:02 -05:00
Jessica Paquette d46751a572 [GlobalISel][AArch64] Lower G_FMAD
Noticed this falling back on CTMark at -Os (bullet).

Seems like we have no 1:1 matching for it, so match SDAG and just lower.

Add testcases for common legal cases as well.

Differential Revision: https://reviews.llvm.org/D135111
2022-10-03 15:15:17 -07:00
Aart Bik fdadb5c146 [mlir] fix bazel build breakage
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135105
2022-10-03 14:39:27 -07:00
Alan Hu 729e3d8aa7 [llvm-ocaml] Add binding for constructing opaque pointers
Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134916
2022-10-03 14:38:48 -07:00
Fangrui Song f6797056fc Revert D135076 "[Clang] Make offloading flags accept '-' and '--'"
This reverts commit 11adae5089.
There are multiple aspects this change is not appealing.

* They conflict with JoinedOrSeparate `-o`. The old exception `-objc-*`
  should not be used an excuse.
* We generally want new options to be more rigid and avoid multiple
  spellings.
* If users get used to `-offload-*`, a misspelled `-offload-*` option still
  gets passed as `-o ffloat-*` without being detected.
2022-10-03 14:34:16 -07:00
Andrew Savonichev d420110a1e [NVPTX] Fix constant expression initializers for global variables
Before this patch the code in printScalarConstant was unable to handle
nested constant expressions like (gep (addrspacecast ptr)) and crashed
with:

LLVM ERROR: Unsupported expression in static initializer:
  addrspacecast ([4 x i8] addrspace(1)* @ga to [4 x i8]*)

We can use lowerConstantForGV instead which is a customized version of
lowerConstant that supports generic() and nested expressions.

Differential Revision: https://reviews.llvm.org/D127878
2022-10-04 00:29:42 +03:00
Andrew Savonichev 5585d99835 [NVPTX] Fix issues in ptxas integration to LIT tests
1) Fixed a typo in PTXAS_EXECUTABLE CMake variable (PXTAS -> PTXAS).

2) Version check was implemented incorrectly,
   now version (major, minor) is converted to int for comparison.

3) ptxas -arch argument was incorrect (or missing) in 3 tests.

Differential Revision: https://reviews.llvm.org/D127866
2022-10-04 00:29:42 +03:00
Shu-Chun Weng 3933c43d90 [clang] Add cc1 option -fctor-dtor-return-this
This option forces constructors and non-deleting destructors to return
`this` pointer in C++ ABI (except for Microsoft ABI, on which this flag
has no effect).

This is similar to ARM32, Apple ARM64, or Fuchsia C++ ABI, but can be
applied to any target triple.

Differential Revision: https://reviews.llvm.org/D119209
2022-10-03 14:28:06 -07:00
Tom Honermann 4247cdb568 [clang]: Add DeclContext::dumpAsDecl().
This change enables a declaration to be conveniently displayed within
a debugger when only a pointer to its DeclContext is available. For example,
in gdb:
  (gdb) p Ctx
  $1 = (const clang::DeclContext *) 0x14c1a580
  (gdb) p Ctx->dumpAsDecl()
  ClassTemplateSpecializationDecl 0x14c1a540 <t.cpp:1:1, line:7:1> line:2:8 struct ct
  `-TemplateArgument type 'int'
    `-BuiltinType 0x14bac420 'int'
  $2 = void

In the event that the pointed to DeclContext is invalid (that it has an
invalid DeclKind as a result of a dangling pointer, memory corruption, etc...)
it is not possible to dump its associated declaration. In this case, the
DeclContext will be reported as invalid. For example, in gdb:
  (gdb) p Ctx->dumpAsDecl()
  DeclContext 0x14c1a580 <unrecognized Decl kind 127>
  $3 = void
2022-10-03 17:25:44 -04:00
Matheus Izvekov 69a6417406
[clang] Implement divergence for TypedefType and UsingType
With this patch, TypedefTypes and UsingTypes can have an
underlying type which diverges from their corresponding
declarations.

For the TypedefType case, this can be seen when getting
the common sugared type between two redeclarations with
different sugar.

For both cases, this will become important as resugaring
is implemented, as this will allow us to resugar these
when they were dependent before instantiation.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D133468
2022-10-03 23:23:58 +02:00
Bjorn Pettersson eda6ff3472 [test][Transform/Utils] Update tests to opaque pointer syntax. NFC
This patch converts test cases that simly could be rewritten
using the script at
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
2022-10-03 23:01:43 +02:00
Aart Bik 83f2b19f3e [mlir] fix bazel file
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135104
2022-10-03 13:58:45 -07:00