Commit graph

419669 commits

Author SHA1 Message Date
Mark de Wever 11c14bca58 [libc++][ci] Installs Japanese locale in Docker.
The alternative outputs of std::put_time and std::strftime are the
easiest to test with the Japanese locale. This is a preparation for the
tests of the chrono formatters.

Note since it takes a while before the Docker file changes propagate to
the build nodes the verification of the locale is done in a separate
patch.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D122736
2022-03-31 17:41:06 +02:00
Mark de Wever e3ad15d7ff [libc++][doc] Update formatting status.
Reduced the details of the non-chrono formatting information. This has
been shipped and these details part of P0645 which is still documented.
Removing this information keeps the information up-to-date.

Adds the formatters required for the types chrono namespace.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D122735
2022-03-31 17:37:51 +02:00
Vince Bridgers 4d5b824e3d [analyzer] Avoid checking addrspace pointers in cstring checker
This change fixes an assert that occurs in the SMT layer when refuting a
finding that uses pointers of two different sizes. This was found in a
downstream build that supports two different pointer sizes, The CString
Checker was attempting to compute an overlap for the 'to' and 'from'
pointers, where the pointers were of different sizes.

In the downstream case where this was found, a specialized memcpy
routine patterned after memcpy_special is used. The analyzer core hits
on this builtin because it matches the 'memcpy' portion of that builtin.
This cannot be duplicated in the upstream test since there are no
specialized builtins that match that pattern, but the case does
reproduce in the accompanying LIT test case. The amdgcn target was used
for this reproducer. See the documentation for AMDGPU address spaces here
https://llvm.org/docs/AMDGPUUsage.html#address-spaces.

The assert seen is:

`*Solver->getSort(LHS) == *Solver->getSort(RHS) && "AST's must have the same sort!"'

Ack to steakhal for reviewing the fix, and creating the test case.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D118050
2022-03-31 17:34:56 +02:00
Peter Waller f1cb816f90 [AArch64][SVE] Mark {CNT*,RDVL,INDEX} as materializable
Differential Revision: https://reviews.llvm.org/D122731
2022-03-31 15:28:24 +00:00
Fraser Cormack ee51aefba0 [RISCV][NFC] Minor formatting fix 2022-03-31 16:15:22 +01:00
Jay Foad e8e32e5714 [AMDGPU] Fix typo in RUN line 2022-03-31 16:23:40 +01:00
Wenju He 0bda12b5bc [NewPM] Add OptimizerEarly module extension point
VectorizerStart extension is module callback in old PM, but is function
callback in new PM. We lack a module extension point between end of
buildModuleSimplificationPipeline and the function optimization
(including vectorizer) pipeline. So this patch adds a new module
extension point before the function optimization pipeline.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D122296
2022-03-31 08:22:27 -07:00
Groverkss 152e501d87 [MLIR][Presburger] Carry IdKind information in LinearTransform::applyTo
This patch fixes a bug in LinearTransform::applyTo where it did not carry the
IdKind information, and instead treated every id as IdKind::Domain.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D122823
2022-03-31 20:42:50 +05:30
Nico Weber d2f7547f14 [gn build] (manually) port 19246b0779 2022-03-31 11:10:18 -04:00
David Goldman d9739f29cd Serialize PragmaAssumeNonNullLoc to support preambles
Previously, if a `#pragma clang assume_nonnull begin` was at the
end of a premable with a `#pragma clang assume_nonnull end` at the
end of the main file, clang would diagnose an unterminated begin in
the preamble and an unbalanced end in the main file.

With this change, those errors no longer occur and the case above is
now properly handled. I've added a corresponding test to clangd,
which makes use of preambles, in order to verify this works as
expected.

Differential Revision: https://reviews.llvm.org/D122179
2022-03-31 11:08:01 -04:00
Changpeng Fang 1711020c37 AMDGPU: Use isLiteralConstantLike to check whether the operand could ever be literal
Summary:
  To compute the size of a VALU/SALU instruction, we need to check whether an operand
could ever be literal. Previously isLiteralConstant was used, which missed cases
like global variables or external symbols. These misses lead to under-estimation of
the instruction size and branch offset, and thus incorrectly skip the necessary branch
relaxation when the branch offset is actually greater than what the branch bits can hold.
In this work, we use isLiteralConstantLike to check the operands. It maybe conservative,
but it is safe.

Reviewers: arsenm

Differential Revision: https://reviews.llvm.org/D122778
2022-03-31 08:06:31 -07:00
Louis Dionne 0a460416e6 [libc++] Install psutil on the macOS nodes 2022-03-31 10:52:58 -04:00
Nikita Popov 0721d7c4d8 [X86] Add test for PR54369 (NFC) 2022-03-31 16:45:05 +02:00
Carlo Marcelo Arenas Belón 81f5c6270c [compiler-rt] Implement __clear_cache on FreeBSD/powerpc
dd9173420f (Add clear_cache implementation for ppc64. Fix buffer to
meet ppc64 alignment., 2017-07-28), adds an implementation for
__builtin___clear_cache on powerpc64, which was promptly ammended to
also be used with big endian mode in f67036b62c (This ppc64 implementation
of clear_cache works for both big and little endian., 2017-08-02)

clang will use this implementation for it's builtin on FreeBSD and result
in an abort() in the cases where 32-bit generation was requested (ex in
macppc or when the big endian powerpc64 build was done with "-m32") and as
reported[1] recently with pcre2, but there is no reason why the same code
couldn't be used in those cases, so use instead the more generic identifier
for the PowerPC architecture.

While at it, update the comment to reflect that POWER8/9 have a 128 byte
wide cache line and so the code could instead use 64 byte windows instead
but that possible optimization has been punted for now.

[1] https://github.com/PhilipHazel/pcre2/issues/92

Reviewed By: jhibbits, #powerpc, MaskRay

Differential Revision: https://reviews.llvm.org/D122640
2022-03-31 14:19:26 +00:00
Arjun P 9615d717d1 [MLIR][Presburger] IntegerRelation::truncate: fix bug when truncating equalities
This was truncating inequalities instead of equalities.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122811
2022-03-31 15:16:30 +01:00
Nikita Popov 33ac23e7cf [Float2Int] Avoid unnecessary lamdbas (NFC)
Instead of first creating a lambda for calculating the range,
then collecting the ranges for the operands, and then calling the
lambda on those ranges, we can first calculate the operand ranges
and then calculate the result directly in the switch.
2022-03-31 16:13:13 +02:00
Nikita Popov f66975555f [Float2Int] Extract calcRange() method (NFC)
This avoids the awkward "Abort" flag, because we can simply
early-return instead.
2022-03-31 16:13:13 +02:00
Arjun P d81fa76f3a [MLIR][Presburger] MultiAffineFunction:eliminateRedundantLocalId: fix bug where local offset was not considered
Previously, when updating the outputs matrix, the local offset was not being considered.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122812
2022-03-31 15:11:55 +01:00
Florian Hahn 8378a71b6c
Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"
This reverts the revert commit 2760cdc9c6.

This version pulls in the code to create the vector loop object in VPlan
from D121624.

This is needed because otherwise existing LoopInfo verification will
fail, as a loop block doesn't have in-loop successors now that we
do not replace the branch.

Now that we do not add new loops during skeleton construction, there's
also no need to verify LI there.
2022-03-31 14:48:32 +01:00
Louis Dionne 19246b0779 [libc++] Remove the __libcpp_version file
It seems to have been added back in 761e42fa3d for Clang to use it,
however it seems to have never been used for that purpose, so it is
probably fine to remove it.

Differential Revision: https://reviews.llvm.org/D122330
2022-03-31 09:34:41 -04:00
Vy Nguyen 33b3c86afa Revert "[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now)."
This reverts commit ea9cf2dc96.

Broke LLDB - reverting to investigage
2022-03-31 09:33:32 -04:00
Louis Dionne cb055e51f9 [libc++] Add a CI job running MSAN
For some reason, we've been going without a MSAN CI job, even though
even run-buildbot defined a generic-msan job. This must have been an
oversight that went unnoticed. Thanks to @EricWF for the catch.

Differential Revision: https://reviews.llvm.org/D120851
2022-03-31 09:31:22 -04:00
Yitzhak Mandelbaum 7f076004e9 [clang][dataflow] Add support for value_or in a comparison.
This patch adds limited modeling of the `value_or` method. Specifically, when
used in a particular idiom in a comparison to implicitly check whether the
optional holds a value.

Differential Revision: https://reviews.llvm.org/D122231
2022-03-31 13:21:39 +00:00
Sanjay Patel 4a54e3eed3 [x86] try to replace 0.0 in fcmp with negated operand
This inverts a fold recently added to IR with:
3491f2f4b0

We can put -bidirectional on the Alive2 examples to show that
the reverse transforms work:
https://alive2.llvm.org/ce/z/8iVQwB

The motivation for the IR change was to improve matching to
'fabs' in IR (see https://github.com/llvm/llvm-project/issues/38828 ),
but it regressed x86 codegen for 'not-quite-fabs' patterns like
(X > -X) ? X : -X.
Ie, when there is no fast-math (nsz), the cmp+select is not a proper
fabs operation, but it does map nicely to the unusual NAN semantics
of MINSS/MAXSS.

I drafted this as a target-independent fold, but it doesn't appear to
help any other targets and seems to cause regressions for SystemZ at
least.

Differential Revision: https://reviews.llvm.org/D122726
2022-03-31 09:17:49 -04:00
Vy Nguyen ea9cf2dc96 [llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now).
This would help making tests less brittle as the order will be fixed.

(see also PR/53026)

    Differential Revision: https://reviews.llvm.org/D116787
2022-03-31 09:13:31 -04:00
Jay Foad fdaf606c8e [AMDGPU] Fix last remaining checks in perfhint.ll
Unfortunately this just shows that the test case for D47740 never
really tested what it was supposed to test.

Differential Revision: https://reviews.llvm.org/D122664
2022-03-31 13:39:15 +01:00
Fraser Cormack a276d1f44b [RISCV][NFC] Fix formatting on one line 2022-03-31 13:17:37 +01:00
Sergei Lebedev e1fdd8048c Fixed the type of context in type stubs for MLIR Python bindings
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122795
2022-03-31 14:28:10 +02:00
Abinav Puthan Purayil 2f284b0ff9 [AMDGPU] Regenerate checks in some mir tests 2022-03-31 17:49:00 +05:30
Serge Pavlov 47b3b76825 Implement inlining of strictfp functions
According to the current design, if a floating point operation is
represented by a constrained intrinsic somewhere in a function, all
floating point operations in the function must be represented by
constrained intrinsics. It imposes additional requirements to inlining
mechanism. If non-strictfp function is inlined into strictfp function,
all ordinary FP operations must be replaced with their constrained
counterparts.

Inlining strictfp function into non-strictfp is not implemented as it
would require replacement of all FP operations in the host function,
which now is undesirable due to expected performance loss.

Differential Revision: https://reviews.llvm.org/D69798
2022-03-31 19:15:52 +07:00
Alexandros Lamprineas b4417075dc [FuncSpec] Constant propagate multiple arguments for recursive functions.
This fixes a TODO in constantArgPropagation() to make it feature complete.
However, I do find myself in agreement with the review comments in
https://reviews.llvm.org/D106426. I don't think we should pursue
specializing such recursive functions as the code size increase becomes
linear to 'max-iters'. Compiling the modified test just with -O3 (no
function specialization) generates the same code.

Differential Revision: https://reviews.llvm.org/D122755
2022-03-31 13:00:08 +01:00
Priyansh Singh 1cb299165c Fixed minor documentation issues
Fixed whitespace and punctuation issues, added a name to a link, and
fixed a typo.
2022-03-31 07:37:45 -04:00
Florian Hahn 2760cdc9c6
Revert "[LV] Remove unneeded createHeaderBranch.(NFCI)"
This reverts commit 32bc83d11e.

This is causing bots with expensive-checks to fail. Revert while I
investigate.
2022-03-31 12:32:50 +01:00
Abinav Puthan Purayil acf83abcbf [AMDGPU][GlobalISel] Remove unused variable. NFC. 2022-03-31 16:50:34 +05:30
Luo, Yuanke 6753eb0c90 [X86][AMX] Materialize undef or zero value to tilezero
The AMX combiner would store undef or zero to stack and invoke tileload
to load the data to tile register. To avoid the store/load, we can
materialzie undef or zero value to tilezero.

Differential Revision: https://reviews.llvm.org/D122714
2022-03-31 19:10:28 +08:00
Kirill Bobyrev 4cb38bfe76
[clangd] IncludeCleaner: Add support for IWYU pragma private
Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D120306
2022-03-31 12:49:52 +02:00
Florian Hahn 32bc83d11e
[LV] Remove unneeded createHeaderBranch.(NFCI)
The only remaining use was to get the exit block of the loop. Instead of
relying on the loop, use the successor of VectorHeaderBB
(LoopMiddleBlock) directly to set VPTransformState::CFG::ExitB

Depends on D121621.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D121623
2022-03-31 11:48:52 +01:00
Nicholas Guy 7d676714fb [AArch64] Set MaxBytesForLoopAlignment for more targets
Differential Revision: https://reviews.llvm.org/D122566
2022-03-31 11:37:11 +01:00
Sergei Lebedev b50893db52 Added an empty __init__.py file to the MLIR Python bindings
While not strictly required after PEP-420, it is better to have one, since not
all tooling supports implicit namespace packages.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122794
2022-03-31 11:57:31 +02:00
Sergei Lebedev 65b2f24c50 Fixed mypy type errors in MLIR Python type stubs
This commit fixes or disables all errors reported by

    python3 -m mypy -p mlir --show-error-codes

Note that unhashable types cannot be currently expressed in a way compatible
with typeshed. See https://github.com/python/typeshed/issues/6243 for details.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122790
2022-03-31 11:56:26 +02:00
Simon Pilgrim a1d09f3a98 [X86] Extend xor-lea test coverage
Add ADD/SUB(XOR(X,MIN_SIGNED_VALUE),Y) tests
2022-03-31 10:54:27 +01:00
Florian Hahn 2c494f0941
[VPlan] Remove unneeded Loop variable (NFC).
Suggested in D121623. The remaining uses of L can be replaced, reducing
the need for the variable.
2022-03-31 10:34:28 +01:00
Marco Elver b8e49fdcb1 [AddressSanitizer] Allow prefixing memintrinsic calls in kernel mode
Allow receiving memcpy/memset/memmove instrumentation by using __asan or
__hwasan prefixed versions for AddressSanitizer and HWAddressSanitizer
respectively when compiling in kernel mode, by passing params
-asan-kernel-mem-intrinsic-prefix or -hwasan-kernel-mem-intrinsic-prefix.

By default the kernel-specialized versions of both passes drop the
prefixes for calls generated by memintrinsics. This assumes that all
locations that can lower the intrinsics to libcalls can safely be
instrumented. This unfortunately is not the case when implicit calls to
memintrinsics are inserted by the compiler in no_sanitize functions [1].

To solve the issue, normal memcpy/memset/memmove need to be
uninstrumented, and instrumented code should instead use the prefixed
versions. This also aligns with ASan behaviour in user space.

[1] https://lore.kernel.org/lkml/Yj2yYFloadFobRPx@lakrids/

Reviewed By: glider

Differential Revision: https://reviews.llvm.org/D122724
2022-03-31 11:14:42 +02:00
Groverkss 8de84198ce [MLIR][Presburger] Remove forward declaration to PresburgerLocalSpace
This patch removes a forward declaration to PresburgerLocalSpace, a
class which does not exist anymore.
2022-03-31 14:28:27 +05:30
Jean Perier 88d4b85f59 [flang] Allow user to recover from bad edit descriptor with INTEGER
Runtime was crashing when an INTEGER passed in formatted output with
a bad edit descriptor even when the user did provide IOSTAT. Flang
is already signaling an error when facing similar error with other
types. Do the same with INTEGERs.

The input case is already signaling an error in the related input error
case.

Differential Revision: https://reviews.llvm.org/D122749
2022-03-31 10:57:13 +02:00
Jean Perier 14c7754a35 [flang] Skip D when including D debug line
When including debug lines as code, the `D` should be considered as
a white space. Currently an error was raised about bad labels because
it the `D` remained a `D` when considering the source line as code.

Differential Revision: https://reviews.llvm.org/D122711
2022-03-31 10:56:25 +02:00
Simon Pilgrim 481b185620 [X86] combineCarryThroughADD - recognise X86ISD::ADD(AND(X,1),-1) pattern can be folded to X86ISD::BT
As mentioned on D122482, if we've generated a masked overflow test see if we can fold it to X86ISD::BT to feed a X86ISD::ADC/SBB

Differential Revision: https://reviews.llvm.org/D122572
2022-03-31 09:52:55 +01:00
ShihPo Hung 2f1261abe4 [RISCV][RVV] Add Uses = [FRM] and mayRaiseFPException = true to RVV instructions
This patch adds Uses = [FRM] and mayRaiseFPException = true to following
instructions:

VFADD, VFSUB, VFRSUB, VFMUL, VFDIV, VFRDIV
VFWADD, VFWSUB, VFWMUL
VFMADD, VFMACC, VFMSAC, VFMSUB
VFNMADD, VFNMACC, VFNMSAC, VVFNMSUB
VFWMACC, VFWMSAC,
VFWNMACC, VFWNMSAC
VFSQRT, VFREC7
VFREDOSUM, VFREDUSUM,
VFWREDOSUM, VFWREDUSUM
and only adds mayRaiseFPException = true to following instructions:

VFRSQRT7,
VFMIN, VFMAX, VFREDMIN, VFREDMAX
VMFEQ, VMFNE, VMFLT,VMFLE, VMFGT, VMFGE

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D121087
2022-03-31 01:33:17 -07:00
David Green b65267ca7b [LV] Invalidate widening decisions after maximizing vector bandwidth
When MaximizeVectorBandwidth is enabled, we can end up (via calls to
collectUniformsAndScalars/setCostBasedWideningDecision through
calculateRegisterUsage) making widening decisions before we have decided
whether to fold the tail by masking. These decisions will be wrong if we
later decided to fold the tail, for example when the trip count is very
low. It will use incorrect costs for loads that should get masked, using
standard memory operation costs instead.

This still at the moment uses the EmulatedMaskMemRefHack costs (a bit
unfortunately), but the old costs without this change were 1, leading to
too optimistic vectorization.

This slightly changes the way that the MaximizeVectorBandwidth option
works to make it easier to test, always honouring the option if it is
set.

Differential Revision: https://reviews.llvm.org/D120215
2022-03-31 09:19:31 +01:00
Matthias Springer 566975a252 [mlir][memref][NFC] Remove unused function
This fixes a compiler warning.
2022-03-31 17:16:03 +09:00