Florian Mayer [Mon, 28 Jun 2021 10:34:30 +0000 (11:34 +0100)]
[hwasan] print exact mismatch offset for short granules.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104463
Raphael Isemann [Mon, 28 Jun 2021 16:58:42 +0000 (18:58 +0200)]
[lldb] Avoid using any shell when calling xcrun.
When we run `xcrun` we don't have any user input in our command so relying on
the user's default shell doesn't make a lot of sense. If the user has set the
system shell to a something that isn't supported yet (dash, ash) then we would
run into the problem that we don't know how to escape our command string.
This patch just avoids using any shell at all as xcrun is always at the same
path.
Reviewed By: aprantl, JDevlieghere, kastiglione
Differential Revision: https://reviews.llvm.org/D104653
William S. Moses [Mon, 28 Jun 2021 17:52:30 +0000 (13:52 -0400)]
Revert "[MLIR][SCF] Inline ExecuteRegion if parent can contain multiple blocks"
This reverts commit
5d6240b77e7e7199fcf0e89f6dd2f7eea3596a3c.
The commit was mistakenly landed without a PR approval, this will be
reverted now and resubmitted.
Corentin Jabot [Mon, 28 Jun 2021 17:45:12 +0000 (13:45 -0400)]
Add papers adopted by the C++ committee in the June 2021 plenary
Jonas Devlieghere [Mon, 28 Jun 2021 17:38:18 +0000 (10:38 -0700)]
[lldb] Remove spurious lldb/lldb subdirectory
Remove the lldb/lldb subdirectory which I must have accidentally created
when applying a patch with the wrong prefix number.
Thank you Nico Weber for pointing this out!
Rob Suderman [Mon, 28 Jun 2021 17:17:32 +0000 (10:17 -0700)]
[mlir][tosa] Update Tosa conv verifier to handle IntegerType input
Input/output types can be integers, which represent a quantized convolution.
Update verifier to expect this behavior.
Reviewed By: sjarus
Differential Revision: https://reviews.llvm.org/D104949
Krzysztof Parzyszek [Fri, 25 Jun 2021 22:45:50 +0000 (17:45 -0500)]
[Hexagon] Add patterns to load i1
This fixes https://llvm.org/PR50853
William S. Moses [Fri, 25 Jun 2021 23:40:35 +0000 (19:40 -0400)]
[MLIR][SCF] Inline ExecuteRegion if parent can contain multiple blocks
The executeregionop is used to allow multiple blocks within SCF constructs. If the container allows multiple blocks, inline the region
Differential Revision: https://reviews.llvm.org/D104960
Arthur O'Dwyer [Tue, 15 Jun 2021 16:47:05 +0000 (12:47 -0400)]
[libc++] Remove some _LIBCPP_CXX03_LANG from iostreams headers.
With the STL containers, I didn't enable move operations in C++03 mode
because that would change the overload resolution for things that today
are copy operations. With iostreams, though, the copy operations aren't
present at all, and so I see no problem with enabling move operations
even in (Clang's greatly extended) C++03 mode.
Clang's C++03 mode does not support delegating constructors.
Differential Revision: https://reviews.llvm.org/D104310
Stephan Herhut [Mon, 28 Jun 2021 16:45:29 +0000 (18:45 +0200)]
Revert "Revert "[mlir][memref] Implement lowering of memref.copy to llvm""
This reverts commit
7d6e589fc86d7865fc4bf92c583209700dd32aac.
Windows build was unbroken.
Anirudh Prasad [Mon, 28 Jun 2021 16:46:31 +0000 (12:46 -0400)]
[AsmParser][SystemZ][z/OS] Fix hanging scenario in HLASMAsmParser class
- In the caller of the overridden `parseStatement` function (i.e. the `AsmParser::Run()`) in the case of an error **and** if we're not at the start of the statement, we "eat" up until the end of the current statement, so we don't have to process it again.
- However, in the HLASMAsmParser class what's happening is that, if an error occurs at the very start of the statement (for example, you invoke the HLASMAsmParser to parse a gnu directive), we will error out, but we never really progress in terms of the next token in the statement to parse. We simply keep looping processing the same error over and over again (partly because we're at the start of the statement)
- To remedy this, when the `parseAsHLASMLabel` function fails, before returning, we "eat" until the end of the statement function, so we don't process it anymore.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D104869
Sjoerd Meijer [Mon, 28 Jun 2021 16:25:53 +0000 (17:25 +0100)]
Revert "[AArch64] Custom lower <4 x i8> loads"
This reverts commit
51e434fc2590d1d3ffa6545cd07290a238db2b88 because of a
build bot failure in test-suite::GCC-C-execute-pr60960.test that I need to
investigate.
Sjoerd Meijer [Fri, 25 Jun 2021 14:52:19 +0000 (15:52 +0100)]
[AArch64] Added tests to neon-truncstore.ll. NFC.
Melanie Blower [Mon, 28 Jun 2021 16:41:57 +0000 (12:41 -0400)]
Revert "[clang][patch][fpenv] Add builtin __arithmetic_fence and option fprotect-parens"
This reverts commit
4f1238e44d803b145997fa984677a6c5cdf1f417.
Buildbot fails on predecessor patch
Melanie Blower [Mon, 28 Jun 2021 16:41:24 +0000 (12:41 -0400)]
Revert "[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options"
This reverts commit
2c02b0c3f45414ac6c64583e006a26113c028304.
buildbot fails
Arnold Schwaighofer [Wed, 23 Jun 2021 18:30:55 +0000 (11:30 -0700)]
[coro] Fix rematerializable instruction sinking to coro.suspend blocks
There is a constraint that coro.suspend instructions need to be in their
own blocks. The coro split pass initially creates IR that obeys this constraint
(which is later checked). Sinking rematerializable instructions into these
blocks breaks that constraint.
Instead rematerialize in the predecessor block to the suspend's single
predecessor block.
Differential Revision: https://reviews.llvm.org/D104051
LLVM GN Syncbot [Mon, 28 Jun 2021 16:30:29 +0000 (16:30 +0000)]
[gn build] Port
f32f3db9fcbf
Melanie Blower [Wed, 9 Jun 2021 15:38:34 +0000 (11:38 -0400)]
[clang][patch][fpenv] Add builtin __arithmetic_fence and option fprotect-parens
This patch adds a new clang builtin, __arithmetic_fence. The purpose of the
builtin is to provide the user fine control, at the expression level, over
floating point optimization when -ffast-math (-ffp-model=fast) is enabled.
The builtin prevents the optimizer from rearranging floating point expression
evaluation. The new option fprotect-parens has the same effect on
parenthesized expressions, forcing the optimizer to respect the parentheses.
Reviewed By: aaron.ballman, kpn
Differential Revision: https://reviews.llvm.org/D100118
Melanie Blower [Tue, 8 Jun 2021 20:55:54 +0000 (16:55 -0400)]
[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D104729
Melanie Blower [Mon, 7 Jun 2021 13:34:09 +0000 (09:34 -0400)]
[llvm][clang][fpenv] Create new intrinsic llvm.arith.fence to control FP optimization at expression level
This intrinsic blocks floating point transformations by the optimizer.
Author: Pengfei
Reviewed By: LuoYuanke, Andy Kaylor, Craig Topper, kpn
Differential Revision: https://reviews.llvm.org/D99675
Louis Dionne [Fri, 11 Jun 2021 13:55:11 +0000 (09:55 -0400)]
[libc++] Split the various iterator types out of <iterator>
Differential Revision: https://reviews.llvm.org/D104669
William S. Moses [Thu, 10 Jun 2021 19:12:04 +0000 (15:12 -0400)]
[MLIR] Correct memrefdataflow behavior in the presence of cast and other operations
MemRefDataFlow performs mem2reg style operations for affine load/stores. Unfortunately, it is not presently correct in the presence of external operations such as memref.cast, or function calls. This diff extends the functionality of the pass to remain correct in the presence of such ops.
Differential Revision: https://reviews.llvm.org/D104053
Stephan Herhut [Mon, 28 Jun 2021 15:31:01 +0000 (17:31 +0200)]
[mlir][llvm] Fix windows build
Gate the include of alloca.h behind _WIN32 guard.
Differential Revision: https://reviews.llvm.org/D105036
Stefan Pintilie [Fri, 11 Jun 2021 10:39:28 +0000 (05:39 -0500)]
[Clang] Add option to handle behaviour of vector bool/vector pixel.
Added the option `-altivec-src-compat=[mixed,gcc,xl]`. The default at this time is `mixed`.
The default behavior for clang is for all vector compares to return a scalar unless the vectors being
compared are vector bool or vector pixel. In that case the compare returns a
vector. With the gcc case all vector compares return vectors and in the xl case
all vector compares return scalars.
This patch does not change the default behavior of clang.
This option will be used in future patches to implement behaviour compatibility for the vector bool/pixel types.
Reviewed By: bmahjour
Differential Revision: https://reviews.llvm.org/D103615
William S. Moses [Fri, 25 Jun 2021 20:16:23 +0000 (16:16 -0400)]
[MLIR] Don't remove memref allocation if stored into another allocation
A canonicalization accidentally will remove a memref allocation if it is only stored into. However, this is incorrect if the allocation is the value being stored, not the allocation being stored into.
Differential Revision: https://reviews.llvm.org/D104947
Jay Foad [Mon, 28 Jun 2021 15:44:39 +0000 (16:44 +0100)]
[AMDGPU] Use opName instead of PseudoName in VOP2 multiclasses. NFC.
This is just for consistency with all other instruction multiclasses
that pass around pseudo names as arguments.
Nico Weber [Mon, 28 Jun 2021 15:32:39 +0000 (11:32 -0400)]
Revert "[Analyzer][solver] Add dump methods for (dis)equality classes."
This reverts commit
6f3b775c3e9c685f74ecbe2ce1a94af52cc17c2f.
Test fails flakily, see comments on https://reviews.llvm.org/D103967
Also revert follow-up "[Analyzer] Attempt to fix windows bots test
failure b/c of new-line"
This reverts commit
fe0e861a4d9946a3e7de1bc95a3ec12fa602b492.
Nico Weber [Mon, 28 Jun 2021 15:16:11 +0000 (11:16 -0400)]
Revert "[DebugInfo] Enable variadic debug value salvaging"
This reverts commit
adace79652174d126be290cab42b3122569fe15d.
Still breaks things, see comment on https://reviews.llvm.org/D91722
David Spickett [Wed, 23 Jun 2021 11:15:24 +0000 (11:15 +0000)]
[llvm][ARM] Treat xscale arch as an alias of armv5te
Previously xscale was known to everything apart
from the ELF streamer so we would crash as soon
as you tried to output an object file.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D104776
Florian Hahn [Mon, 28 Jun 2021 14:46:56 +0000 (15:46 +0100)]
[BasicAA] Add test to cover GetIndexDifference change in D99424.
Precommit test case for a change to GetIndexDifference in D99424.
naromero77 [Fri, 25 Jun 2021 23:54:13 +0000 (18:54 -0500)]
[flang][docs] Minor update to Fortran LLVM Tests-suite docs.
Updated Fortran LLVM Test-suite docs to reflect latest changes.
Reviewed By: Meinersbur, xgupta
Differential Revision: https://reviews.llvm.org/D104961
William S. Moses [Sat, 26 Jun 2021 03:23:14 +0000 (23:23 -0400)]
[MLIR] Simplify select to a not
Given a select that returns the logical negation of the condition, replace it with a not of the condition.
Differential Revision: https://reviews.llvm.org/D104966
Stefan Gränitz [Mon, 28 Jun 2021 14:10:02 +0000 (16:10 +0200)]
[Orc][examples] Temporarily disable LLJITWithRemoteDebugging build and test
The underlying TargetProcessControl API changes with D104694. Once it landed I can patch and re-enable the example.
Jacques Pienaar [Mon, 28 Jun 2021 14:50:11 +0000 (07:50 -0700)]
Revert "[mlir][memref] Implement lowering of memref.copy to llvm"
This reverts commit
e9396449777f02d573deb25d603ee1b1d6e568c1.
Breaks Windows build.
Zarko Todorovski [Mon, 28 Jun 2021 14:31:55 +0000 (10:31 -0400)]
[AIX] Use less than or equal to for some alignment tests on AIX
On AIX the alignment implementation has the storage aligned to the
preferred alignment instead of the alignment of a type. Macro guard
these tests for AIX and have them pass when the "reference alignment" is
less than or equal to the alignment observed. In other words, the
alignment applied is at least as strict as the required alignment.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D104786
Sander de Smalen [Sun, 27 Jun 2021 15:07:19 +0000 (16:07 +0100)]
Reland [GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize.
This patch relands https://reviews.llvm.org/D104454, but fixes some failing
builds on Mac OS which apparently has a different definition for size_t,
that caused 'ambiguous operator overload' for the implicit conversion
of TypeSize to a scalar value.
This reverts commit
b732e6c9a8438e5204ac96c8ca76f9b11abf98ff.
Ahsan Saghir [Mon, 31 May 2021 13:52:56 +0000 (08:52 -0500)]
Teach peephole optimizer to not emit sub-register defs
Peephole optimizer should not be introducing sub-reg definitions
as they are illegal in machine SSA phase. This patch modifies
the optimizer to not emit sub-register definitions.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D103408
Bradley Smith [Fri, 25 Jun 2021 11:11:33 +0000 (12:11 +0100)]
[AArch64][SVE] DAG combine SETCC_MERGE_ZERO of a SETCC_MERGE_ZERO
This helps remove extra comparisons when generating masks for fixed
length masked operations.
Differential Revision: https://reviews.llvm.org/D104910
Jonathan Crowther [Mon, 28 Jun 2021 13:53:28 +0000 (09:53 -0400)]
[libc++] Remove unnecessary reinterpret_cast from typeinfo
In typeinfo there is a reinterpret_cast between a uintptr_t and size_t. These are two integer types and therefore a reinterpret_cast is not right for this situation. It looks like it may have been copied and pasted from above in the file. An implicit cast works in it's place.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D104814
Reshabh Sharma [Mon, 28 Jun 2021 13:48:39 +0000 (19:18 +0530)]
[InferAddressSpaces] NFC: For noop IntToPtr/PtrToInt pair cast to operator instead of PtrToInt
Compiler crashes at an assertion while casting operands to PtrToIntInst at some cases when
ptrtoint is present as an explicit operand to inttoptr. Explicit instruction operator as
operand can not be casted to an Instruction.
This patch replaces cast from PtrToInst to Operator which are later checked for constant
expressions.
Differential Revision: https://reviews.llvm.org/D105002
Joseph Huber [Mon, 28 Jun 2021 13:48:54 +0000 (09:48 -0400)]
[OpenMP][NFC] Fix typo in OpenMPOpt
Gabor Marton [Mon, 28 Jun 2021 13:41:30 +0000 (15:41 +0200)]
[Analyzer] Attempt to fix windows bots test failure b/c of new-line
Ben Shi [Mon, 28 Jun 2021 13:19:26 +0000 (21:19 +0800)]
[AVR][test] Add a new test: functions with struct return type
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D99239
Joseph Huber [Mon, 28 Jun 2021 13:14:46 +0000 (09:14 -0400)]
[OpenMP][NFC] Fix missing argument
Brendon Cahoon [Fri, 30 Apr 2021 13:57:44 +0000 (09:57 -0400)]
[AMDGPU][GlobalISel] Legalize and select G_SBFX and G_UBFX
Adds legalizer, register bank select, and instruction
select support for G_SBFX and G_UBFX. These opcodes generate
scalar or vector ALU bitfield extract instructions for
AMDGPU. The instructions allow both constant or register
values for the offset and width operands.
The 32-bit scalar version is expanded to a sequence that
combines the offset and width into a single register.
There are no 64-bit vgpr bitfield extract instructions, so the
operations are expanded to a sequence of instructions that
implement the operation. If the width is a constant,
then the 32-bit bitfield extract instructions are used.
Moved the AArch64 specific code for creating G_SBFX to
CombinerHelper.cpp so that it can be used by other targets.
Only bitfield extracts with constant offset and width values
are handled currently.
Differential Revision: https://reviews.llvm.org/D100149
Corentin Jabot [Mon, 28 Jun 2021 13:00:45 +0000 (09:00 -0400)]
[C++20] Support for lambdas in unevaluated context
Partially implement P0315R4.
This patch allow lambda in unevaluated context.
It does not implement temp.deduct/9.
Lucas Prates [Mon, 28 Jun 2021 12:51:27 +0000 (13:51 +0100)]
[NFC] Fixing short title underline in release notes file
Stephan Herhut [Mon, 28 Jun 2021 11:25:29 +0000 (13:25 +0200)]
[mlir][memref] Implement lowering of memref.copy to llvm
This lowering uses a library call to implement copying in the general case, i.e.,
supporting arbitrary rank and strided layouts.
Joseph Huber [Fri, 25 Jun 2021 14:42:00 +0000 (10:42 -0400)]
[OpenMP] Increase attributor iterations on the GPU
Increase the number of attributor iterations on a GPU target. I forgot to
change this in D104416.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104920
Lucas Prates [Tue, 22 Jun 2021 15:43:36 +0000 (16:43 +0100)]
[Aarch64] Adding support for Armv9-A Realm Management Extension
This adds support for Armv9-A's Realm Management Extension, including
three new system registers - MFAR_EL3, GPCCR_EL3 and GPTBR_EL3 - and
four new TLBI instructions.
The reference for the Realm Management Extension can be found at: https://developer.arm.com/documentation/ddi0615/aa.
Based on patches by Victor Campos.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D104773
Lucas Prates [Tue, 9 Feb 2021 13:39:08 +0000 (13:39 +0000)]
[NFC] Adding test for clobbering of high registers in Thumb
Prior to the changes from D52010, clobbering Thumb's high registers in
inline asm would cause incorrect code to be generated - or an assertion
failure for debug builds. Now that the issue is no longer reproducible,
this patch adds a MIR test to cover that scenario.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D96335
Pushpinder Singh [Mon, 28 Jun 2021 11:27:05 +0000 (11:27 +0000)]
[AMDGPU][Libomptarget] Collect allocatable memory pools using HSA
The logic is almost similar to that of system.cpp with one change that
instead of adding all the memory pools to a device struct it only
keeps a single pool. The existing approach also always allocated memory on
the first HSA pool found for a GPU.
This depends on D104691. The goal of this series of patches is to remove
_atl_machine global. The next patch will drop g_atl_machine entirely.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D104695
Valeriy Savchenko [Mon, 28 Jun 2021 08:56:05 +0000 (11:56 +0300)]
[analyzer][solver][NFC] Simplify function signatures
Since RangeSet::Factory actually contains BasicValueFactory, we can
remove value factory from many function signatures inside the solver.
Differential Revision: https://reviews.llvm.org/D105005
Gabor Marton [Wed, 9 Jun 2021 15:03:47 +0000 (17:03 +0200)]
[Analyzer][solver] Add dump methods for (dis)equality classes.
This proved to be very useful during debugging.
Differential Revision: https://reviews.llvm.org/D103967
David Spickett [Mon, 28 Jun 2021 10:32:24 +0000 (10:32 +0000)]
[compiler-rt][asan] Disable two tests on Arm Thumb
I can't be sure of the cause but I believe these fail
due to to fast unwinding not working on Thumb.
Whatever the case, they have been failing on our bots
for a long time:
https://lab.llvm.org/buildbot/#/builders/170/builds/46
Require fast-unwinder-works for both.
James Henderson [Wed, 10 Feb 2021 14:16:45 +0000 (14:16 +0000)]
[cross-project-tests] Add/update check-* targets for cross-project-tests
This change modifies the existing check-debuginfo target to only run the
debuginfo tests within the cross-project-tests, and adds a new target
(check-cross-project) which runs all the tests. The former has also been
modified to not be included in check-all (since the check-cross-project
target covers them).
Differential Revision: https://reviews.llvm.org/D96513
Reviewed by: aprantl
James Henderson [Tue, 9 Feb 2021 15:19:27 +0000 (15:19 +0000)]
[cross-project-tests] Make clang optional if not in LLVM_ENABLE_PROJECTS
Also mark debuginfo_tests as UNSUPPORTED if clang can't be found and
remove it from the list of test dependencies if not in
LLVM_ENABLE_PROJECTS.
Differential Revision: https://reviews.llvm.org/D96511
Reviewed by: aprantl
James Henderson [Tue, 9 Feb 2021 14:57:03 +0000 (14:57 +0000)]
[cross-project-tests] Add lld as a dependency if in LLVM_ENABLE_PROJECTS
Differential Revision: https://reviews.llvm.org/D96510
Reviewed by: aprantl
James Henderson [Thu, 11 Feb 2021 15:41:32 +0000 (15:41 +0000)]
[cross-project-tests] Rename vars to make sense for new directory name
Differential Revision: https://reviews.llvm.org/D96509
Reviewed by: aprantl
James Henderson [Mon, 8 Feb 2021 15:40:55 +0000 (15:40 +0000)]
[RFC][debuginfo-test] Rename debug-info lit tests for general purposes
Discussion thread:
https://lists.llvm.org/pipermail/llvm-dev/2021-January/148048.html
Move debuginfo-test into a subdirectory of a new top-level directory,
called cross-project-tests. The new name replaces "debuginfo-test" as an
LLVM project enabled via LLVM_ENABLE_PROJECTS.
Differential Revision: https://reviews.llvm.org/D95339
Reviewed by: aprantl
Kerry McLaughlin [Mon, 28 Jun 2021 10:26:10 +0000 (11:26 +0100)]
[LoopVectorize] Fix strict reductions where VF = 1
Currently we will allow loops with a fixed width VF of 1 to vectorize
if the -enable-strict-reductions flag is set. However, the loop vectorizer
will not use ordered reductions if `VF.isScalar()` and the resulting
vectorized loop will be out of order.
This patch removes `VF.isVector()` when checking if ordered reductions
should be used. Also, instead of converting the FAdds to reductions if the
VF = 1, operands of the FAdds are changed such that the order is preserved.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D104533
Florian Hahn [Mon, 28 Jun 2021 10:01:27 +0000 (11:01 +0100)]
[VPlan] Merge predicated-triangle regions, after sinking.
Sinking scalar operands into predicated-triangle regions may allow
merging regions. This patch adds a VPlan-to-VPlan transform that tries
to merge predicate-triangle regions after sinking.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D100260
David Spickett [Mon, 28 Jun 2021 09:36:04 +0000 (09:36 +0000)]
[lld][MachO] Temporarily require 64 bit build for dead-strip.s
This test has always failed on 32 bit armv8 bots:
https://lab.llvm.org/buildbot/#/builders/178/builds/42
Due to the output order of some symbols changing.
I don't think this is an Arm specific issue so disabling
on 32 bit while it's investigated.
Florian Mayer [Wed, 23 Jun 2021 14:36:14 +0000 (15:36 +0100)]
[hwasan] Show sp in register dump.
Reviewed By: hctim, eugenis
Differential Revision: https://reviews.llvm.org/D104787
Whisperity [Mon, 28 Jun 2021 09:17:51 +0000 (11:17 +0200)]
[clang-tidy][NFC] Fix buildbot failures in 'bugprone-easily-swappable-parameters'
LLVM GN Syncbot [Mon, 28 Jun 2021 08:50:56 +0000 (08:50 +0000)]
[gn build] Port
499e39c5983d
Whisperity [Tue, 12 Jan 2021 16:03:42 +0000 (17:03 +0100)]
[clang-tidy] Suppress reports to patternedly named parameters in 'bugprone-easily-swappable-parameters'
While the original check's purpose is to identify potentially dangerous
functions based on the parameter types (as identifier names do not mean
anything when it comes to the language rules), unfortunately, such a plain
interface check rule can be incredibly noisy. While the previous
"filtering heuristic" is able to find many similar usages, there is an entire
class of parameters that should not be warned about very easily mixed by that
check: parameters that have a name and their name follows a pattern,
e.g. `text1, text2, text3, ...`.`
This patch implements a simple, but powerful rule, that allows us to detect
such cases and ensure that no warnings are emitted for parameter sequences that
follow a pattern, even if their types allow for them to be potentially mixed at a call site.
Given a threshold `k`, warnings about two parameters are filtered from the
result set if the names of the parameters are either prefixes or suffixes of
each other, with at most k letters difference on the non-common end.
(Assuming that the names themselves are at least `k` long.)
- The above `text1, text2` is an example of this. (Live finding from Xerces.)
- `LHS` and `RHS` are also fitting the bill here. (Live finding from... virtually any project.)
- So does `Qmat, Tmat, Rmat`. (Live finding from I think OpenCV.)
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D97297
Whisperity [Wed, 8 Apr 2020 14:33:15 +0000 (16:33 +0200)]
[clang-tidy] Suppress reports to similarly used parameters in 'bugprone-easily-swappable-parameters'
There are several types of functions and various reasons why some
"swappable parameters" cannot be fixed with changing the parameters' types, etc.
The most common example might be int `min(int a, int b)`... no matter what you
do, the two parameters must remain the same type.
The **filtering heuristic** implemented in this patch deals with trying to find
such functions during the modelling and building of the swappable parameter
range.
If the parameter currently scrutinised matches either of the predicates below,
it will be regarded as **not swappable** even if the type of the parameter
matches.
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D78652
Whisperity [Tue, 17 Dec 2019 17:00:08 +0000 (18:00 +0100)]
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with mixability because of implicit conversions
Adds a relaxation option ModelImplicitConversions which will make the check
report for cases where parameters refer to types that are implicitly
convertible to one another.
Example:
struct IntBox { IntBox(int); operator int(); };
void foo(int i, double d, IntBox ib) {}
Implicit conversions are the last to model in the set of things that are
reasons for the possibility of a function being called the wrong way which is
not always immediately apparent when looking at the function (signature or
call).
Reviewed By: aaron.ballman, martong
Differential Revision: http://reviews.llvm.org/D75041
Whisperity [Wed, 20 Nov 2019 13:12:57 +0000 (14:12 +0100)]
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with optionally considering differently qualified types mixable
Adds a relaxation option QualifiersMix which will make the check report for
cases where parameters refer to the same type if they only differ in qualifiers.
This makes cases, such as the following, not warned about by default, produce
a warning.
void* memcpy(void* dst, const void* src, unsigned size) {}
However, unless people meticulously const their local variables, unfortunately,
even such a function carry a potential swap:
T* obj = new T; // Not const!!!
void* buf = malloc(sizeof(T));
memcpy(obj, buf, sizeof(T));
// ^~~ ^~~ accidental swap here, even though the interface "specified" a const.
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D96355
Whisperity [Fri, 8 Nov 2019 18:58:23 +0000 (19:58 +0100)]
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with `typedef` and `const &` diagnostics
The base patch only deals with strict (canonical) type equality, which is
merely a subset of all the dangerous function interfaces that we intend to
find.
In addition, in the base patch, canonical type equivalence is not diagnosed in
a way that is immediately apparent to the user.
This patch extends the check with two features:
* Proper typedef diagnostics and explanations to the user.
* "Reference bind power" matching.
Case 2 is a necessary addition because in every case someone encounters a
function `f(T t, const T& tr)`, any expression that might be passed to either
can be passed to both. Thus, such adjacent parameter sequences should be
matched.
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D95736
Whisperity [Tue, 29 Oct 2019 12:52:15 +0000 (13:52 +0100)]
[clang-tidy] Add 'bugprone-easily-swappable-parameters' check
Finds function definitions where parameters of convertible types follow
each other directly, making call sites prone to calling the function
with swapped (or badly ordered) arguments.
Such constructs are usually the result of inefficient design and lack of
exploitation of strong type capabilities that are possible in the
language.
This check finds and flags **function definitions** and **not** call
sites!
Reviewed By: aaron.ballman, alexfh
Differential Revision: http://reviews.llvm.org/D69560
David Spickett [Mon, 28 Jun 2021 08:32:36 +0000 (08:32 +0000)]
[clang][ARM] Mark sanitize-coverage-old-pm.c unsupported on armv7l
Our v7 Linux bots report the arch as "armv7l", not "armv7".
Tobias Gysi [Mon, 28 Jun 2021 07:30:02 +0000 (07:30 +0000)]
[mlir][linalg] Remove the StructuredOp capture mechanism.
After https://reviews.llvm.org/D104109, structured ops support scalar inputs. As a result, the capture mechanism meant to pass non-shaped parameters got redundant. The patch removes the capture semantics after the FillOp migrated to use scalar operands https://reviews.llvm.org/D104121.
Differential Revision: https://reviews.llvm.org/D104785
David Green [Mon, 28 Jun 2021 07:54:03 +0000 (08:54 +0100)]
[ARM] Add an extra fold for f32 extract(vdup(i32))
This adds another small fold for extract of a vdup, between a i32 and a
f32, converting to a BITCAST. This allows some extra folding to happen,
simplifying the resulting code.
Differential Revision: https://reviews.llvm.org/D104857
Igor Kudrin [Mon, 28 Jun 2021 07:24:39 +0000 (14:24 +0700)]
[llvm-objdump] Print memory operand addresses as regular comments
The patch reuses the common code to print memory operand addresses as
instruction comments. This helps to align the comments and enables using
target-specific comment markers when `evaluateMemoryOperandAddress()` is
implemented for them.
Differential Revision: https://reviews.llvm.org/D104861
Igor Kudrin [Mon, 28 Jun 2021 07:24:03 +0000 (14:24 +0700)]
[llvm-objdump] Prefix memory operand addresses with '0x'
This helps to avoid ambiguity when the address contains only digits 0..9.
Differential Revision: https://reviews.llvm.org/D104909
Igor Kudrin [Mon, 28 Jun 2021 07:23:22 +0000 (14:23 +0700)]
[llvm-objdump] Prevent variable locations to overlap short comments
For now, the source variable locations are printed at about the same
space as the comments for disassembled code, which can make some ranges
for variables disappear if a line contains comments, for example:
┠─ bar = W1
0: add x0, x2, #2, lsl #12 // =8192┃
4: add z31.d, z31.d, #65280 // =0xff00
8: nop ┻
The patch shifts the report a bit to allow printing comments up to
approximately 16 characters without interferences.
Differential Revision: https://reviews.llvm.org/D104700
Igor Kudrin [Mon, 28 Jun 2021 07:22:41 +0000 (14:22 +0700)]
[llvm-objdump] Print comments for the disassembled code
LLVM disassembler can generate comments for disassembled instructions.
The patch enables printing these comments for 'llvm-objdump -d'.
Differential Revision: https://reviews.llvm.org/D104699
Min-Yih Hsu [Mon, 28 Jun 2021 06:22:40 +0000 (23:22 -0700)]
Revert "[M68k][GloballSel] Formal arguments lowering in IRTranslator"
This reverts commit
8f43407a07f015ca9a7543c6a0b5bde3918f9a0e due to
failure on its associated test.
Max Kazantsev [Mon, 28 Jun 2021 05:55:53 +0000 (12:55 +0700)]
Revert "[Test] Add XFAIL test for PR50918"
This reverts commit
af03f7fb37bf13ed923f893182fd4e2f6c40bfd2.
Looks like the test is passing in some architectures. Reverting to green.
Max Kazantsev [Mon, 28 Jun 2021 05:50:04 +0000 (12:50 +0700)]
[LSR][NFC] Make sure that after the canonicalization the formula is canonical
Max Kazantsev [Mon, 28 Jun 2021 05:22:27 +0000 (12:22 +0700)]
[Test] Add XFAIL test for PR50918
Max Kazantsev [Mon, 28 Jun 2021 04:39:46 +0000 (11:39 +0700)]
[LoopDeletion] Benefit from branches by undef conditions when symbolically executing 1st iteration
We can exploit branches by `undef` condition. Frankly, the LangRef says that
such branches are UB, so we can assume that all outgoing edges of such blocks
are dead.
However, from practical perspective, we know that this is not supported correctly
in some other places. So we are being conservative about it.
Branch by undef is treated in the following way:
- If it is a loop-exiting branch, we always assume it exits the loop;
- If not, we arbitrarily assume it takes `true` value.
Differential Revision: https://reviews.llvm.org/D104689
Reviewed By: nikic
Jinsong Ji [Mon, 28 Jun 2021 02:46:33 +0000 (02:46 +0000)]
[PowerPC] Add XL Compat fetch builtins
Prototype
```
unsigned int __fetch_and_add (volatile unsigned int* addr, unsigned int
val);
unsigned long __fetch_and_addlp (volatile unsigned long* addr, unsigned
long val);
```
Ref:
https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.1?topic=functions-fetch
Reviewed By: #powerpc, w2yehia, lkail
Differential Revision: https://reviews.llvm.org/D104991
Muhammad Omair Javaid [Mon, 28 Jun 2021 01:18:58 +0000 (01:18 +0000)]
[LLDB] Silence warnings in cli-wrapper-mpxtable.cpp
cli-wrapper-mpxtable.cpp was emitting warnings from printfs of
uint64_t on 32 bit arm build. This patch makes affected printfs
in cli-wrapper-mpxtable.cpp portable accross targets variants.
Muhammad Omair Javaid [Mon, 28 Jun 2021 02:19:09 +0000 (07:19 +0500)]
Tag sanitize-coverage-old-pm.c unsupported on arm 32 bit
This test is again failing across multiple bots and passing on others
there is no reliable way to enable it for some of the bots while
disabling for the unsupported ones. Tagging it as unsupported across all
types of Arm 32 bit cores.
Sushma Unnibhavi [Sun, 27 Jun 2021 23:13:05 +0000 (16:13 -0700)]
[M68k][GloballSel] Formal arguments lowering in IRTranslator
Implementation of formal arguments lowering in the IRTranslator for the
M68k backend
Differential Revision: https://reviews.llvm.org/D104542
Muhammad Omair Javaid [Sun, 27 Jun 2021 22:33:17 +0000 (03:33 +0500)]
Remove XFAIL flag from sanitize-coverage-old-pm.c
This test has started passing consistently on 32bit arm where underlying
core is reported as Armv7 or Thumbv7.
However it still fails intermittently on 32bit AArch32 reported as Armv8l.
https://lab.llvm.org/buildbot/#/builders/190/builds/20
https://lab.llvm.org/buildbot/#/builders/170/builds/41
David Blaikie [Sun, 27 Jun 2021 21:55:08 +0000 (14:55 -0700)]
PR50708: Update link to Intel SIMD ABI
David Blaikie [Sun, 27 Jun 2021 21:34:18 +0000 (14:34 -0700)]
PR37255: DebugInfo: LTO with -g inlined into -gmlt combined with Split DWARF without CU cross-references
A combination of features ^ that lead to a mismatch of expectations
about how a subprogram definition DIE would be produced with/without a
declaration when taking full -g debug info and inlining it into a -gmlt
CU - specifically when using Split DWARF that doesn't support cross-CU
references, so we have to put the -g debug info into the -gmlt CU, which
gets confusing about which mode is respected.
This patch comes down on respecting the CU the debug info is emitted
into, rather than preserving the full debug info when it's emitted into
the gmlt CU.
Craig Topper [Sun, 27 Jun 2021 18:23:56 +0000 (11:23 -0700)]
[RISCV] Add tests for __builtin_parity idiom.
We use (and (ctpop X), 1) to represent parity.
The generated code for i32 parity on RV64 has more instructions than
necessary which I hope to improve in a followup patch.
Also add missing test for i64 ctpop.
Nathan Chancellor [Sun, 27 Jun 2021 18:59:57 +0000 (11:59 -0700)]
[BitCode] Add noprofile to getAttrFromCode()
After D104475 / D104658, building the Linux kernel with ThinLTO is
broken:
ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git'
Reader: 'LLVM 13.0.0git')
getAttrFromCode() has never handled this attribute so it is written
during the ThinLTO phase but it cannot be handled during the linking
phase.
Add noprofile to getAttrFromCode() so that disassembly works properly.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D104995
Nikita Popov [Sun, 27 Jun 2021 18:26:00 +0000 (20:26 +0200)]
[DSE] Preserve address space
Preserve address space when inserting i8* cast.
Nikita Popov [Sun, 27 Jun 2021 18:20:27 +0000 (20:20 +0200)]
[MemCpyOpt] Preserve address space
Preserve address space when generating the cast to i8*.
Craig Topper [Sun, 27 Jun 2021 17:32:48 +0000 (10:32 -0700)]
Revert "[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions."
I thought this might help with another optimization I was
thinking about, but I don't think it will. So it just wastes
compile time calling computeKnownBits for no benefit.
This reverts commit
81b2f95971edd47a0057ac4a77b674d7ea620c01.
Nikita Popov [Sun, 27 Jun 2021 14:11:20 +0000 (16:11 +0200)]
[DSE] Support opaque pointers
For the start shortening optimization, always use a i8 type for
the GEP, as it is a raw offset calculation.
Handling of non-i8* memset/memcpy arguments requires insertion
of casts. These cases were previously miscompiled, as the offset
calculation was performed on the wrong type.
Geoffrey Martin-Noble [Sun, 27 Jun 2021 15:30:54 +0000 (08:30 -0700)]
[Bazel] Update for
0813700de1
Updates Bazel BUILD files for changes in
https://github.com/llvm/llvm-project/commit/
0813700de1
Differential Revision: https://reviews.llvm.org/D104990
Darwin Xu [Sun, 27 Jun 2021 14:57:57 +0000 (15:57 +0100)]
[clang-format] Fix the issue that empty lines being removed at the beginning of namespace
This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=50116
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D104044
Nikita Popov [Sun, 27 Jun 2021 14:19:21 +0000 (16:19 +0200)]
[MemCpyOpt] Handle unusual memcpy element type
Apparently, it is legal to use memcpy/memset with pointer types
other than i8*. Prior to
81fcdae68c5ff656c30032fd26c6a21af4c51dbb
this case was silently miscompiled, as the i8 offset calculation
was performed on some other type. Now it would crash due to a
type mismatch. Fix this by inserting an explicit bitcast to i8*.