Commit Graph

455417 Commits

Author SHA1 Message Date
Matt Arsenault
6705f634f6 Attributor: Start looking at uses when inferring nofpclass
Pretty much just copy pasted from noundef handling
2023-03-17 07:02:41 -04:00
Matt Arsenault
a171e98dd2 Attributor: Add baseline tests for nofpclass
Guess at suggestions from D145278
2023-03-17 07:02:41 -04:00
Dmitry Polukhin
d60d3455eb [clangd] Move standard options adaptor to CommandMangler
There is a discrepancy between how clangd processes CDB loaded from
JSON file on disk and pushed via LSP. Thus the same CDB pushed via
LSP protocol may not work as expected. Some difference between these two
paths is expected but we still need to insert driver mode and target from
binary name and expand response files.

Test Plan: check-clang-tools

Differential Revision: https://reviews.llvm.org/D143436
2023-03-17 03:10:36 -07:00
Younan Zhang
138adb0980 [clangd] Refine logic on $0 in completion snippets
We have a workaround from D128621 that makes $0 no longer being
a placeholder to conform a vscode feature. However, we have to
refine the logic as it may suppress the last parameter placeholder
for constructor of base class because not all patterns of completion
are compound statements.

This fixes clangd/clangd#1479

Reviewed By: nridge

Differential Revision: https://reviews.llvm.org/D145319
2023-03-17 17:57:24 +08:00
Tom Eccles
43eb96cab8 [flang][hlfir] lower hlfir.matmul_transpose to runtime call
Depends on D145960

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D145961
2023-03-17 09:30:04 +00:00
Tom Eccles
4ff8ba72b5 [flang] add fused matmul-transpose to the runtime
This fused operation should run a lot faster than first transposing the
lhs array and then multiplying the matrices separately.

Based on flang/runtime/matmul.cpp

Depends on D145959

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D145960
2023-03-17 09:30:04 +00:00
Tom Eccles
a351a60eba [flang][hlfir] add matmul canonicalizer
hlfir.matmul_transpose will be lowered to a new runtime call.

A canonicalizer was chosen because
  - Alternative: a new pass for rewriting chained intrinsics - this
    would add a lot of unnecessary boilerplate.
  - Alternative: including this in the HLFIR Intrinsic Lowering pass -
    I wanted to separate these two concerns: not adding a second purpose
    complicating the intrinsic lowering pass.

With this change, the MLIR built-in canonicalization pass should be run
before the HLFIR Intrinsic Lowering pass.

Depends on D145504, D145957

Reviewed By: clementval, vzakhari

Differential Revision: https://reviews.llvm.org/D145959
2023-03-17 09:30:04 +00:00
Tom Eccles
49bd444fc3 [flang][hlfir] add hlfir.matmul_transpose operation
This operation will be used to transform MATMUL(TRANSPOSE(a), b). The
transformation will go in the following stages:
        1. Lowering to hlfir.transpose and hlfir.matmul
        2. Canonicalise to hlfir.matmul_transpose
        3. hlfir.matmul_transpose will be lowered to FIR as a new runtime
          library call

Step 2 (and this operation) are included for consistency with the other
hlfir intrinsic operations and to avoid mixing concerns in the intrinsic
lowering pass.

In step 3, a new runtime library call is used because this operation is
most easily implemented in one go (the transposed indexing actually
makes the indexing simpler than for a normal matrix multiplication). In
the long run, it is intended that HLFIR will allow the same buffer
to be shared between different runtime calls without temporary
allocations, but in this specific case we can do even better than that
with a dedicated implementation.

This should speed up galgel from SPEC2000 (but this hadn't been tested
yet). The optimization was implemented in Classic Flang.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D145957
2023-03-17 09:30:04 +00:00
Tom Eccles
e29d1d0f80 [flang][hlfir] add a test chaining intrinsics
This test checks all of the parts of intrinsic lowering work together,
and makes sure that we can pass the hlfir.expr result of one intrinsic
as an argument to another.

Depends on D145503

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D145504
2023-03-17 09:30:04 +00:00
Tom Eccles
3e0f6b2eb4 [flang][hlfir] clean up intrinsic arg extended values
Depends on D145502

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D145503
2023-03-17 09:30:04 +00:00
Tom Eccles
9cbeb97024 [flang][hlfir] move intrinsic lowering out of BufferizeHLFIR
This move is useful for a few reasons:
  - It is easier to see what the intrinsic lowering is doing when the
    operations it creates are not immediately lowered
  - When lowering a HLFIR intrinsic generates an operation which needs
    to be lowered by another pattern matcher in the same pass, MLIR will
    run that other substitution before validating and finalizing the
    original changes. This means that the erasure of operations is not
    yet visible to subsequent matchers, which hugely complicates
    transformations (in this case, hlfir.exprs cannot be rewritten
    because they are still used by the now-erased HLFIR intrinsic op.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D145502
2023-03-17 09:30:04 +00:00
Dhruva Chakrabarti
acdb199a2f [OpenMP] [OMPT] [8/8] Added lit tests for OMPT target callbacks
Added a new target ompt mode that depends on libomptarget OMPT support.
Added tests that verify callbacks for target regions, kernel launch,
and data transfer operations. All of them should pass on amdgpu using
make check-libomptarget.

Reviewed By: jplehr

Differential Revision: https://reviews.llvm.org/D127372
2023-03-17 10:26:27 +01:00
Nikita Popov
a5242483e4 [SCEV] Recognize vscale intrinsics
Now that SCEV has a dedicated vscale node type, we should also map
vscale intrinsics to it. To make sure this does not regress ranges
(which were KnownBits based previously), add support for vscale to
getRangeRef() as well.

Differential Revision: https://reviews.llvm.org/D146226
2023-03-17 10:07:39 +01:00
Nikita Popov
402dfa389e [ValueTracking] Support vscale in computeConstantRange()
Add support for vscale in computeConstantRange(), based on
vscale_range attributes. This allows simplifying based on the
precise range, rather than a KnownBits approximation (which will
be off by a factor of two for the usual case of a power of two
upper bound).

Differential Revision: https://reviews.llvm.org/D146217
2023-03-17 10:03:24 +01:00
Nikita Popov
a8f6b5763e [PassBuilder] Support O0 in default pipelines
The default and pre-link pipeline builders currently require you to
call a separate method for optimization level O0, even though they
have perfectly well-defined O0 optimization pipelines.

Accept O0 optimization level and call buildO0DefaultPipeline()
internally, so all consumers don't need to repeat this.

Differential Revision: https://reviews.llvm.org/D146200
2023-03-17 10:00:05 +01:00
Bjorn Pettersson
951a980dc7 [Analysis] Make order of analysis executions more stable
When debugging and using debug-pass-manager (e.g. in regression tests)
we prefer a consistent order in which analysis passes are executed.
But when for example doing

  return MyClass(AM.getResult<LoopAnalysis>(F),
                 AM.getResult<DominatorTreeAnalysis>(F));

then the order in which LoopAnalysis and DominatorTreeAnalysis isn't
guaranteed, and might for example depend on which compiler that is
used when building LLVM.

I've not scanned the full source tree, but this fixes some occurances
of the above pattern found in lib/Analysis.

This problem was discussed briefly in review for D146206.
2023-03-17 09:33:16 +01:00
Bjorn Pettersson
81d6310da1 [LAA] Fix transitive analysis invalidation bug by implementing LoopAccessInfoManager::invalidate
The default invalidate method for analysis results is just looking
at the preserved state of the pass itself. It does not consider if
the analysis has an internal state that depend on other analyses.
Thus, we need to implement LoopAccessInfoManager::invalidate in order
to catch if LoopAccessAnalysis needs to be invalidated due to
transitive analyses such as AAManager is being invalidated. Otherwise
we might end up having references to an AAManager that is stale.

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

Differential Revision: https://reviews.llvm.org/D146206
2023-03-17 09:33:16 +01:00
Bjorn Pettersson
fed4e7d0d2 [test][MemDep] Correct the 'NOT' checks in the invalidation.ll test case. NFC
The MemoryDependenceAnalysis/invalidation.ll test case was using
  ; CHECK-NOT-AA-INVALIDATE:
but I think the intention was to use
  ; CHECK-AA-INVALIDATE-NOT:

Simply changing the checks like that would make the test fail.

The old statement that AA being stateless would result in nothing
to invalidate when doing invalidate<aa> is not true afaict.
It would be different if for example doing invalidate<basic-aa>, then
the AAManager isn't invalidated (and then neither memdep would be
invalidated). But when the AAManager itself is invalidated then we
should expect to find both "Invalidating analysis: AAManager" and
"Invalidating analysis: MemoryDependenceAnalysis" in the output.

Differential Revision: https://reviews.llvm.org/D146205
2023-03-17 09:33:16 +01:00
Xi Ruoyao
5d276380b0 [libunwind][AArch64] Unbreak building with GNU assembler
GNU assembler mandates armv8.5-a for memtag instructions. Maybe
we should remove this restriction in GNU assembler, but let's work
around it for current GNU Binutils releases.

Differential Revision: https://reviews.llvm.org/D146109
2023-03-17 09:28:20 +01:00
Hans Wennborg
4a2757d80f Make globals used for array initialization codegen constant
As pointed out in D133835 these globals will never be written to
(they're only used for trivially copyable types), so they can always be
constant.

Differential revision: https://reviews.llvm.org/D146211
2023-03-17 09:23:34 +01:00
Chuanqi Xu
c21790d023 [NFC] [C++20] [Modules] Tests that the duplicated declarations in GMF
won't get generated again

As the test shows, we don't want to see the specialized function bodies
if it is already contained in the imported modules. So we can save a lot
of compiling time then.
2023-03-17 15:58:10 +08:00
Francesco Petrogalli
ee6d07fae2 [Target][RISCV] Update SubtargetFeature definition for RV32/RV64 (NFCI).
This is done for consistency with other Predicate/Subtargetfeature
pairs, where the second parameter of the SubtargetFeature correspond
to the NAME of the def of the Predicate associated to the
SubtargetFeature.

Differential Revision: https://reviews.llvm.org/D146129
2023-03-17 08:49:45 +01:00
dbakunevich
dc9c7f5391 [Tools] Changed the number printing format for sorting
As part of this patch, I added the ability to add leading zeros.
This is necessary so that the generated files are sorted in ascending order.

Reviewed By: yrouban

Differential Revision: https://reviews.llvm.org/D145484
2023-03-17 14:35:12 +07:00
Wang, Xin10
4dd5e9c60e [X86][MC]Fix wrong action for encode movdir64b
Movdir64b is special for its mem operand, 67 prefex can not only modify its add size,
so it's mem base and index reg should be the same type as source reg, such as
movdir64b (%rdx), rcx, and could not be movdir64b (%edx), rcx.
Now llvm-mc can encode the asm 'movdir64b (%edx), rcx' but the result is the same as
'movdir64b (%edx), ecx', which offend users' intention, while gcc will object this
action and give a warning.
I add 3 new mem descriptions to let llvm-mc to report the same error.

Reviewed By: skan, craig.topper

Differential Revision: https://reviews.llvm.org/D145893
2023-03-17 03:30:16 -04:00
Ethan Luis McDonough
bde91fd03f
[flang] Feature list plugin
Plugin that counts the number of times each tree node occurs in a given program.  Used for test coverage.

> One thing we need...is a way to determine what features a code uses. Preferably we would also be able to determine if they are implemented or not. Just the former could be done with a visitor for the parse tree. For the latter we would continue compilation and somehow ignore todo errors but collect them - @jdoerfert

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D143704
2023-03-17 02:28:59 -05:00
Karl-Johan Karlsson
bb0548a6ed [compiler-rt] Avoid signed overflow in floatdidf.c and floatdisf.c
When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:

UBSan: floatdisf.c:27:15: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'di_int' (aka 'long long')

This can be avoided by doing the subtraction in a matching unsigned variant of
the type, given that the overflow is the expected result of the subtraction.

The same kind of pattern exists in floatdidf.c

This was found in an out of tree target.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D146135
2023-03-17 08:14:57 +01:00
Chuanqi Xu
684955a230 [Modules] [doc] Document the problem that we can't include headers before import declarations 2023-03-17 15:10:37 +08:00
Wang, Xin10
e3b4c1bc52 [X86]add assert to confirm not-null ptr in getArithmeticReductionCost
For the function getArithmeticReductionCost, it receive a ptr and dereferce it without check,
It is called many times in getTypeBasedIntrinsicInstrCost, the ptr passed to it is inited
from line 1709.

From the code, we can not ensure the ptr VecOpTy is inited when Tys is empty or Tys[VecTyIndex]
is not a VectorType, so that the getArithmeticReductionCost will do an undefined behavior.

I add assert to it, found the ptr passed to it in llvm tests are all not nullptr, but I think the check is
still meaningful for us.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D146118
2023-03-17 02:17:49 -04:00
Vitaly Buka
bf8f684eff Revert "[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table"
X86FoldTablesEmitter.cpp:386:26: runtime error: shift exponent -1 is negative

This reverts commit ca4c533182.
2023-03-16 23:16:00 -07:00
Chuanqi Xu
0818433a55 Remove the outdated feature macro '__cpp_coroutines'
The feature macro '__cpp_coroutines' is for coroutines TS. And the
coroutines TS is deprecated. So we should remove the feature macro too.

BTW, the corresponding feature macro for standard c++ coroutines is
'__cpp_impl_coroutine'.
2023-03-17 13:52:18 +08:00
Craig Topper
e82d2e8c11 Recommit "[Sema] Fix null pointer dereference handleAlwaysInlineAttr."
Remove use of constexpr if that failed on the build bots.

Original commit message:

It's possible for `getCalleeDecl()` to return a null pointer.

This was encountered by a user of our downstream compiler.

The case involved a DependentScopeDeclRefExpr.

Since this seems to only be for a warning diagnostic, I skipped
the diagnostic check if it returned null. But mabye there's a
different way to fix this.
2023-03-16 21:37:35 -07:00
Wang, Xin10
7bb14f196b [X86] Remove unreachable code in X86TargetTransformInfo.cpp
In Function getVectorInstrCost, situation Opcode == Instruction::ExtractElement
and Opcode == Instruction::InsertElement are all handled in the first 2 if-statements,
So we have no chance for the code in line 4401.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D145908
2023-03-17 00:33:06 -04:00
Zhangyin
9d8b60d08a [libcxx] Add status paper for Parallelism-TS
Reviewed By: #libc, philnik, Mordante

Differential Revision: https://reviews.llvm.org/D145652
2023-03-17 12:31:32 +08:00
Matt Arsenault
94026ce56d Attributor: Start inferring nofpclass
Some of this is boilerplate which doesn't do anything yet.
2023-03-16 23:19:34 -04:00
Matt Arsenault
8a37512924 ValueTracking: Extract fcmpToClassTest out of InstCombine
Also update unsigned to FPClassTest
2023-03-16 23:14:40 -04:00
Matt Arsenault
b39deda3e1 ValueTracking: Handle nofpclass in computeKnownFPClass 2023-03-16 23:14:40 -04:00
Matt Arsenault
931d4098a2 ValueTracking: Add start of computeKnownFPClass API
Add a new compute-known-bits like function to compute all
the interesting floating point properties at once.

Eventually this should absorb all the various floating point
queries we already have.
2023-03-16 23:14:40 -04:00
Craig Topper
e8a632dac2 Revert "[Sema] Fix null pointer dereference handleAlwaysInlineAttr."
This reverts commit 10297470e9.

This is failing on a build bot.
2023-03-16 20:05:33 -07:00
Craig Topper
4063369fd4 [RISCV] Add MULW to RISCVStripWSuffix.
This converts MULW to MUL if the upper bits aren't used.
This will give more opportunities to use c.mul with Zcb.
2023-03-16 19:42:33 -07:00
Vitaly Buka
35c05f04e5 Revert "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"
Breaks x86_64 qemu tests.

This reverts commit 6c756486d4.
2023-03-16 19:16:16 -07:00
Vitaly Buka
aa15fe98b6 Revert "[AMDGPUUnifyDivergentExitNodes] Add NewPM support"
Introduces nullptr dereference.

This reverts commit a5455e32b3.
2023-03-16 19:03:46 -07:00
Tue Ly
11da3de82d [libc][Obvious] Reduce the size of the tests for hypot(f). 2023-03-16 21:17:20 -04:00
Craig Topper
10297470e9 [Sema] Fix null pointer dereference handleAlwaysInlineAttr.
It's possible for `getCalleeDecl()` to return a null pointer.

This was encountered by a user of our downstream compiler.

The case involved a DependentScopeDeclRefExpr.

Since this seems to only be for a warning diagnostic, I skipped
the diagnostic check if it returned null. But mabye there's a
different way to fix this.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D146089
2023-03-16 17:49:34 -07:00
Nikolas Klauser
a7aade1f36 [runtimes] Synchronize warnings flags between libc++/libc++abi/libunwind
This mostly keeps the same warning flags. The most important exceptions are `-Wpedantic` and `-Wconversion`, which are now removed from libc++abi and libunwind.

Reviewed By: ldionne, #libunwind, #libc, #libc_abi

Spies: mikhail.ramalho, phosek, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144252
2023-03-17 00:40:59 +01:00
Daniel Thornburgh
88eb4cbbfe Remove #if guards from AppendBounds to fix compile on old POSIX. 2023-03-16 16:16:21 -07:00
Stanislav Mekhanoshin
3e12cc9463 [AMDGPU] Simplify AGPR reservation. NFC.
The intent of the code was to reserve all AGPRs on a target without
AGPRs, so just do exactly that. Existing code was unsound.
2023-03-16 16:16:10 -07:00
Alex Zinenko
46c8422d83 [mlir][transform] change RaggedArray internals
Change the internal storage scheme from storing a MutableArrayRef to
storing an explicit offset+length pair. Storing an ArrayRef is dangerous
because it contains the pointer to the first element in the range, but
the entire storage vector may be reallocated, making the pointer
dangling. We don't know when the reallocation happends, so we can't
update the ArrayRefs. Store the explicit offset instead and construct
ArrayRefs on-the-fly.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D146239
2023-03-16 23:13:53 +00:00
Shoaib Meenai
7e271c2a85 [TableGen] Fix test on macOS
macOS cmp requires the option to appear before the file names.
2023-03-16 15:43:36 -07:00
Juergen Ributzka
29e2a4eff8 [clang] Unconditionally add autolink hints for frameworks.
Clang infers framework autolink hints when parsing a modulemap. In order to do
so, it checks if the module is a framework and if there is a framework binary
or TBD file in the SDK. Only when Clang finds the filei, then the autolink hint
is added to the module metadata.

During a project build many clang processes perform this check, which causes
many stat calls - even for modules/frameworks that are not even used.

The linker is already resilient to non-existing framework links that come from
the autolink metadata, so there is no need for Clang to do this check.

Instead the autolink hints are now added unconditionally and the linker only
needs to do the check once. This reduces the overall number of stat calls.

This fixes rdar://106578342.

Differential Revision: https://reviews.llvm.org/D146255
2023-03-16 15:31:17 -07:00
Alex Langford
f341d7a409 [lldb] Make MemoryCache::Read more resilient
MemoryCache::Read is not resilient to partial reads when reading memory
chunks less than or equal in size to L2 cache lines. There have been
attempts in the past to fix this but nothing really solved the root of
the issue.

I first created a test exercising MemoryCache's implementation and
documenting how I believe MemoryCache::Read should behave. I then
rewrote the implementation of MemoryCache::Read as needed to make sure
that the different scenarios behaved correctly.

rdar://105407095

Differential Revision: https://reviews.llvm.org/D145624
2023-03-16 15:22:46 -07:00