Commit Graph

434820 Commits

Author SHA1 Message Date
Utkarsh Saxena e7eec38246 [clang] Skip re-building lambda expressions in parameters to consteval fns.
As discussed in this [comment](https://github.com/llvm/llvm-project/issues/56183#issuecomment-1224331699),
we end up building the lambda twice: once while parsing the function calls and then again while handling the immediate invocation.

This happens specially during removing nested immediate invocation.
Eg: When we have another consteval function as the parameter along with this lambda expression. Eg: `foo(bar([]{}))`, `foo(bar(), []{})`

While removing such nested immediate invocations, we should not rebuild this lambda. (IIUC, rebuilding a lambda would always generate a new type which will never match the original type from parsing)

Fixes: https://github.com/llvm/llvm-project/issues/56183
Fixes: https://github.com/llvm/llvm-project/issues/51695
Fixes: https://github.com/llvm/llvm-project/issues/50455
Fixes: https://github.com/llvm/llvm-project/issues/54872
Fixes: https://github.com/llvm/llvm-project/issues/54587

Differential Revision: https://reviews.llvm.org/D132945
2022-09-02 12:30:52 +02:00
Mikael Holmen 51d4c7ceea [GlobalOpt] Fix debug variance problem in hasOnlyColdCalls
hasOnlyColdCalls skipped over calls to intrinsics, but it did so after
checking the linkage of the called function. This meant that the presence
of a call to a debug intrinsic could affect the outcome of the
optimization.

In my original reproducer (for an out of tree target) it was particularly
interesting, because the actual IR after GlobalOpt was not different with
debug instrinsics present, so -print-after-all printouts didn't show
anything there.

However, without debuginfo, GlobalOpt went further and ran
BlockFrequencyAnalysis and (more importanly) LoopAnalysis, and later on in
the pipeline, instcombine behaved in different ways when LoopInfo was
present.

So a call to a dbg.declare prevented running LoopAnalysis in
GlobalOpt, which later prevented InstCombine from doing an optimization.

The dbg-intrinsic-loopanalysis.ll testcase tries to expose this.

Then I also noted that adding a dbg.declare actually made the existing
testcase colccc_coldsites.ll generate different code, so I modified that
to now test it behaves the same way with and without the dbg.declare.

Reviewed By: nikic, fhahn

Differential Revision: https://reviews.llvm.org/D133193
2022-09-02 12:29:44 +02:00
Sergey Kachkov be37caca00 [JumpThreading] Process range comparisions with non-local cmp instructions
Use getPredicateOnEdge method if value is a non-local
compare-with-a-constant instruction, that can give more precise
results than getConstantOnEdge.

Differential Revision: https://reviews.llvm.org/D131956
2022-09-02 12:22:45 +02:00
Andrey Tretyakov f20c9c42d2 [SPIRV] Add tests to improve test coverage
Differential Revision: https://reviews.llvm.org/D132903
2022-09-02 13:19:28 +03:00
wanglei 14e8741f32 [LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC)
The bash syntax `|&` is unsupported on other shells.

Differential Revision: https://reviews.llvm.org/D133187
2022-09-02 18:10:54 +08:00
Simon Pilgrim 7338f9709b [TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values
I'm not sure how much to add to the description as we've tried to allow targets to interpret the TargetCostKind enums in their own way. But we need to make it clear that certain cost kinds need to match threshold numbers used by various passes (and vice-versa when passes are determining a cost-benefit threshold).

I'm not keen on the "The weighted sum of size and latency" description, but its very difficult to come up with anything else that's suitably generic (e.g. X86 will use uop counts here to easily work with LoopMicroOpBufferSize thresholds, even though high latency fdiv/fsqrt instructions still often have low uop counts).

Differential Revision: https://reviews.llvm.org/D132288
2022-09-02 11:09:06 +01:00
WANG Xuerui 2dd434c3ee [LoongArch] Support lowering br_jt
Jump tables cannot be generated yet, due to missing support for emitting
local addresses.

Differential Revision: https://reviews.llvm.org/D132653
2022-09-02 17:57:50 +08:00
Mats Petersson 43159b5808 [FLANG][NFCI]De-duplicate code in SimplifyIntrinsics
This removes a bunch of duplicated code, by adding an intermediate
function simplifyReduction that takes a std::function argument
for the actual replacement of the code.

No functional change intended.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D132588
2022-09-02 10:49:25 +01:00
Nikita Popov 10dfcf1f87 [LICM] Add test for missed load promotion opportunity (NFC) 2022-09-02 11:36:07 +02:00
Chuanqi Xu 085e8cd8d3 [NFC] Cleanup lookup for coroutine allocation/deallocation 2022-09-02 17:24:52 +08:00
Nicolas Vasilache fa8a10a1fd [mlir][Vector] Refactor vector distribution and fix an issue related to non-homogenous transfer indices.
Running: `mlir-opt -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if -canonicalize -verify-each=0`.

Prior to this revision, IR resembling the following would be produced:
```
  %4 = "vector.load"(%3, %arg0) : (memref<1x32xf32, 3>, index) -> vector<1x1xf32>
```
This fails verification since it needs 2 indices to load but only 1 is provided.

Differential Revision: https://reviews.llvm.org/D133106
2022-09-02 02:18:26 -07:00
Christian Sigg 0816b629c9 [MLIR] Remove unused config attributes from lit.site.cfg.py
Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D132726
2022-09-02 11:05:39 +02:00
Andrey Tretyakov 13453c9861 [SPIRV] Add tests to improve test coverage
Differential Revision: https://reviews.llvm.org/D132817
2022-09-02 11:59:18 +03:00
Adrian Kuegel 3730658ed9 [mlir][Linalg] Apply ClangTidy performance finding.
Loop variable is copied but only used as const reference.
2022-09-02 10:57:28 +02:00
Sinan Lin 1334e129a3 [cmake] Append CLANG_LIBDIR_SUFFIX to scan-build-py installation destination
met this issue when building llvm with config LLVM_LIBDIR_SUFFIX=64, and
the installation destination of scan-build-py does not respect the given
suffix.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D133160
2022-09-02 16:18:15 +08:00
Freddy Ye 66f332bc1a [X86] Add missing key feature for core2
Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D133094
2022-09-02 16:06:07 +08:00
Valentin Clement 4ed30c81d3
[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime
This patch adds contiguity check with the runtime to avoid copyin/copyout
in case the actual argument is actually contiguous.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D133097
2022-09-02 09:47:53 +02:00
Nikita Popov c453e5b901 Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI"
This reverts commit cd8f3e7581.

As pointed out by Eli on the review, this is missing an alignment
check. The value might be written at an offset.
2022-09-02 09:28:48 +02:00
Nikita Popov 639d912282 [LICM] Allow load-only scalar promotion in the presence of unwinding
Currently, we bail out of scalar promotion if the loop may unwind
and the memory may be visible on unwind. This is because we can't
insert stores of the promoted value on unwind edges.

However, nowadays scalar promotion also has support for only
promoting loads, while leaving stores in place. This kind of
promotion is safe even in the presence of unwinding.

Differential Revision: https://reviews.llvm.org/D133111
2022-09-02 09:27:13 +02:00
luxufan cd8f3e7581 [DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
For noop store of the form of LoadI and StoreI,
An invariant should be kept is that the memory state of the related
MemoryLoc before LoadI is the same as before StoreI.
For this example:
```
define void @pr49927(i32* %q, i32* %p) {
  %v = load i32, i32* %p, align 4
  store i32 %v, i32* %q, align 4
  store i32 %v, i32* %p, align 4
  ret void
}
```
Here the definition of the store's destination is different with the
definition of the load's destination, which it seems that the
invariant mentioned above is broken. But the definition of the
store's destination would write a value that is LoadI, actually, the
invariant is still kept. So we can safely ignore it.

Differential Revision: https://reviews.llvm.org/D132657
2022-09-02 06:37:41 +00:00
Lang Hames acce424111 [ORC-RT] Fix typo.
Removes the stray '$' that slipped in to c1c585a065.
2022-09-01 23:16:45 -07:00
Lang Hames c1c585a065 [ORC-RT] Don't unconditionally add dependence on llvm-jitlink.
Commit 4adc5bead4 moved a dependence on llvm-jitlink from
SANITIZER_COMMON_LIT_TEST_DEPS to ORC_TEST_DEPS, but in doing so it moved it
out from under a 'NOT COMPILER_RT_STANDALONE_BUILD ...' conditional. This led
to failures on standalone builds.

This commit adds the conditional to the ORC_TEST_DEPS assignment to work
around the issue while we look a longer term fix.

rdar://99453446
2022-09-01 22:53:30 -07:00
Aart Bik 2ddfacd95c [mlir][sparse] codegen for sparse dealloc
Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D133171
2022-09-01 22:21:20 -07:00
Craig Topper 11881a8f3f [RISCV] Rename some V extension multiclasses for consistency. NFC
Use "SDNode" in the name is the convention for the VLMax patterns
in RISCVInstrInfoVSDPatterns.td. This files use "VL".
2022-09-01 22:17:08 -07:00
Kazu Hirata 4535dbd559 [lldb] Fix a warning
This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:51:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2022-09-01 22:14:25 -07:00
Aart Bik f27b806df5 [mlir][sparse] codegen for trivial tensor cast
Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D133176
2022-09-01 21:55:18 -07:00
Fangrui Song 1b726f0a4c [AArch64InstPrinter] Add some `<reg:...>` for llvm-mc --mdis output 2022-09-01 21:34:56 -07:00
Antonio Frighetto f0c50447f6 [X86InstPrinter] Introduce markup tags emission
x86 assembly syntax emission now leverages markup tags, if enabled.

Differential Revision: https://reviews.llvm.org/D129869
2022-09-01 21:04:35 -07:00
Antonio Frighetto 4e99079774 [AArch64InstPrinter] Introduce immediate markup tags emission
AArch64 assembly syntax emission now leverages markup tags for immediates, if enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D129871
2022-09-01 20:58:42 -07:00
Lang Hames 6ca9f42189 [ORC][ORC-RT] Consistently use pointed-to type as template arg to wrap/unwrap.
Saves wrap/unwrap implementers from having to use std::remove_pointer_t to get
at the pointed-to type.
2022-09-01 20:54:24 -07:00
Antonio Frighetto cbb2141f7f [MipsInstPrinter] Introduce markup tags emission
MIPS assembly syntax emission now leverages markup tags, if enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D129867
2022-09-01 20:52:09 -07:00
Chenbing Zheng bb0e6b7721 [InstCombine] Precommit tests for umul_with_overflow. nfc 2022-09-02 11:18:17 +08:00
Vitaly Buka ad3a77df2d [msan] Fix debug info with getNextNode
When we want to add instrumentation after
an instruction, instrumentation still should
keep debug info of the instruction.

Reviewed By: kda, kstoimenov

Differential Revision: https://reviews.llvm.org/D133091
2022-09-01 20:13:56 -07:00
Chenbing Zheng d30cf77cb1 [InstCombine] complete fold extractvalue (any_mul_with_overflow X, -1)
When we do extractvalue (any_mul_with_overflow X, -1) --> (-X and icmp),
which left partly failed to match vector constant with poison element.
This patch try to fix it.

Alive2: https://alive2.llvm.org/ce/z/2rGp_3

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D132996
2022-09-02 10:58:42 +08:00
Vitaly Buka ad2b356f85 [msan] Use no-origin functions when possible
Saves 1.8% of .text size on CTMark

Reviewed By: kda

Differential Revision: https://reviews.llvm.org/D133077
2022-09-01 19:18:38 -07:00
Emmmer ff7b876aa7 [LLDB][RISCV] Add more instruction decode and execute for EmulateInstructionRISCV
Add:
- most of instructions from RVI base instructions set.
- some instruction decode tests from objdump.

Further work:
- implement riscv imac extension.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D132789
2022-09-02 10:17:09 +08:00
Chenbing Zheng 4db9edfdb6 [NFC] fix typo 2022-09-02 10:04:52 +08:00
Vitaly Buka 16f6c37c7e [test][msan] Add implicit-check-not rename some prefixes 2022-09-01 19:02:11 -07:00
Katherine Rasmussen 7dbbf77e1f [flang] Add lcobound and ucobound to the list of intrinsics
Add the coarray intrinsic functions, lcobound and ucobound, to the
list of intrinsics. For both of these functions, add a check to
ensure that if the optional dim argument is present and statically
checkable, its value is in the inclusive range of 1 and the corank
of the coarray argument. In the semantics tests for lcobound and
ucobound, remove the XFAIL directive, add the ERROR directives and
add additional standard-conforming and non-standard conforming
calls.

Reviewed By: klausler, craig.rasmussen

Differential Revision: https://reviews.llvm.org/D126721
2022-09-01 17:17:54 -07:00
Adrian Prantl ced4e0006f Fix inconsistent target arch when attaching to arm64 binaries on
arm64e platforms.

On arm64e-capable Apple platforms, the system libraries are always
arm64e, but applications often are arm64. When a target is created
from file, LLDB recognizes it as an arm64 target, but debugserver will
still (technically correct) report the process as being arm64e. For
consistency, set the target to arm64 here.

rdar://92248684

Differential Revision: https://reviews.llvm.org/D133069
2022-09-01 16:39:35 -07:00
Aart Bik 3ae98fd259 [mlir][sparse] added codegen for dimop, pointers, indices, values
Demonstrates how sparse tensor type -> tuple -> getter
will eventually yield actual code on the memrefs directly

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D133143
2022-09-01 16:36:10 -07:00
Artem Belevich 54c47ff939 [CUDA] Allow using -o with -fsyntax-only
-fsyntax-only breaks down CUDA compilation pipeline and make it look like
multiple independent subcompilations and that trips the multiple arguments check
when -o is specified.

We do want to allow -fsyntax-only to be used with otherwise unmodified clang
options as it's commonly used by various tooling.

Differential Revision: https://reviews.llvm.org/D133133
2022-09-01 15:52:36 -07:00
Peiming Liu ca01c996b2 [mlir][sparse] Add SparseTensorStorageExpansion Pass to expand compounded sparse tensor tuples
This patch adds SparseTensorStorageExpansion pass, it flattens the tuple used to store a sparse
tensor handle.

Right now, it only set up the skeleton for the pass, more lowering rules for sparse tensor storage
operation need to be added.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133125
2022-09-01 22:47:31 +00:00
Slava Zakharin 8fbc7e0869 [flang] Make use of do variable more consistent.
Instead of using the IV block argument of the do-loop we will use
the do-variable value loaded from its location. This usage is consistent
with other uses of the do-variable inside the loop.

Differential Revision: https://reviews.llvm.org/D133140
2022-09-01 15:46:19 -07:00
Alex Brachet f6d6e33abc [clang] Give better message for unsupported no_sanitize on globals
Previously if you specified no_sanitize("known_sanitizer") on a global you
would yield a misleading error "'no_sanitize' attribute only applies to
functions and methods", but no_sanitize("unknown") would simply be a warning,
"unknown sanitizer 'unknown' ignored". This changes the former to a warning
"'no_sanitize' attribute argument not supported for globals: known_sanitizer".

Differential Revision: https://reviews.llvm.org/D133117
2022-09-01 22:35:42 +00:00
Arthur Eubanks c911befaec [InstCombine] Treat passing undef to noundef params as UB
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D133036
2022-09-01 15:16:45 -07:00
Rob Suderman 5a231720bc [mlir][tosa] Add remaining tosa comparison folders
Added numerical splat folders for comparison operations and
equal of two identical int values.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D133138
2022-09-01 14:48:46 -07:00
Tue Ly a4d48e3b0b [libc][NFC] Use cpp::optional for checking exceptional values of math functions.
Update the utility functions for checking exceptional values of math
functions to use cpp::optional return values.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D133134
2022-09-01 17:39:12 -04:00
Rong Xu 0caa4a9559 [PGO] Support PGO annotation of CallBrInst
We currently instrument CallBrInst but do not annotate it with
the branch weight. This patch enables PGO annotation of CallBrInst.

Differential Revision: https://reviews.llvm.org/D133040
2022-09-01 14:13:50 -07:00
Arpad Borsos de3633e746 [llvm-objdump][COFF] Correctly decode `UOP_Epilog` opcodes
At least `ntdll` is using the undocumented version 2 unwind info, and opcode 6, which is already defined as `UOP_Epilog`.
Using `llvm-objdump --unwind` with `ntdll` would previously result in unreachable assertions because this code was missing from `getNumUsedSlots` and `getUnwindCodeTypeName`.
The slots of these codes comes from 57bfe47451/src/coreclr/inc/win64unwind.h (L51-L52) which I would assume is a good authoritative source.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D107655
2022-09-01 14:05:14 -07:00