Florian Hahn [Sat, 24 Apr 2021 14:06:17 +0000 (15:06 +0100)]
[NewGVN] Use performSymbolicEvaluation instead of createExpression.
performSymbolicEvaluation is used to obtain the symbolic expression when
visiting instructions and this is used to determine their congruence
class.
performSymbolicEvaluation only creates expressions for certain
instructions (via createExpression). For unsupported instructions,
'unknown' expression are created.
The use of createExpression in processOutgoingEdges means we may
simplify the condition in processOutgoingEdges to a constant in the
initial round of processing, but we use Unknown(I) for the congruence
class. If an operand of I changes the expression Unknown(I) stays the
same, so there is no update of the congruence class of I. Hence it
won't get re-visited. So if an operand of I changes in a way that causes
createExpression to return different result, this update is missed.
This patch updates the code to use performSymbolicEvaluation, to be
symmetric with the congruence class updating code.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D99990
Dávid Bolvanský [Sat, 24 Apr 2021 17:43:20 +0000 (19:43 +0200)]
[InstCombine] Fixed UB in foldCtpop
David Green [Sat, 24 Apr 2021 16:51:50 +0000 (17:51 +0100)]
[AArch64] Enable UseAA globally in the AArch64 backend
This is similar to D69796 from the ARM backend. We remove the UseAA
feature, enabling it globally in the AArch64 backend. This should in
general be an improvement allowing the backend to reorder more
instructions in scheduling and codegen, and enabling it by default helps
to improve the testing of the feature, not making it cpu-specific. A
debugging option is added instead for testing.
Differential Revision: https://reviews.llvm.org/D98781
Dávid Bolvanský [Sat, 24 Apr 2021 16:45:36 +0000 (18:45 +0200)]
[Tests] Rename variable to fix broken buildbots
David Tolnay [Sat, 24 Apr 2021 16:26:33 +0000 (12:26 -0400)]
Fix null ptr crash dumping TemplateTemplateParmDecl
The following program winds up with
D->getDefaultArgStorage().getInheritedFrom() == nullptr
during dumping the TemplateTemplateParmDecl corresponding to the
template parameter of i.
template <typename>
struct R;
template <template <typename> class = R>
void i();
This patch fixes the null pointer dereference.
Dávid Bolvanský [Sat, 24 Apr 2021 16:24:54 +0000 (18:24 +0200)]
[InstCombine] ctpop(rot(X)) -> ctpop(X)
Proof:
https://alive2.llvm.org/ce/z/ss2zyt - rotl
https://alive2.llvm.org/ce/z/ZM7Aue - rotr
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101235
Dávid Bolvanský [Sat, 24 Apr 2021 15:44:20 +0000 (17:44 +0200)]
[InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)
For example:
```
int src(unsigned int a, unsigned int b)
{
return __builtin_popcount(a << 16) + __builtin_popcount(b >> 16);
}
int tgt(unsigned int a, unsigned int b)
{
return __builtin_popcount((a << 16) | (b >> 16));
}
```
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101210
Christopher Di Bella [Fri, 9 Apr 2021 02:10:32 +0000 (02:10 +0000)]
[libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`
Implements parts of:
* P0896R4 The One Ranges Proposal`
Depends on D100080
Differential Revision: https://reviews.llvm.org/D100160
Mark de Wever [Sat, 17 Apr 2021 16:49:37 +0000 (18:49 +0200)]
[libc++][doc] Adds a Format library status page.
A status page for libc++'s Format library. The page is inspired by
@zoecarver's Ranges status page.
Differential Revision: https://reviews.llvm.org/D101085
Nikita Popov [Sat, 24 Apr 2021 14:20:15 +0000 (16:20 +0200)]
[InstCombine] Add tests for comparison of integer parts (NFC)
Nico Weber [Sat, 24 Apr 2021 02:55:05 +0000 (22:55 -0400)]
[lld/mac] Don't assert when using -exported_symbol with private symbol
When I added this assert in D93609, it asserted that a symbol that
is privateExtern is also isExternal().
In D98381 the privateExtern check moved into shouldExportSymbol()
but the assert didn't -- now it checked that _every_ non-exported
symbol is isExternal(), which isn't true. Move the assert into the
privateExtern check where it used to be.
Fixes PR50098.
Differential Revision: https://reviews.llvm.org/D101223
Shu Tian [Sat, 24 Apr 2021 14:08:55 +0000 (16:08 +0200)]
[libc++] Remove if-else to make branch predictor happy
Reviewed By: #libc, ldionne, Quuxplusone, Mordante
Differential Revision: https://reviews.llvm.org/D100828
David Green [Sat, 24 Apr 2021 13:50:32 +0000 (14:50 +0100)]
[ARM] Format ARMISD node definitions. NFC
This clang-formats the list of ARMISD nodes. Usually this is something I
would avoid, but these cause problems with formatting every time new
nodes are added.
The list in getTargetNodeName also makes use of MAKE_CASE macros, as
other backends do.
Dávid Bolvanský [Sat, 24 Apr 2021 13:35:16 +0000 (15:35 +0200)]
[Clang] Added heading to doc for malloc attribute
Dávid Bolvanský [Sat, 24 Apr 2021 13:27:29 +0000 (15:27 +0200)]
[Clang] Added doc for malloc attribute
Taken mostly from LLVM langref.
Nico Weber [Sat, 24 Apr 2021 02:47:13 +0000 (22:47 -0400)]
[lld/mac] simplify export-options.s test a bit
- the macro seems needlessly clever -- shorter and imho clearer without it
- give all filenames an extension so they look like filenames
- rename .private_extern symbol from _private to _private_extern
to prepare for follow-up that adds a truly private symbol
No behavior change.
Differential Revision: https://reviews.llvm.org/D101222
Nico Weber [Sat, 24 Apr 2021 02:03:42 +0000 (22:03 -0400)]
[lld/mac] add test coverage for -sectcreate and -order_file with --reproduce
Would've caught the (since fixed) regression in D97610.
No behavior change.
Differential Revision: https://reviews.llvm.org/D101218
dfukalov [Fri, 9 Apr 2021 10:37:13 +0000 (13:37 +0300)]
[GVN] Clobber partially aliased loads.
Use offsets stored in `AliasResult` implemented in D98718.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D95543
Dávid Bolvanský [Fri, 23 Apr 2021 23:20:15 +0000 (01:20 +0200)]
[InstCombine] Added testcases from PR48999, NFC
Michael Kruse [Sat, 24 Apr 2021 09:10:55 +0000 (04:10 -0500)]
[Polly][ManualOpt] Match interpretation of unroll metadata to LoopUnrolls's.
We previously had a different interpretation of unroll transformation
attributes than how LoopUnroll interpreted it. In particular,
llvm.loop.unroll.enable was needed explicitly to enable it and disabling
metadata was ignored.
Additionally, it required that either full unrolling or an unroll factor
to be specified or fail otherwise. An unroll factor is still required,
but the transformation is ignored with the hope that LoopUnroll is going
to apply the unrolling, since Polly currently does not implement an
heuristic.
Fixes llvm.org/PR50109
Michał Górny [Fri, 9 Apr 2021 15:00:12 +0000 (17:00 +0200)]
[lldb] [Process/Linux] Report fork/vfork stop reason
Enable reporting fork/vfork events to the server when supported.
At this moment, this is used only to test the server code, as real
client does not report fork-events and vfork-events as supported.
Differential Revision: https://reviews.llvm.org/D100208
Michał Górny [Tue, 13 Apr 2021 15:32:23 +0000 (17:32 +0200)]
[lldb] [llgs] Support owning and detaching extra processes
Add a NativeDelegate API to pass new processes (forks) to LLGS,
and support detaching them via the 'D' packet. A 'D' packet without
a specific PID detaches all processes, otherwise it detaches either
the specified subprocess or the main process, depending on the passed
PID.
Differential Revision: https://reviews.llvm.org/D100191
Michał Górny [Mon, 29 Mar 2021 15:05:30 +0000 (17:05 +0200)]
[lldb] [gdb-remote server] Introduce new stop reasons for fork and vfork
Introduce three new stop reasons for fork, vfork and vforkdone events.
This includes server support for serializing fork/vfork events into
gdb-remote protocol. The stop infos for the two base events take a pair
of PID and TID for the newly forked process.
Differential Revision: https://reviews.llvm.org/D100196
Michał Górny [Thu, 8 Apr 2021 22:59:22 +0000 (00:59 +0200)]
[lldb] [Process] Introduce protocol extension support API
Introduce a NativeProcessProtocol API for indicating support for
protocol extensions and enabling them. LLGS calls
GetSupportedExtensions() method on the process factory to determine
which extensions are supported by the plugin. If the future is both
supported by the plugin and reported as supported by the client, LLGS
enables it and reports to the client as supported by the server.
The extension is enabled on the process instance by calling
SetEnabledExtensions() method. This is done after qSupported exchange
(if the debugger is attached to any process), as well as after launching
or attaching to a new inferior.
The patch adds 'fork' extension corresponding to 'fork-events+'
qSupported feature and 'vfork' extension for 'vfork-events+'. Both
features rely on 'multiprocess+' being supported as well.
Differential Revision: https://reviews.llvm.org/D100153
Fangrui Song [Sat, 24 Apr 2021 07:56:22 +0000 (00:56 -0700)]
[Polly] Fix stage 2 clang -Wdeprecated-copy after D79714
Butygin [Sat, 10 Apr 2021 16:38:11 +0000 (19:38 +0300)]
[mlir] Canonicalize AllocOp's with only store and dealloc uses
Differential Revision: https://reviews.llvm.org/D100268
natashaknk [Sat, 24 Apr 2021 05:30:08 +0000 (22:30 -0700)]
[mlir][tosa] Add tosa.gather lowering to linalg.indexed_generic
Lowering gather operation to linalg dialect.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D101200
Christopher Di Bella [Sat, 24 Apr 2021 01:22:55 +0000 (18:22 -0700)]
[libcxx][iterator] adds `std::weakly_incrementable` and `std::incrementable`
Implements parts of:
* P0896R4 The One Ranges Proposal`
Depends on D100073.
Reviewed By: ldionne, zoecarver, #libc
Differential Revision: https://reviews.llvm.org/D100080
Fangrui Song [Sat, 24 Apr 2021 05:11:14 +0000 (22:11 -0700)]
[ELF] Simplify a condition in addGotEntry. NFC
Lang Hames [Sat, 24 Apr 2021 03:36:59 +0000 (20:36 -0700)]
Revert "[ORC-RT] Initial ORC Runtime directories and build system files."
Some builders failed with a missing clang dependency. E.g.
CMake Error at /Users/buildslave/jenkins/workspace/clang-stage1-RA/clang-build \
/lib/cmake/llvm/AddLLVM.cmake:1786 (add_dependencies):
The dependency target "clang" of target "check-compiler-rt" does not exist.
Reverting while I investigate.
This reverts commit
1e1d75b190c266cb11e0a6bbb4f11b810d690cc7.
Lang Hames [Sat, 17 Apr 2021 19:00:42 +0000 (12:00 -0700)]
[ORC-RT] Initial ORC Runtime directories and build system files.
This patch contains initial directories and build files for the ORC runtime.
Differential Revision: https://reviews.llvm.org/D100711
Jon Chesterfield [Sat, 24 Apr 2021 01:24:44 +0000 (02:24 +0100)]
[libomptarget] Enable AMDGPU devicertl
[libomptarget] Enable AMDGPU devicertl
The amdgpu devicertl is written in freestanding openmp and compiles to a
bitcode library (per listed gfx arch) with no unresolved symbols. It requires
a recent clang, preferably the one from the same monorepo checkout.
This is D98658, with printf explicitly stubbed out, after patching clang to no
longer require an llvm with the amdgpu target enabled.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D101213
Christopher Di Bella [Fri, 23 Apr 2021 23:08:58 +0000 (16:08 -0700)]
[libcxx] disables ranges for clang-cl
clang-cl doesn't properly handle concepts right now and is failing CI.
Differential Revision: https://reviews.llvm.org/D101205
RamNalamothu [Sat, 24 Apr 2021 00:12:40 +0000 (05:42 +0530)]
[NFC] Delete the redundant member 'shouldEmitMoves' from DwarfCFIException class
The data member 'shouldEmitMoves' is only used in DwarfCFIException::beginFunction()
and 'shouldEmitCFI' in DwarfCFIExceptionBase serves its purpose.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101155
Craig Topper [Fri, 23 Apr 2021 23:18:50 +0000 (16:18 -0700)]
[RISCV] Removed getLMULForFixedLengthVector.
Use getContainerForFixedLengthVector and getRegClassIDForVecVT to
get the register class to use when making a fixed vector type legal.
Inline it into the other two call sites.
I'm looking into using fractional lmul for fixed length vectors
and getLMULForFixedLengthVector returned an integer making it
unable to express this. I considered returning the LMUL
enum, but that seemed like it would introduce more complexity to
convert it for use.
Michael Kitzan [Fri, 23 Apr 2021 22:03:57 +0000 (15:03 -0700)]
[MachineCSE] Prevent CSE of non-local convergent instrs
At the moment, MachineCSE allows CSE-ing convergent instrs which are
non-local to each other. This can cause illegal codegen as convergent
instrs are control flow dependent. The patch prevents non-local CSE of
convergent instrs by adding a check in isProfitableToCSE and rejecting
CSE-ing if we're considering CSE-ing non-local convergent instrs. We
can still CSE convergent instrs which are in the same control flow
scope, so the patch purposely does not make all convergent instrs
non-CSE candidates in isCSECandidate.
https://reviews.llvm.org/D101187
Jon Chesterfield [Fri, 23 Apr 2021 22:52:49 +0000 (23:52 +0100)]
[clang][amdgpu] Use implicit code object version
[clang][amdgpu] Use implicit code object version
At present, clang always passes amdhsa-code-object-version on to -cc1. That is
great for certainty over what object version is being used when debugging.
Unfortunately, the command line argument is in AMDGPUBaseInfo.cpp in the amdgpu
target. If clang is used with an llvm compiled with DLLVM_TARGETS_TO_BUILD
that excludes amdgpu, this will be diagnosed (as discovered via D98658):
- Unknown command line argument '--amdhsa-code-object-version=4'
This means that clang, built only for X86, can be used to compile the nvptx
devicertl for openmp but not the amdgpu one. That would shortly spawn fragile
logic in the devicertl cmake to try to guess whether the clang used will work.
This change omits the amdhsa-code-object-version parameter when it matches the
default that AMDGPUBaseInfo.cpp specifies, with a comment to indicate why. As
this is the only part of clang's codegen for amdgpu that depends on the target
in the back end it suffices to build the openmp runtime on most (all?) systems.
It is a non-functional change, though observable in the updated tests and when
compiling with -###. It may cause minor disruption to the amd-stg-open branch.
Revision of D98746, builds on refactor in D101077
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D101095
Mitch Phillips [Fri, 23 Apr 2021 22:33:54 +0000 (15:33 -0700)]
Revert "[Scudo] Use GWP-ASan's aligned allocations and fixup postalloc hooks."
This reverts commit
a683abe5c026cffff12a943564f4cb1b20972abf.
Broke the upstream buildbots:
https://lab.llvm.org/buildbot/#/builders/37/builds/3731/steps/16/logs/stdio
Teresa Johnson [Fri, 23 Apr 2021 22:22:35 +0000 (15:22 -0700)]
Require asserts for test that uses debug flag
In
10b781fb033ee8d8a02e1050976b3832ad50542a this test was changed to use
the -debug-only flag, which means it now requires asserts aka a
non-release compiler.
Arthur O'Dwyer [Tue, 20 Apr 2021 15:25:37 +0000 (11:25 -0400)]
Implement N3644 "Null Forward Pointers" in _LIBCPP_DEBUG mode.
This functionality is tested in std/containers/sequences/vector/iterators.pass.cpp
(and similarly for all containers, but vector is the only one to be tested that
uses debug iterators).
Differential Revision: https://reviews.llvm.org/D100881
Craig Topper [Fri, 23 Apr 2021 21:26:32 +0000 (14:26 -0700)]
[RISCV] Move getLMULForFixedLengthVector out of RISCVSubtarget.
Make it a static function RISCVISelLowering, the only place it
is used.
I think I'm going to make this return a fractional LMULs in some
cases so I'm sorting out where it should live before I start
making changes.
Craig Topper [Fri, 23 Apr 2021 20:05:23 +0000 (13:05 -0700)]
[RISCV] Only expose one interface for getContainerForFixedLengthVector in the RISCVTargetLowering class
We can have RISCVISelDAGToDAG.cpp call the VT only version by
finding the RISCVTargetLowering object via the Subtarget.
Make the static versions just global static functions in
RISCVISelLowering that can be called by static functions in that
file.
Jez Ng [Fri, 23 Apr 2021 22:05:34 +0000 (18:05 -0400)]
[lld-macho] Fix use-after-free in loadDylib()
We were taking a reference to a value in `loadedDylibs`, which in turn
called `make<DylibFile>()`, which could then recursively call
`loadDylibs`, which would then potentially resize `loadedDylibs` and
invalidate that reference.
Fixes PR50101.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D101175
Jez Ng [Fri, 23 Apr 2021 22:05:48 +0000 (18:05 -0400)]
[lld-macho]][nfc] Fix some typos + rephrase a comment
I was a bit confused by the comment because I thought that "Tests
that..." was describing the tests contained within the same file.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D101160
Dávid Bolvanský [Fri, 23 Apr 2021 21:45:50 +0000 (23:45 +0200)]
[utils] Disable -Wdeprecated-copy for googlemock/gtest
Simple fix for build breakage. Feel free to fix all places (quite a lot).
wlei [Fri, 23 Apr 2021 19:35:12 +0000 (12:35 -0700)]
[CSSPGO] Fix missing debug info of dangling pseudo probe
While doing speculative execution opt, it conservatively drops all insn's debug info in the merged `ThenBB`(see the loop at line 2384) including the dangling probe. The missing debug info of the dangling probe will cause the wrong inference computation.
So we should avoid dropping the debug info from pseudo probe, this change try to fix this by moving the to-be dangling probe to the merging target BB before the debug info is dropped.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D101195
Aaron Puchert [Wed, 21 Apr 2021 15:21:22 +0000 (17:21 +0200)]
Thread safety analysis: Simplify intersectAndWarn (NFC)
Instead of conditionally overwriting a nullptr and then branching on its
nullness, just branch directly on the original condition. Then we can
make both pointers (non-null) references instead.
Stephen Kelly [Fri, 23 Apr 2021 12:30:19 +0000 (13:30 +0100)]
Enable AST introspection on non-X86
Thomas Lively [Fri, 23 Apr 2021 20:37:27 +0000 (13:37 -0700)]
[WebAssembly] Finalize wasm_simd128.h intrinsics
Adds new intrinsics for instructions that are in the final SIMD spec but did not
previously have intrinsics. Also updates the names of existing intrinsics to
reflect the final names of the underlying instructions in the spec. Keeps the
old names as deprecated functions to ease the transition to the new names.
Differential Revision: https://reviews.llvm.org/D101112
Nikita Popov [Fri, 23 Apr 2021 20:05:52 +0000 (22:05 +0200)]
[SCEV] Add loop guard tests for ugt/uge predicates (NFC)
Nemanja Ivanovic [Fri, 23 Apr 2021 16:50:13 +0000 (11:50 -0500)]
[PowerPC] Provide XL-compatible builtins in altivec.h
There are some interfaces in altivec.h that are not compatible
between Clang and XL (although Clang is compatible with GCC).
Currently, we have found 3 but there may be others.
Clang/GCC signatures:
vector double vec_ctf(vector signed long long)
vector double vec_ctf(vector unsigned long long)
vector signed long long vec_cts(vector double)
vector unsigned long long vec_ctu(vector double)
XL signatures:
vector float vec_ctf(vector signed long long)
vector float vec_ctf(vector unsigned long long)
vector signed int vec_cts(vector double)
vector unsigned int vec_ctu(vector double)
This patch provides the XL behaviour under the __XL_COMPAT_ALTIVEC__
macro for users that rely on XL behaviour.
Differential revision: https://reviews.llvm.org/D101130
Rob Suderman [Wed, 21 Apr 2021 07:53:50 +0000 (00:53 -0700)]
[mlir][tosa] Add tosa.resize lowering to linalg generic
Includes tests and implementation for both integer and floating point values.
Both nearest neighbor and bilinear interpolation is included.
Differential Revision: https://reviews.llvm.org/D101009
zoecarver [Fri, 23 Apr 2021 19:37:47 +0000 (12:37 -0700)]
[libcxx][nfc] Add license to `pointer_comparison_test_helper.h`
Christian Kandeler [Fri, 23 Apr 2021 19:17:43 +0000 (21:17 +0200)]
[clangd] Allow AST request without range
If no range is given, return the translation unit AST.
This is useful for tooling operations that require e.g. the full path to
a node.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D101057
Dávid Bolvanský [Fri, 23 Apr 2021 19:12:51 +0000 (21:12 +0200)]
[InstCombine] X - usub.sat(X, Y) => umin(X, Y)
Pattern regressed in LLVM 9 with the introduction of usub.sat.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42178#c2
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101184
Pooja Yadav [Fri, 23 Apr 2021 18:49:53 +0000 (00:19 +0530)]
[Docs] Updated LLVM_TARGETS_TO_BUILD section in GettingStarted.rst
Updated LLVM_TARGETS_TO_BUILD under https://llvm.org/docs/GettingStarted.html#local-llvm-configuration.
Differential Revision: https://reviews.llvm.org/D101101
Alexander Belyaev [Fri, 23 Apr 2021 17:47:51 +0000 (19:47 +0200)]
[mlir] Add block arguments for input/output operands of 'linalg.tiled_loop`.
Differential Revision: https://reviews.llvm.org/D101186
Nico Weber [Fri, 23 Apr 2021 16:49:14 +0000 (12:49 -0400)]
[lld/mac] Support more flags for --reproduce
I went through the callers of `readFile()` and `addFile()` in Driver.cpp
and checked that the options that use them all get rewritten in the
--reproduce response file. -(un)exported_symbols_list and -bundle_loader
weren't, so add them.
Also spruce up the test for reproduce a bit and actually try linking
with the exptracted repro archive.
Motivated by the response file in PR50098 complaining abou the
-exported_symbols_list path being wrong :)
Differential Revision: https://reviews.llvm.org/D101182
Peter Collingbourne [Fri, 23 Apr 2021 18:25:20 +0000 (11:25 -0700)]
scudo: Work around gcc 8 conversion warning.
Should fix:
https://lab.llvm.org/buildbot#builders/99/builds/2953
Hongtao Yu [Fri, 23 Apr 2021 07:26:11 +0000 (00:26 -0700)]
[CSSPGO] Fix incorrect prorating indirect call distribution factor that leads to target count loss.
Pseudo probe distribution factor is used to scale down profile samples to avoid misleading the counts inference due to the usage of "maximum" in `getBlockWeight`. For callsites, the scaling down can come from code duplication prior to the sample profile loader (prelink or postlink), or due to the indirect call promotion in sample loader inliner. This patch fixes an issue in sample loader ICP where the leftover indirect callsite scaling down causes the loss of non-promoted call target samples unexpectedly. While the scaling down is to favor BFI/BPI with accurate an callsite count, it doesn't fit in the current distribution factor that represents code duplication changes. Ideally, we would need two factors, one is for code duplication, the other is for ICP. However this seems over complicated. I'm going to trade one usage (callsite counts) for the other (call target counts).
Seeing perf win on one benchmark (mcf) of SPEC2017 with others unchanged.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D100993
Mitch Phillips [Fri, 23 Apr 2021 17:45:44 +0000 (10:45 -0700)]
[hwasan] Remove untagging of kernel-consumed memory
Now that page aliasing for x64 has landed, we don't need to worry about
passing tagged pointers to libc, and thus D98875 removed it.
Unfortunately, we still test on aarch64 devices that don't have the
kernel tagged address ABI (https://reviews.llvm.org/D98875#2649269).
All the memory that we pass to the kernel in these tests is from global
variables. Instead of having architecture-specific untagging mechanisms
for this memory, let's just not tag the globals.
Reviewed By: eugenis, morehouse
Differential Revision: https://reviews.llvm.org/D101121
Fangrui Song [Fri, 23 Apr 2021 17:49:19 +0000 (10:49 -0700)]
[OpenMP] Fix -Wdeprecated-copy
Mitch Phillips [Fri, 23 Apr 2021 17:36:56 +0000 (10:36 -0700)]
Revert "[X86][AMX] Try to hoist AMX shapes' def"
This reverts commit
90118563ad0f133c696e070ad72761fa0daa4517.
Reason: Broke the MSan buildbots.
https://lab.llvm.org/buildbot/#/builders/5/builds/6967/steps/9/logs/stdio
More details can be found in the original phabricator review:
https://reviews.llvm.org/D101067
Sanjay Patel [Fri, 23 Apr 2021 17:19:46 +0000 (13:19 -0400)]
[InstCombine] fold 'not' of ctpop in parity pattern
As discussed in https://llvm.org/PR50096 , we could
convert the 'not' into a 'sub' and see the same
fold. That's because we already have another demanded
bits optimization for 'sub'.
We could add a related transform for
odd-number-of-type-bits, but that seems unlikely
to be practical.
https://alive2.llvm.org/ce/z/TWJZXr
Sanjay Patel [Fri, 23 Apr 2021 17:06:02 +0000 (13:06 -0400)]
[InstCombine] add test for ctpop; NFC
Goes with
2912f42a / PR50096.
Mitch Phillips [Fri, 23 Apr 2021 16:47:07 +0000 (09:47 -0700)]
[Scudo] Use GWP-ASan's aligned allocations and fixup postalloc hooks.
This patch does a few cleanup things:
1. The non-standalone scudo has a problem where GWP-ASan allocations
may not meet alignment requirements where Scudo was requested to have
alignment >= 16. Use the new GWP-ASan API to fix this.
2. The standalone variant loses some debugging information inside of
GWP-ASan because we ask GWP-ASan to allocate an aligned size in the
frontend. This means reports end up with 'UaF on a 16-byte allocation'
for a 1-byte allocation with 16-byte alignment. Also use the new API to
fix this.
3. Add post-alloc hooks for GWP-ASan intercepted allocations, and add
stats tracking for GWP-ASan allocations.
4. Add a small test that checks the alignment of the frontend
allocator, so that it can be used under GWP-ASan torture mode.
5. Add GWP-ASan torture mode as a testing configuration to catch these
regressions.
Depends on D94830, D95889.
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D95884
Chris Hamilton [Thu, 22 Apr 2021 20:39:36 +0000 (15:39 -0500)]
[PR49761] Fix variadic arg handling in matcher
Mishandling of variadic arguments in a function call caused a crash
(runtime assert fail) in bugprone-infinite-loop tidy checker. Fix
is to limit argument matching to the lesser of the number of variadic
params in the prototype or the number of actual args in the call.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D101108
Teresa Johnson [Fri, 23 Apr 2021 16:30:28 +0000 (09:30 -0700)]
Mark type test intrinsics as speculatable to fix inline cost
There is already code in InlineCost.cpp to identify and ignore ephemeral
values (llvm.assume intrinsics and other side-effect free instructions
only feeding the assumes). However, because llvm.type.test intrinsics
were not marked speculatable, they and any instructions specifically
feeding the type test (typically a bitcast) were being counted towards
the instruction cost when inlining. This was causing profile matching
issues in some cases when enabling -fwhole-program-vtables for whole
program devirtualization.
According to the language reference, the speculatable attribute means:
"the function does not have any effects besides calculating its result
and does not have undefined behavior". I see no reason why type tests
cannot be marked with this attribute.
There are 2 test changes:
llvm/test/Transforms/Inline/ephemeral.ll: I added a type test intrinsic
here to verify the fix. Also, I found the test was not actually testing
what it originally intended. Many of the existing instructions were
optimized away by -Oz, and the cost of inlining was negative due to the
benefit of removing the call. So I changed the test to simply invoke the
inline pass and check the number of instructions computed by InlineCost.
I also fixed an instruction that was not actually used anywhere.
llvm/test/Transforms/SimplifyCFG/no-md-sink.ll needed to be made more
robust to code changes that reordered the metadata.
Differential Revision: https://reviews.llvm.org/D101180
Snehasish Kumar [Fri, 23 Apr 2021 00:38:13 +0000 (17:38 -0700)]
[NFC] Use hasSection instead of getSection().empty()
Use the optimized check hasSection() instead of calling
getSection().empty(). Originally suggested in D101004, but was dropped
in the commit.
Stephen Kelly [Fri, 23 Apr 2021 15:24:14 +0000 (16:24 +0100)]
[AST] Update tests to query for introspection support
Louis Dionne [Wed, 10 Feb 2021 21:19:50 +0000 (16:19 -0500)]
[libc++] Rewrite the tuple constructors to be strictly Standards conforming
This nasty patch rewrites the tuple constructors to match those defined
by the Standard. We were previously providing several extensions in those
constructors - those extensions are removed by this patch.
The issue with those extensions is that we've had numerous bugs filed
against us over the years for problems essentially caused by them. As a
result, people are unable to use tuple in ways that are blessed by the
Standard, all that for the perceived benefit of providing them extensions
that they never asked for.
Since this is an API break, I communicated it in the release notes.
I do not foresee major issues with this break because I don't think the
extensions are too widely relied upon, but we can ship it and see if we
get complaints before the next LLVM release - that will give us some
amount of information regarding how much use these extensions have.
Differential Revision: https://reviews.llvm.org/D96523
Jeremy Morse [Fri, 23 Apr 2021 16:38:44 +0000 (17:38 +0100)]
Drop a REQUIRES: lldb on a dexter regression test
As this is a test that actually gets to operating the debugger, it
needs to be limited to scenarios where the debugger is available.
(We'll file this in the set of things Dexter doesn't handle gracefully..)
Craig Topper [Fri, 23 Apr 2021 16:33:24 +0000 (09:33 -0700)]
[RISCV] Remove GetVRegNoV0 from the output register class of masked compare pseudo instructions.
Theses instructions are allowed to write v0 when they are masked.
We'll still never use v0 because of the earlyclobber constraint so
this doesn't really help anything. It just makes the definitions
correct.
While I was there remove an unused multiclass I noticed.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D101118
Craig Topper [Fri, 23 Apr 2021 16:33:09 +0000 (09:33 -0700)]
[RISCV] Have assembler check that the temp register is different than dest register for vmsgeu.vx pseudo.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D101015
Peter Collingbourne [Fri, 23 Apr 2021 05:41:01 +0000 (22:41 -0700)]
scudo: Store header on deallocation before retagging memory.
From a cache perspective it's better to store the header immediately
after loading it. If we delay this operation until after we've
retagged it's more likely that our header will have been evicted from
the cache and we'll need to fetch it again in order to perform the
compare-exchange operation.
For similar reasons, store the deallocation stack before retagging
instead of afterwards.
Differential Revision: https://reviews.llvm.org/D101137
Florian Hahn [Fri, 23 Apr 2021 10:33:38 +0000 (11:33 +0100)]
[VPlan] Add GraphTraits impl to traverse through VPRegionBlock.
This patch adds a new iterator to traverse through VPRegionBlocks and a
GraphTraits specialization using the iterator to traverse through
VPRegionBlocks.
Because there is already a GraphTraits specialization for VPBlockBase *
and co, a new VPBlockRecursiveTraversalWrapper helper is introduced.
This allows us to provide a new GraphTraits specialization for that
type. Users can use the new recursive traversal by using this wrapper.
The graph trait visits both the entry block of a region, as well as all
its successors. Exit blocks of a region implicitly have their parent
region's successors. This ensures all blocks in a region are visited
before any blocks in a successor region when doing a reverse post-order
traversal of the graph.
Reviewed By: a.elovikov
Differential Revision: https://reviews.llvm.org/D100175
Johannes Doerfert [Fri, 23 Apr 2021 01:36:18 +0000 (01:36 +0000)]
[OpenMP] Avoid reading uninitialized parallel level values
In a last minute change request for
a2dbfb6b72db we introduced a
read of the uninitialized parallel level value in SPMD-mode.
We go back to initializing the array early and checking for an
adjusted level.
Found by the miniqmc unit tests:
https://cdash.qmcpack.org/CDash/viewTest.php?onlyfailed&buildid=203434
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D101123
Johannes Doerfert [Wed, 21 Apr 2021 07:27:32 +0000 (02:27 -0500)]
[Clang] Allow the combination of loader_uninitialized and address spaces
When an object is allocated in a non-default address space we do not
need to check for a constructor if it is not initialized and has a
trivial constructor (which we won't call then).
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D100929
Dávid Bolvanský [Fri, 23 Apr 2021 16:16:22 +0000 (18:16 +0200)]
[libcxx] Fixed build break on buildbots with -Werror
Sebastian Neubauer [Fri, 23 Apr 2021 14:09:31 +0000 (16:09 +0200)]
[AMDGPU] Save WWM registers in functions
The values of registers in inactive lanes needs to be saved during
function calls.
Save all registers used for whole wave mode, similar to how it is done
for VGPRs that are used for SGPR spilling.
Differential Revision: https://reviews.llvm.org/D99429
Reapply with fixed tests on window.
Paul C. Anagnostopoulos [Fri, 23 Apr 2021 16:03:48 +0000 (12:03 -0400)]
[TableGen] [docs] Improve BNF for the 'multiclass' statement [NFC]
Nemanja Ivanovic [Fri, 23 Apr 2021 15:29:49 +0000 (10:29 -0500)]
[PowerPC] Add vec_ctsl and vec_ctul to altivec.h
These are added for compatibility with XLC. They are similar to
vec_cts and vec_ctu except that the result is a doubleword vector
regardless of the parameter type.
Dave Lee [Thu, 22 Apr 2021 17:08:53 +0000 (10:08 -0700)]
[cmake] Configure policy CMP0116
Using `cmake` >=3.20 results in many warnings about this new policy. This change silences the warnings by explicitly declaring use of the "OLD" behavior.
This policy currently affects only one place: the `tablegen()` function in `TableGen.cmake`.
Differential Revision: https://reviews.llvm.org/D101083
Simon Pilgrim [Fri, 23 Apr 2021 15:55:59 +0000 (16:55 +0100)]
[CostModel][X86] Improve v2f32 fadd reduction cost
This was being reported as a similar cost to v4f32 when its a lot cheaper (just a shufps+addps).
Nico Weber [Fri, 23 Apr 2021 15:45:49 +0000 (11:45 -0400)]
fix comment typo to cycle bots
Gabor Marton [Thu, 22 Apr 2021 13:12:40 +0000 (15:12 +0200)]
[Analyzer][StdLibraryFunctionsChecker] Describe arg constraints
In this patch, I provide a detailed explanation for each argument
constraint. This explanation is added in an extra 'note' tag, which is
displayed alongside the warning.
Since these new notes describe clearly the constraint, there is no need
to provide the number of the argument (e.g. 'Arg3') within the warning.
However, I decided to keep the name of the constraint in the warning (but
this could be a subject of discussion) in order to be able to identify
the different kind of constraint violations easily in a bug database
(e.g. CodeChecker).
Differential Revision: https://reviews.llvm.org/D101060
Stephen Kelly [Thu, 22 Apr 2021 11:53:52 +0000 (12:53 +0100)]
[AST] Sort introspection results without instantiating other data
Avoid string allocation in particular, but also avoid attempting to
impose any particular ordering based on formatted results.
Differential Revision: https://reviews.llvm.org/D101054
Andrzej Warzynski [Fri, 23 Apr 2021 14:49:10 +0000 (14:49 +0000)]
[flang] Switch from %f18 to %flang_fc1 in a test
This patch updates the final test that can be shared between the old and
the new Flang drivers and that has not been ported yet. %f18 (always
expanded as `f18`) is replaced with %flang_fc1 (expanded as either `f18`
or `flang-new -fc1`, depending on `FLANG_BUILD_NEW_DRIVER`).
This test should've been updated in https://reviews.llvm.org/D100309,
but I missed it then. That's because this test contains non-ascii
characters and `grep -I %f18` (as well as other grep-like tools) skips
it because it's interpreted as a data/binary file. In fact, it's just a
text file with non-ascii chars.
Since this is an obvious omission from D100309 (reviewed, accepted and
merged), I'm sending this without a review to reduce the noise on
Phabricator.
Sander de Smalen [Wed, 27 Jan 2021 15:01:16 +0000 (15:01 +0000)]
[TTI] NFC: Change getIntImmCost[Inst|Intrin] to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D100565
Sander de Smalen [Wed, 27 Jan 2021 13:32:39 +0000 (13:32 +0000)]
[TTI] NFC: Change getScalingFactorCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D100564
Sander de Smalen [Wed, 27 Jan 2021 13:25:18 +0000 (13:25 +0000)]
[TTI] NFC: Change getMemcpyCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D100563
Sander de Smalen [Wed, 27 Jan 2021 13:15:21 +0000 (13:15 +0000)]
[TTI] NFC: Change getGEPCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D100562
Sander de Smalen [Wed, 27 Jan 2021 13:12:56 +0000 (13:12 +0000)]
[TTI] NFC: Change getAddressComputationCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D100561
dfukalov [Thu, 22 Apr 2021 11:52:25 +0000 (14:52 +0300)]
[TTI] NFC: Use InstructionCost to store ScalarizationCost in IntrinsicCostAttributes.
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: samparker
Differential Revision: https://reviews.llvm.org/D101151
Daniil Fukalov [Thu, 22 Apr 2021 19:14:49 +0000 (22:14 +0300)]
[TTI] Fix ScalarizationCost initialization.
In cases when ScalarizationCostPassed has no value, UINT_MAX is actually used
for cost estimation in `return ScalarCalls * ScalarCost + ScalarizationCost`.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D101099
Joe Ellis [Wed, 14 Apr 2021 09:50:57 +0000 (09:50 +0000)]
[AArch64][SVE] Fix bug in lowering of fixed-length integer vector divides
The function AArch64TargetLowering::LowerFixedLengthVectorIntDivideToSVE
previously assumed the operands were full vectors, but this is not
always true. This function would produce bogus if the division operands
are not full vectors, resulting in miscompiles when dividing 8-bit or
16-bit vectors.
The fix is to perform an extend + div + truncate for non-full vectors,
instead of the usual unpacking and unzipping logic. This is an additive
change which reduces the non-full integer vector divisions to a pattern
recognised by the existing lowering logic.
For future reference, an example of code that would miscompile before
this patch is below:
1 int8_t foo(unsigned N, int8_t *a, int8_t *b, int8_t *c) {
2 int8_t result = 0;
3 for (int i = 0; i < N; ++i) {
4 result += (a[i] / b[i]) / c[i];
5 }
6 return result;
7 }
Differential Revision: https://reviews.llvm.org/D100370
Jay Foad [Wed, 21 Apr 2021 14:32:00 +0000 (15:32 +0100)]
[AMDGPU] Fix typo in implicit operand lists
Several tests had a typo where they mentioned sgpr17 twice instead of
sgpr17 and sgpr27. This had a significant effect on the
"scavenge_sgpr_pei_no_sgprs" tests because there was actually an sgpr
available, namely sgpr27.
Differential Revision: https://reviews.llvm.org/D100960
Sebastian Neubauer [Fri, 23 Apr 2021 14:38:23 +0000 (16:38 +0200)]
Revert "[AMDGPU] Save WWM registers in functions"
This reverts commit
91464c30bfcf731ccb7f9d6ef6d26e8c1657a6e6.
Seems to break tests on windows.
Piotr Sobczak [Fri, 23 Apr 2021 14:19:04 +0000 (16:19 +0200)]
[AMDGPU][NFC] Update auto-gen test
Most likely the "glc" was not added to the test when
the volatile loads started generating those bits.
Krzysztof Parzyszek [Fri, 23 Apr 2021 13:11:59 +0000 (08:11 -0500)]
[Hexagon] Remove redundant HVX intrinsic selection patterns, NFC
Deleted HexagonMapAsm2IntrinV65.gen.td that wasn't included anywhere,
moved V6_vrmpy*_rtt* patterns to HexagonIntrinsics.td.
Touch CMakeLists.txt to force re-cmake (somehow the unused file was
listed as a dependency in the generated makefiles).