Marek Kurdej [Thu, 3 Mar 2022 14:37:43 +0000 (15:37 +0100)]
[clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine: Inline/InlineOnly`.
Fixes https://github.com/llvm/llvm-project/issues/54147.
When handling `AllowShortFunctionsOnASingleLine`, we were searching for the last line with a smaller level than the current line. The search was incorrect when the first line had the same level as the current one. This led to an unsatisfied assumption about the existence of a brace (non-comment token).
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D120902
Louis Dionne [Mon, 7 Mar 2022 15:26:33 +0000 (10:26 -0500)]
[libc++][NFC] Improve release note formatting
Roman Lebedev [Mon, 7 Mar 2022 13:54:57 +0000 (16:54 +0300)]
update_analyze_test_checks.py: fix UTC_ARGS handling
They should be both used if provided in the input test
and manifested in the updated test.
Kadir Cetinkaya [Mon, 7 Mar 2022 11:51:13 +0000 (12:51 +0100)]
[clang] Adjust LookupTest for UsingTypeLocs
We no longer traverse the underlying RecordTypeLoc directly, but rather
visit the UsingTypeLoc.
Differential Revision: https://reviews.llvm.org/D121103
Richard [Fri, 4 Mar 2022 00:18:08 +0000 (17:18 -0700)]
[clang-tools-extra] Document clang tidy unit tests target
Differential Revision: https://reviews.llvm.org/D121019
Sam McCall [Mon, 7 Mar 2022 12:45:44 +0000 (13:45 +0100)]
[pseudo] Add readme
Differential Revision: https://reviews.llvm.org/D121108
Louis Dionne [Mon, 7 Mar 2022 14:00:17 +0000 (09:00 -0500)]
[libc++][NFC] Add missing whitespace in release notes
Endre Fülöp [Mon, 7 Mar 2022 13:53:26 +0000 (14:53 +0100)]
[analyzer] Fix buildbot failure for D120369
Fix test case for GenericTaintChecker.
Redefinition of types is a C11 feature, and it broke a buildbot.
Commit amended:
4fd6c6e65ab59f82284d8272aa3bec8d5084511e.
LLVM GN Syncbot [Mon, 7 Mar 2022 13:49:22 +0000 (13:49 +0000)]
[gn build] Port
311ff3917827
Louis Dionne [Thu, 3 Feb 2022 20:42:40 +0000 (15:42 -0500)]
[libc++] Add missing header <cuchar>
Fixes llvm-project#44216
Differential Revision: https://reviews.llvm.org/D97870
Florian Hahn [Mon, 7 Mar 2022 13:33:50 +0000 (13:33 +0000)]
[ConstraintElimination] Use ZExtValue for unsigned decomposition.
When decomposing constraints for unsigned conditions, we can use
negative values by zero-extending them, as long as they are less than
the maximum constraint value.
Fixes https://github.com/llvm/llvm-project/issues/54224
Florian Hahn [Mon, 7 Mar 2022 13:33:08 +0000 (13:33 +0000)]
[ConstraintElimination] Add tests inspired by PR54224.
Uday Bondhugula [Sat, 5 Mar 2022 18:04:57 +0000 (23:34 +0530)]
Update normalizeAffineFor to canonicalize maps/operands before using them
Update normalizeAffineFor utility to canonicalize maps and operands
before using them.
Differential Revision: https://reviews.llvm.org/D121086
Diana Picus [Mon, 7 Mar 2022 12:53:49 +0000 (12:53 +0000)]
[flang] Update tco after
0dc66b76fe4c
Minor fix to appease the buildbots.
Matthias Springer [Mon, 7 Mar 2022 12:27:53 +0000 (21:27 +0900)]
[mlir][shape] Migrate bufferization to BufferizableOpInterface
Differential Revision: https://reviews.llvm.org/D121043
Roman Lebedev [Mon, 7 Mar 2022 12:37:06 +0000 (15:37 +0300)]
update_analyze_test_checks.py: fix --filter handling
In particular, after filtering the check lines can't necessarily
use `-NEXT`, they may not be one directly after another.
Adrian Kuegel [Mon, 7 Mar 2022 12:25:36 +0000 (13:25 +0100)]
[mlir][Bazel] Remove unused dependencies (NFC)
Differential Revision: https://reviews.llvm.org/D121106
Christian Sigg [Mon, 7 Mar 2022 12:04:05 +0000 (13:04 +0100)]
[MLIR] Fix bazel BUILD file after Parser.h moved.
See D121024, D121025, D121026.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D121094
Endre Fülöp [Tue, 1 Mar 2022 08:40:49 +0000 (09:40 +0100)]
[analyzer] Add more propagations to Taint analysis
Add more functions as taint propators to GenericTaintChecker.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D120369
Florian Hahn [Mon, 7 Mar 2022 12:01:15 +0000 (12:01 +0000)]
[ConstraintElimination] Only add cond from assume to succs if valid.
Add missing CanAdd check before adding a condition from an assume
to the successor blocks. When adding information from assume to
successor blocks we need to perform the same CanAdd as we do for adding
a condition from a branch.
Fixes https://github.com/llvm/llvm-project/issues/54217
Florian Hahn [Mon, 7 Mar 2022 12:01:09 +0000 (12:01 +0000)]
[ConstraintElimination] Add test case for PR54217.
Adds test case for https://github.com/llvm/llvm-project/issues/54217.
Mehdi Amini [Mon, 7 Mar 2022 11:18:20 +0000 (11:18 +0000)]
Partially revert
03e6d10cac86: it broke the build
Mehdi Amini [Mon, 7 Mar 2022 11:11:09 +0000 (11:11 +0000)]
Revert "Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)"
This reverts commit
393c6db7a173836b4ee350ad5598ed67b8fb14b9.
This broke the build.
Heiko Thiel [Mon, 7 Mar 2022 11:07:11 +0000 (12:07 +0100)]
[README] Add hint, how to use automatically the optimal number of CPU cores
Nikita Popov [Thu, 3 Mar 2022 15:10:09 +0000 (16:10 +0100)]
[Attributor] Remove restriction on simplifying function pointers
Dropping this restriction seems to work fine (there are no assertion
failures), so it appears that either the updater got smarter or the
problematic cases are restricted elsewhere.
If doing this still causes issues, then the place to address it
would probably be https://github.com/llvm/llvm-project/blob/
8f5bdaf481c3f4e6876a5ae0e4d7c6ed2042e6a6/llvm/lib/Transforms/IPO/Attributor.cpp#L1856-L1859,
which already prevents replacement outside the SCC, so I'm not
quite sure what this check is intended to avoid.
Differential Revision: https://reviews.llvm.org/D120987
Alex Bradbury [Mon, 7 Mar 2022 10:53:29 +0000 (10:53 +0000)]
[CODE_OWNERS/CREDITS] Update my email address
Mehdi Amini [Mon, 7 Mar 2022 10:12:48 +0000 (10:12 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:47 +0000 (10:12 +0000)]
Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:46 +0000 (10:12 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:44 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-use-emplace to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:43 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:39 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-loop-convert to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:38 +0000 (10:12 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:37 +0000 (10:12 +0000)]
Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)
Nikita Popov [Fri, 4 Mar 2022 12:07:58 +0000 (13:07 +0100)]
[CoroElide] Remove fallback for frame layout determination
Only determine the frame layout based on dereferenceable and align
attributes, and remove the type-based fallback, which is incompatible
with opaque pointers. The dereferenceable attribute is required,
while the align attribute uses default alignment of 1 (commonly,
align 1 attributes do not get placed, relying on default alignment).
The CoroSplit pass producing the resume function adds the necessary
attributes in https://github.com/llvm/llvm-project/blob/
7daed359111f6d151fef447f520f85ef1dabedf6/llvm/lib/Transforms/Coroutines/CoroSplit.cpp#L840,
and their presence is checked in coro-debug.ll at least.
Differential Revision: https://reviews.llvm.org/D120988
Jan Svoboda [Mon, 7 Mar 2022 10:21:06 +0000 (11:21 +0100)]
[clang][modules] Fix failing test
This test started failing on Windows after
b45888e959ad2d6562b8d321166e6387facdd412 due to path separators not matching up.
Simon Atanasyan [Mon, 7 Mar 2022 10:08:12 +0000 (13:08 +0300)]
Remove Simon Atanasyan from the code owners list. MIPS Backend.
Nikita Popov [Fri, 4 Mar 2022 14:09:57 +0000 (15:09 +0100)]
[Coroutines] Allow FramePtr to be an Argument
With opaque pointers, after splitRetconCoroutine() the FramePtr
may be an Argument rather than an Instruction. With typed pointers,
this currently doesn't happen because the FramePtr would be a
bitcast instruction.
Fix this by making FramePtr a Value and adding a helper for the
"after FramePtr" insertion point, which would be the start of the
function in the Argument case.
Differential Revision: https://reviews.llvm.org/D120994
Jan Svoboda [Mon, 7 Mar 2022 09:22:06 +0000 (10:22 +0100)]
[clang][modules] Report module maps affecting `no_undeclared_includes` modules
Since D106876, PCM files don't report module maps as input files unless they contributed to the compilation.
Reporting only module maps of (transitively) imported modules is not enough, though. For modules marked with `[no_undeclared_includes]`, other module maps affect the compilation by introducing anti-dependencies.
This patch makes sure such module maps are being reported as input files.
Depends on D120463.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D120464
Jan Svoboda [Mon, 7 Mar 2022 09:21:30 +0000 (10:21 +0100)]
[clang][modules] NFC: Simplify and clarify test
This patch simplifies a test that checks only used module map files are reported as input files in PCM files.
Instead of using opaque `diff`, this patch uses `clang -module-file-info` and `FileCheck` to verify this.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D120463
David Green [Mon, 7 Mar 2022 09:42:54 +0000 (09:42 +0000)]
[AArch64] Turn truncating buildvectors into truncates
When lowering large v16f32->v16i8 fp_to_si_sat, the fp_to_si_sat node is
split several times, creating an illegal v4i8 concat that gets expanded
into a BUILD_VECTOR. After some combining and other legalisation, it
ends up the a buildvector that extracts from 4 vectors, looking like
BUILDVECTOR(a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3,d0,d1,d2,d3). That is
really an v16i32->v16i8 truncate in disguise.
This adds a ReconstructTruncateFromBuildVector method to detect the
pattern, converting it back into the legal "concat(trunc(concat(trunc(a),
trunc(b))), trunc(concat(trunc(c), trunc(d))))" tree. The extracted
nodes could also be v4i16, in which case the truncates are not needed.
All those truncates and concats then become uzip1's, which is much
better than expanding by moving vector lanes around.
Differential Revision: https://reviews.llvm.org/D119469
Siva Chandra Reddy [Mon, 7 Mar 2022 05:56:04 +0000 (05:56 +0000)]
[libc] Fix alignment logic in TLS image size calculation.
LLVM GN Syncbot [Mon, 7 Mar 2022 09:08:13 +0000 (09:08 +0000)]
[gn build] Port
5f62156762d4
River Riddle [Sat, 5 Mar 2022 20:27:00 +0000 (12:27 -0800)]
[mlir][NFC] Move Translation.h to a Tools/mlir-translate directory
Translation.h is currently awkwardly shoved into the top-level mlir, even though it is
specific to the mlir-translate tool. This commit moves it to a new Tools/mlir-translate
directory, which is intended for libraries used to implement tools. It also splits the
translate registry from the main entry point, to more closely mirror what mlir-opt
does.
Differential Revision: https://reviews.llvm.org/D121026
River Riddle [Fri, 4 Mar 2022 21:49:30 +0000 (13:49 -0800)]
[mlir][NFC] Move MlirOptMain to the Tools/ directory
MlirOptMain is currently awkwardly shoved into mlir/Support. This commit
moves it to the Tools/ directory, which is intended for libraries used to
implement tools.
Differential Revision: https://reviews.llvm.org/D121025
River Riddle [Fri, 4 Mar 2022 20:53:22 +0000 (12:53 -0800)]
[mlir][NFC] Move Parser.h to Parser/
There is no reason for this file to be at the top-level, and
its current placement predates the Parser/ folder's existence.
Differential Revision: https://reviews.llvm.org/D121024
Florian Hahn [Mon, 7 Mar 2022 09:03:48 +0000 (09:03 +0000)]
[ConstraintElimination] Remove dead variables when dropping constraints.
This patch extends ConstraintElimination to also remove dead variables
when removing a constraint. When a constraint is removed because it is
out of scope, all new variables added for this constraint can also be
removed.
This keeps the total size of the systems much smaller, because it
reduces the number of variables drastically.
It also fixes a bug where variables where removed incorrectly.
Fixes https://github.com/llvm/llvm-project/issues/54228
Florian Hahn [Mon, 7 Mar 2022 09:03:42 +0000 (09:03 +0000)]
[ConstraintElimination] Add test from PR54228.
Test for https://github.com/llvm/llvm-project/issues/54228
Luo, Yuanke [Mon, 7 Mar 2022 08:51:42 +0000 (16:51 +0800)]
[X86] Update some of the AVX512 intrinsic tests to avoid adds.
As noticed in D119654, by adding the masked intrinsics results together
we can end up with the selects being canonicalized away from the
intrinsic - this isn't what we want to test here so replace with a
insertvalue chain into a aggregate instead to retain all the results.
Simon Moll [Mon, 7 Mar 2022 09:01:31 +0000 (10:01 +0100)]
[VP] Introducing VectorBuilder, the VP intrinsic builder
VectorBuilder wraps around an IRBuilder and
VectorBuilder::createVectorInstructions emits VP intrinsics as if they
were regular instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D105283
Nikita Popov [Thu, 3 Mar 2022 14:41:06 +0000 (15:41 +0100)]
[Attributor] Remove function pointer restriction for AAAlign
This check is not compatible with opaque pointers. We can avoid
it by adjusting the getPointerAlignment() implementation to avoid
creating unnecessary ptrtoint expressions for bitcasted pointers.
The code already uses OnlyIfReduced to not create an expression
if it does not simplify, and this makes sure that folding a
bitcast and ptrtoint into a ptrtoint doesn't count as a
simplification.
Differential Revision: https://reviews.llvm.org/D120904
David Green [Mon, 7 Mar 2022 08:57:50 +0000 (08:57 +0000)]
[AArch64] Use NPM for cost model tests. NFC
As per the other tests, this switches the run lines back to using the
NPM via
-passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output
Nikita Popov [Mon, 28 Feb 2022 10:18:18 +0000 (11:18 +0100)]
[SCEV] Enable verification under EXPENSIVE_CHECKS
SCEV verification should no longer affect results of subsequent
queries, and our lit tests as well as llvm-test-suite pass with
SCEV verification enabled, so I think we can enable it by default
under EXPENSIVE_CHECKS now.
Differential Revision: https://reviews.llvm.org/D120708
Weining Lu [Mon, 7 Mar 2022 08:38:30 +0000 (16:38 +0800)]
[LoongArch] Add EncoderMethods for transformed immediate operands
This is a split patch of D120476 and thanks to myhsu.
'Transformed' means the encoding of an immediate is not the same as
its binary representation. For example, the `bl` instruction
requires a signed 28-bits integer as its operand and the low 2 bits
must be 0. So only the upper 26 bits are needed to get encoded into
the instruction.
Based on the above reason this kind of immediate needs a customed
`EncoderMethod` to get the real value getting encoded into the
instruction.
Currently these immediate includes:
```
uimm2_plus1
simm14_lsl2
simm16_lsl2
simm21_lsl2
simm26_lsl2
```
This patch adds those `EncoderMethod`s and revises related .mir test
in previous patch.
Reviewed By: xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D120545
Nikita Popov [Fri, 25 Feb 2022 10:30:01 +0000 (11:30 +0100)]
[SCEV] Enable verification in LoopPM
Currently, we hardly ever actually run SCEV verification, even in
tests with -verify-scev. This is because the NewPM LPM does not
verify SCEV. The reason for this is that SCEV verification can
actually change the result of subsequent SCEV queries, which means
that you see different transformations depending on whether
verification is enabled or not.
To allow verification in the LPM, this limits verification to
BECounts that have actually been cached. It will not calculate
new BECounts.
BackedgeTakenInfo::getExact() is still not entirely readonly,
it still calls getUMinFromMismatchedTypes(). But I hope that this
is not problematic in the same way. (This could be avoided by
performing the umin in the other SCEV instance, but this would
require duplicating some of the code.)
Differential Revision: https://reviews.llvm.org/D120551
Adrian Kuegel [Mon, 7 Mar 2022 08:40:49 +0000 (09:40 +0100)]
[mlir] Use empty() instead of checking size() == 0 (NFC)
Nikita Popov [Thu, 17 Feb 2022 09:03:58 +0000 (10:03 +0100)]
[SCEV] Fully invalidate SCEVUnknown on RAUW
When a SCEVUnknown gets RAUWd, we currently drop it from the folding
set, but don't forget memoized values. I believe we should be
treating RAUW the same way as deletion here and invalidate all
caches and dependent expressions.
I don't have any specific cases where this causes issues right now,
but it does address the FIXME in https://reviews.llvm.org/D119488.
Differential Revision: https://reviews.llvm.org/D120033
Timm Bäder [Thu, 3 Mar 2022 11:13:48 +0000 (12:13 +0100)]
[clang][parser] Stop dragging an EndLoc around when parsing attributes
It's almost always entirely unused and if it is used, the end of the
attribute range can be used instead.
Differential Revision: https://reviews.llvm.org/D120888
Christian Sigg [Sun, 6 Mar 2022 19:55:59 +0000 (20:55 +0100)]
[MLIR] Change call sites from deprecated `parseSourceFile()` to `parseSourceFile<ModuleOp>()`.
Mark `parseSourceFile()` deprecated. The functions will be removed two weeks after landing this change.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D121075
Johannes Doerfert [Sun, 6 Mar 2022 23:37:47 +0000 (17:37 -0600)]
[Attributor] Determine potentially loaded values through memory
We already look through memory to determine where a value that is stored
might pop up again (potential copies). This patch introduces the other
direction with similar logic. If a value is loaded, we can follow all
the accesses to the pointer (or better object) and try to determine what
value might have been stored.
Johannes Doerfert [Mon, 7 Mar 2022 01:16:35 +0000 (19:16 -0600)]
[Attributor] Handle undef and null in AAAlignFloating
Both `undef` and `nullptr` are maximally aligned. This is especially
important as we often see `undef` until a proper value has been
identified during simplification.
Johannes Doerfert [Tue, 1 Mar 2022 21:22:53 +0000 (15:22 -0600)]
[Attributor] Use CFG reasoning also for read accesses
With D106397 we used CFG reasoning to filter out writes that will not
interfere with a given load instruction. With this patch we use the
same logic (modulo the reversal in reachability check order) for store
instructions. As an example, we can now proof stores to shared memory
are dead if all the loads of the shared memory are not reachable from
them.
Johannes Doerfert [Fri, 25 Feb 2022 22:44:24 +0000 (16:44 -0600)]
[Attributor] Improve isValidAtPosition (mostly for old PM)
To minimize the test difference between old and new PM we perform some
local dominance check if no dominator tree is available.
Qiu Chaofan [Mon, 7 Mar 2022 05:00:06 +0000 (13:00 +0800)]
[PowerPC] Add generic fnmsub intrinsic
Currently in Clang, we have two types of builtins for fnmsub operation:
one for float/double vector, they'll be transformed into IR operations;
one for float/double scalar, they'll generate corresponding intrinsics.
But for the vector version of builtin, the 3 op chain may be recognized
as expensive by some passes (like early cse). We need some way to keep
the fnmsub form until code generation.
This patch introduces ppc.fnmsub.* intrinsic to unify four fnmsub
intrinsics.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D116015
Johannes Doerfert [Fri, 25 Feb 2022 00:52:21 +0000 (18:52 -0600)]
[Attributor][NFCI] Introduce fine-grained anonymous namespaces
Johannes Doerfert [Fri, 25 Feb 2022 00:45:52 +0000 (18:45 -0600)]
[Attributor][OpenMPOpt][FIX] Register simplification callbacks
Heap-2-stack and heap-2-shared can replace an allocation call with
something else. To avoid us deriving information from the allocator
implementation we register a simplification callback now that will
force us to stop at the call site. We probably should create the
replacement memory eagerly and return that instead though.
Johannes Doerfert [Thu, 24 Feb 2022 23:29:31 +0000 (17:29 -0600)]
[Attributor][FIX] Use maximal access for dereferenceability deduction
While we can use range information when we derive dereferenceability we
must make sure to pick he right end of the range. Before we always went
with the minimal offset, which is not correct if we want to combine
the base dereferenceability with some offset. In that case it's the
maximum that gives the correct result.
Johannes Doerfert [Thu, 24 Feb 2022 23:27:11 +0000 (17:27 -0600)]
[Attributor][FIX] Initialize stack variable
Johannes Doerfert [Mon, 7 Mar 2022 03:27:41 +0000 (21:27 -0600)]
Revert "[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible"
This reverts commit
ff50e81b500800708db927cbccca2ab52ec11884 as it broke
the buildbots, see https://reviews.llvm.org/D121060#3362737.
Zakk Chen [Sun, 6 Mar 2022 23:05:13 +0000 (15:05 -0800)]
[RISCV] Fix incorrect optimization for masked vmsgeu.vi with 0 immediate.
vmsgeu.vi with 0 is always true, but in the masked with mask undisturbed
policy, we still need to keep inactive elelemt which come from maskedoff.
We could return mask directly if it's mask agnostic policy in the future.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121080
Johannes Doerfert [Wed, 2 Mar 2022 19:34:24 +0000 (13:34 -0600)]
[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible
Differential Revision: https://reviews.llvm.org/D121060
Johannes Doerfert [Mon, 7 Feb 2022 23:04:39 +0000 (17:04 -0600)]
[Attributor][NFCI] No repeated manifest of AAValueSimplifyReturned (CGSCC)
Johannes Doerfert [Mon, 7 Feb 2022 22:13:02 +0000 (16:13 -0600)]
[Attributor][NFC] Expose helper with more generic interface
This simply makes the function argument of the
`Attributor::checkForAllInstructions` helper explicit so one can iterate
over instructions in other functions.
Johannes Doerfert [Mon, 7 Feb 2022 21:24:59 +0000 (15:24 -0600)]
[Attributor][NFC] Improve debug messages
William S. Moses [Sat, 5 Mar 2022 23:04:19 +0000 (18:04 -0500)]
[OpenMPIRBuilder] Allocate temporary at the correct block in a nested parallel
The OpenMPIRBuilder has a bug. Specifically, suppose you have two nested openmp parallel regions (writing with MLIR for ease)
```
omp.parallel {
%a = ...
omp.parallel {
use(%a)
}
}
```
As OpenMP only permits pointer-like inputs, the builder will wrap all of the inputs into a stack allocation, and then pass this
allocation to the inner parallel. For example, we would want to get something like the following:
```
omp.parallel {
%a = ...
%tmp = alloc
store %tmp[] = %a
kmpc_fork(outlined, %tmp)
}
```
However, in practice, this is not what currently occurs in the context of nested parallel regions. Specifically to the OpenMPIRBuilder,
the entirety of the function (at the LLVM level) is currently inlined with blocks marking the corresponding start and end of each
region.
```
entry:
...
parallel1:
%a = ...
...
parallel2:
use(%a)
...
endparallel2:
...
endparallel1:
...
```
When the allocation is inserted, it presently inserted into the parent of the entire function (e.g. entry) rather than the parent
allocation scope to the function being outlined. If we were outlining parallel2, the corresponding alloca location would be parallel1.
This causes a variety of bugs, including https://github.com/llvm/llvm-project/issues/54165 as one example.
This PR allows the stack allocation to be created at the correct allocation block, and thus remedies such issues.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D121061
Michael Kruse [Sun, 6 Mar 2022 22:22:09 +0000 (16:22 -0600)]
[mlir][support] Fix msvc build.
Add typename keyword to help the C++ parser to disambiguate dependent
qualified name after D120852/1c941d. Fixes the msvc build.
mydeveloperday [Sun, 6 Mar 2022 20:02:11 +0000 (20:02 +0000)]
[clang-format] NFC update LLVM overall clang-formatted status
A 1% increase in the number of clang-formatted files.
An additional 530 files have been added to LLVM, and an additional
450 files are now clang-format clean. Raising the overall % to 53%
There are now 8857 files clean out of 16432 (ignoring lit tests)
David Green [Sun, 6 Mar 2022 18:35:34 +0000 (18:35 +0000)]
[DAG] Don't convert undef to 0 when creating buildvector
When inserting undef into buildvectors created from shuffles of
buildvectors, we convert elements to the largest needed type. This had
the effect of converting undef into 0, which isn't needed as the
buildvector implicitly truncates and trunc(zext(undef)) == undef.
Differential Revision: https://reviews.llvm.org/D121002
Benjamin Kramer [Sun, 6 Mar 2022 18:22:31 +0000 (19:22 +0100)]
[Hexagon] Move single-use global tables into their only user and turn them into StringSwitch
Delete the unused globals. NFCI.
Simon Pilgrim [Sun, 6 Mar 2022 17:23:51 +0000 (17:23 +0000)]
[X86] Update AVX512-BW mask intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Simon Pilgrim [Sun, 6 Mar 2022 17:05:44 +0000 (17:05 +0000)]
[X86] Update AVX512 rotate intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Simon Pilgrim [Sun, 6 Mar 2022 16:58:29 +0000 (16:58 +0000)]
[X86] Update AVX512-VNNI mask intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Benjamin Kramer [Sun, 6 Mar 2022 12:24:42 +0000 (13:24 +0100)]
Drop some more global std::maps. NFCI.
Florian Hahn [Sun, 6 Mar 2022 11:14:41 +0000 (11:14 +0000)]
[LoopSink] Do not try to sink phi nodes.
Skip phi nodes in the preheader. They may not be considered loop
invariant by the assertion below.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D121010
Groverkss [Sun, 6 Mar 2022 11:12:20 +0000 (16:42 +0530)]
[MLIR][Presburger][NFC] Fix PresburgerLocalSpace::print() output
This change puts a colon before before the printing number of locals in
PresburgerLocalSpace::print().
Jun Zhang [Sun, 6 Mar 2022 05:01:49 +0000 (13:01 +0800)]
[Clang] Use = default(NFC)
Craig Topper [Sun, 6 Mar 2022 05:26:28 +0000 (21:26 -0800)]
[RISCV] Add SimplifyDemandedBits support for FSR/FSL/FSRW/FSLW.
James Beddek [Sun, 6 Mar 2022 04:20:28 +0000 (20:20 -0800)]
[OpenMP][CMake] Ensure linking against libm for Linux
Do the same as is done for NetBSD. Some compiler-rt/lib/builtins files call
libm functions (e.g. fmaxl, fabs). Linking libomp with --rtlib=compiler-rt
references these functions.
Downstream report: https://bugs.gentoo.org/816831
Fixes: https://github.com/llvm/llvm-project/issues/51457
Shilei Tian [Sun, 6 Mar 2022 03:37:46 +0000 (22:37 -0500)]
[OpenMP][CMake] Clean up the CMake variable `LIBOMPTARGET_LLVM_INCLUDE_DIRS`
`LIBOMPTARGET_LLVM_INCLUDE_DIRS` is currently checked and included for
multiple times redundantly. This patch is simply a clean up.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D121055
Kai Luo [Sun, 6 Mar 2022 00:55:22 +0000 (00:55 +0000)]
[libcxx][atomic] Remove workaround for PR31864
I believe the origin issue in PR31864 has been addressed by https://reviews.llvm.org/D59566.
As discussed in https://github.com/llvm/llvm-project/issues/53840, `ATOMIC_LLONG_LOCK_FREE == 2` sometimes is not consistent with `std::atomic<long long>::is_always_lock_free`, since the macro takes `long long`'s ABI alignment into account. https://reviews.llvm.org/D28213 proposed we should not rely on ABI alignment of types, thus we have consistent `ATOMIC_LLONG_LOCK_FREE` and `std::atomic<long long>::is_always_lock_free` on x86's old cpu. Currently, I plan to move on to remove the workaround which should have been addressed and don't want to break current tests.
Reviewed By: #libc, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D119931
Benjamin Kramer [Sat, 5 Mar 2022 21:24:20 +0000 (22:24 +0100)]
[YAML] Simplify code a bit. NFC.
owenca [Sat, 5 Mar 2022 07:45:50 +0000 (23:45 -0800)]
[clang-format] Handle goto labels for RemoveBracesLLVM
Differential Revision: https://reviews.llvm.org/D121042
Florian Hahn [Sat, 5 Mar 2022 19:46:27 +0000 (19:46 +0000)]
[IVDescriptor] Remove SinkCandidate from SinkAfter before re-sinking.
This ensures the right order in the sink-after map is maintained. If we
re-sink an instruction, it must be sunk after all earlier instructions
have been sunk.
Fixes https://github.com/llvm/llvm-project/issues/54223
Benjamin Kramer [Sat, 5 Mar 2022 19:32:37 +0000 (20:32 +0100)]
Make ParsedAttrInfo and subclasses use constexpr construction
This removes a 30 kB global initializer. NFCI.
AndreyChurbanov [Sat, 5 Mar 2022 18:46:39 +0000 (21:46 +0300)]
[OpenMP] libomp: omp_in_explicit_task() implemented.
Differential Revision: https://reviews.llvm.org/D120671
David Green [Sat, 5 Mar 2022 18:35:43 +0000 (18:35 +0000)]
[AArch64] Some tests to show reconstructing truncates. NFC
Benjamin Kramer [Sat, 5 Mar 2022 18:31:44 +0000 (19:31 +0100)]
Drop iostream include, which is forbidden in LLVM
Nikolas Klauser [Sat, 5 Mar 2022 18:17:07 +0000 (19:17 +0100)]
[libc++] Granularize <utility> includes
Reviewed By: ldionne, #libc
Spies: EricWF, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D120466
Benjamin Kramer [Sat, 5 Mar 2022 18:16:01 +0000 (19:16 +0100)]
[OpenCL] Turn global vector into static array. NFCI.
mydeveloperday [Sat, 5 Mar 2022 18:07:16 +0000 (18:07 +0000)]
[clang-format] QualifierOrder does not reorder template arguments
https://github.com/llvm/llvm-project/issues/53981
Reorder the qualifiers inside the template argument. This should handle the simple cases of
```
<const T>
<T const>
```
But only by relaxing that single letter capital variables are not possible macros
Fixes: #53981
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D120710