LLVM GN Syncbot [Sat, 19 Jun 2021 11:49:56 +0000 (11:49 +0000)]
[gn build] Port
134723edd5bf
Louis Dionne [Thu, 17 Jun 2021 15:30:11 +0000 (11:30 -0400)]
[libcxx] Move all algorithms into their own headers
This is a fairly mechanical change, it just moves each algorithm into
its own header. This is intended to be a NFC.
This commit re-applies
7ed7d4ccb899, which was reverted in
692d7166f771
because the Modules build got broken. The modules build has now been
fixed, so we're re-committing this.
Differential Revision: https://reviews.llvm.org/D103583
Attribution note
----------------
I'm only committing this. This commit is a mix of D103583, D103330 and
D104171 authored by:
Co-authored-by: Christopher Di Bella <cjdb@google.com>
Co-authored-by: zoecarver <z.zoelec2@gmail.com>
Markus Böck [Sat, 19 Jun 2021 11:28:12 +0000 (13:28 +0200)]
[clang-cl] Don't expand /permissive- to /ZC:strictStrings yet
Follow up on rGc70b0e808da8
/Zc:strictStrings is an alias to an option part of the -W group. When the driver tries to render the option back to a string for the cc1 invocation, it sadly gets rendered with the original spelling instead of the alias, causing issues reported here: https://reviews.llvm.org/D103773#inline-989447
I am thinking it's the best to revert this part of the patch until I figured out how to correctly add the arg and until /Zc:strictStrings- exists/is needed.
Melanie Blower [Sat, 19 Jun 2021 10:49:27 +0000 (06:49 -0400)]
[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contract=on
This patch changes the ffp-model=precise to enables -ffp-contract=on
(previously -ffp-model=precise enabled -ffp-contract=fast). This is a
follow-up to Andy Kaylor's comments in the llvm-dev discussion
"Floating Point semantic modes". From the same email thread, I put
Andy's distillation of floating point options and floating point modes
into UsersManual.rst
Differential Revision: https://reviews.llvm.org/D74436
Marius Brehler [Wed, 9 Jun 2021 13:38:10 +0000 (13:38 +0000)]
[mlir] Add EmitC dialect
This upstreams the EmitC dialect and the corresponding Cpp target, both
initially presented with [1], from [2] to MLIR core. For the related
discussion, see [3].
[1] https://reviews.llvm.org/D76571
[2] https://github.com/iml130/mlir-emitc
[3] https://llvm.discourse.group/t/emitc-generating-c-c-from-mlir/3388
Co-authored-by: Jacques Pienaar <jpienaar@google.com>
Co-authored-by: Simon Camphausen <simon.camphausen@iml.fraunhofer.de>
Co-authored-by: Oliver Scherf <oliver.scherf@iml.fraunhofer.de>
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D103969
Nikita Popov [Thu, 17 Jun 2021 19:49:29 +0000 (21:49 +0200)]
[LoopUnroll] Push runtime unrolling decision up into tryToUnrollLoop()
Currently, UnrollLoop() is passed an AllowRuntime flag and decides
itself whether runtime unrolling should be used or not. This patch
pushes the decision into the caller and allows us to eliminate the
ULO.TripCount and ULO.TripMultiple parameters.
Differential Revision: https://reviews.llvm.org/D104487
Ben Shi [Sat, 19 Jun 2021 03:01:43 +0000 (11:01 +0800)]
[RISCV] Optimize add-mul in the zba extension with SH*ADD
This patch does the following optimization.
Rx + Ry * 18 => (SH1ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 20 => (SH2ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 24 => (SH3ADD (SH1ADD Rx, Rx), Ry)
Rx + Ry * 36 => (SH2ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 40 => (SH3ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 72 => (SH3ADD (SH3ADD Rx, Rx), Ry)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D104588
Ben Shi [Sat, 19 Jun 2021 02:09:08 +0000 (10:09 +0800)]
[RISCV][test] Add new tests for add-mul optimization in the zba extension with SH*ADD
These tests will show the following optimization by future patches.
Rx + Ry * 18 => (SH1ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 20 => (SH2ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 24 => (SH3ADD (SH1ADD Rx, Rx), Ry)
Rx + Ry * 36 => (SH2ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 40 => (SH3ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 72 => (SH3ADD (SH3ADD Rx, Rx), Ry)
Rx * (3 << C) => (SLLI (SH1ADD Rx, Rx), C)
Rx * (5 << C) => (SLLI (SH2ADD Rx, Rx), C)
Rx * (9 << C) => (SLLI (SH3ADD Rx, Rx), C)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D104507
Lang Hames [Sat, 19 Jun 2021 04:44:38 +0000 (14:44 +1000)]
[ORC][examples] Add missing library dependence
Matthias Springer [Sat, 19 Jun 2021 04:25:47 +0000 (13:25 +0900)]
[mlir][linalg] Lower subtensor(pad_tensor) to pad_tensor(subtensor)
Only high padding is supported at the moment. Low padding will be added in a separate commit.
Differential Revision: https://reviews.llvm.org/D104357
Jez Ng [Sat, 19 Jun 2021 02:30:57 +0000 (22:30 -0400)]
[re-land][lld-macho] Avoid force-loading the same archive twice
This reverts commit
c9b241efd68c5a0f1f67e9250960ade454f3bc11, which was
a backout diff to fix the buildbots.
The real culprit of the crash is
https://github.com/llvm/llvm-project/commit/
1d31fb8d122b1117cf20a9edc09812db8472e930,
which is being reverted.
Differential Revision: https://reviews.llvm.org/D104353
Jez Ng [Sat, 19 Jun 2021 02:19:09 +0000 (22:19 -0400)]
Revert "[lld-macho] Have path-related functions return std::string, not StringRef"
This reverts commit
1d31fb8d122b1117cf20a9edc09812db8472e930.
Making `rerootPath` return a temporary std::string caused a
use-after-free:
https://ci.chromium.org/ui/p/chromium/builders/try/win_upload_clang/1608/overview
Liqiang Tao [Sat, 19 Jun 2021 02:17:19 +0000 (10:17 +0800)]
[llvm][Inliner] Add an optional PriorityInlineOrder
This patch adds an optional PriorityInlineOrder, which uses the heap to order inlining.
The callsite which size is smaller would have a higher priority.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D104028
Lang Hames [Sat, 19 Jun 2021 01:41:42 +0000 (11:41 +1000)]
[ORC][C-bindings] Add access to LLJIT IRTransformLayer, ThreadSafeModule utils.
This patch was derived from Valentin Churavy's work in
https://reviews.llvm.org/D104480. It adds support for setting the transform on
an IRTransformLayer, and for accessing the IRTransformLayer in LLJIT. It also
adds access to the ThreadSafeModule::withModuleDo method for thread-safe
access to modules.
A new example has been added to show how to use these APIs to optimize a module
during materialization.
Thanks Valentin!
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D103855
Lang Hames [Fri, 18 Jun 2021 23:22:45 +0000 (09:22 +1000)]
[ORC][examples] Fix file name in comment.
George Balatsouras [Fri, 18 Jun 2021 21:10:49 +0000 (21:10 +0000)]
[libfuzzer] Disable failing DFSan-related tests
These have been broken by https://reviews.llvm.org/D104494.
However, `lib/fuzzer/dataflow/` is unused (?) so addressing this is not a priority.
Added TODOs to re-enable them in the future.
Reviewed By: stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D104568
Guozhi Wei [Sat, 19 Jun 2021 01:01:34 +0000 (18:01 -0700)]
[InstCombine] Don't transform code if DoTransform is false
In patch https://reviews.llvm.org/D72396, it doesn't check DoTransform before transforming the code, and generates wrong result for the attached test case.
Differential Revision: https://reviews.llvm.org/D104567
Nico Weber [Sat, 19 Jun 2021 00:22:15 +0000 (20:22 -0400)]
Revert "[lld-macho] Avoid force-loading the same archive twice"
This reverts commit
24706cd73cd150543753a2e169c68a2c68da46a1.
Test seems to fail flakily. See comments on https://reviews.llvm.org/D104353
for a hypothesis for why.
Fangrui Song [Sat, 19 Jun 2021 00:01:17 +0000 (17:01 -0700)]
[InstrProfiling][ELF] Make __profd_ private if the function does not use value profiling
On ELF, the
D1003372 optimization can apply to more cases. There are two
prerequisites for making `__profd_` private:
* `__profc_` keeps `__profd_` live under compiler/linker GC
* `__profd_` is not referenced by code
The first is satisfied because all counters/data are in a section group (either
`comdat any` or `comdat noduplicates`). The second requires that the function
does not use value profiling.
Regarding the second point: `__profd_` may be referenced by other text sections
due to inlining. There will be a linker error if a prevailing text section
references the non-prevailing local symbol.
With this change, a stage 2 (`-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_INSTRUMENTED=IR`)
clang is 4.2% smaller (1-
169620032/
177066968).
`stat -c %s **/*.o | awk '{s+=$1}END{print s}' is 2.5% smaller.
Reviewed By: davidxl, rnk
Differential Revision: https://reviews.llvm.org/D103717
peter klausler [Fri, 18 Jun 2021 23:55:37 +0000 (16:55 -0700)]
[flang] Recode a switch() to dodge a sketchy warning
One of the buildbots uses a compiler (can't tell which) that
doesn't approve of a "default:" in a switch statement whose
cases appear to completely cover all possible values of an
enum class. But this switch is in raw data dumping code that
needs to allow for incorrect values in memory. So rewrite it
as a cascade of if statements; performance doesn't matter here.
Fangrui Song [Fri, 18 Jun 2021 23:44:03 +0000 (16:44 -0700)]
[profile][test] Delete profraw directory so that tests are immune to format version upgrade
Matt Arsenault [Sat, 12 Jun 2021 15:21:57 +0000 (11:21 -0400)]
AMDGPU: Fix infinite loop in DAG combine with fneg + fma
We were not reporting isFNegFree for v2f32, although it is effectively
free after legalization. The generic combine was pulling fneg out of
the fma source operands, and the AMDGPU combine was doing the
opposite.
Nico Weber [Fri, 18 Jun 2021 22:50:44 +0000 (18:50 -0400)]
Re-Revert "DirectoryWatcher: add an implementation for Windows"
This reverts commit
76f1baa7875acd88bdd4b431eed6e2d2decfc0fe.
Also reverts 2 follow-ups:
1. Revert "DirectoryWatcher: also wait for the notifier thread"
This reverts commit
527a1821e6f8e115db3335a3341c7ac491725a0d.
2. Revert "DirectoryWatcher: close a possible window of race on Windows"
This reverts commit
a6948da86ad7e78d66b26263c2681ef6385cc234.
Makes tests hang, see comments on https://reviews.llvm.org/D88666
Matt Arsenault [Mon, 14 Jun 2021 16:53:36 +0000 (12:53 -0400)]
AMDGPU: Fix assert on m0_lo16/m0_hi16
These get added (redundantly) to the bundle expanded for indirect
register accesses. We hit this path only when there is a call in the
function.
Shilei Tian [Fri, 18 Jun 2021 22:35:34 +0000 (18:35 -0400)]
[OpenMP] Make bug49334.cpp more reproducible
`bug49334.cpp` cannot detect data race in `libomptarget` efficiently. It
is reported that with `N = 256` and `BS = 16`, the data race can be reproduced
more steadily. The next coming pathces will fix it so this patch is expected to
fail now.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104552
Hongtao Yu [Thu, 17 Jun 2021 18:09:13 +0000 (11:09 -0700)]
[CSSPGO] Undoing the concept of dangling pseudo probe
As a follow-up to https://reviews.llvm.org/D104129, I'm cleaning up the danling probe related code in both the compiler and llvm-profgen.
I'm seeing a 5% size win for the pseudo_probe section for SPEC2017 and 10% for Ciner. Certain benchmark such as 602.gcc has a 20% size win. No obvious difference seen on build time for SPEC2017 and Cinder.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D104477
peter klausler [Fri, 18 Jun 2021 22:11:55 +0000 (15:11 -0700)]
[flang] Fix clang build (struct/class mismatch warning)
A recent patch changed a struct into a class, but missed a
forward definition. GCC didn't warn, but clang does. Fix.
Nick Desaulniers [Fri, 18 Jun 2021 22:09:18 +0000 (15:09 -0700)]
Whitespace fixes for
193e41c987127aad86d0380df83e67a85266f1f1
which reportedly fails on the mac builds.
Stella Laurenzo [Fri, 18 Jun 2021 21:42:56 +0000 (21:42 +0000)]
Partial rollback: Disable MLIR verifier parallelism.
Deadlocks have been found in several downstream projects as noted on the original patch: https://reviews.llvm.org/D104207
Disabling pending full root cause analysis.
Differential Revision: https://reviews.llvm.org/D104570
Nikita Popov [Thu, 17 Jun 2021 19:03:50 +0000 (21:03 +0200)]
[LoopUnroll] Simplify optimization remarks
Remove dependence on ULO.TripCount/ULO.TripMultiple from ORE and
debug code. For debug code, print information about all exits.
For optimization remarks, only include the unroll count and the
type of unroll (complete, partial or runtime), but omit detailed
information about exit folding, now that more than one exit may
be folded.
Differential Revision: https://reviews.llvm.org/D104482
Hongtao Yu [Fri, 18 Jun 2021 01:02:45 +0000 (18:02 -0700)]
[CSSPGO][llvm-profgen] Fix an issue in findDisjointRanges
We were using 0 as an indicator of invalid offset when computing disjoint ranges. In reality, 0 can be an valid code offset which stands for the first function in .text section. I'm using UINT64_MAX as an invalid code offset instead.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D104497
River Riddle [Fri, 18 Jun 2021 20:30:16 +0000 (20:30 +0000)]
[mlir] Add support to SourceMgrDiagnosticHandler for filtering FileLineColLocs
This revision adds support for passing a functor to SourceMgrDiagnosticHandler for filtering out FileLineColLocs when emitting a diagnostic. More specifically, this can be useful in situations where there may be large CallSiteLocs with locations that aren't necessarily important/useful for users.
For now the filtering support is limited to FileLineColLocs, but conceptually we could allow filtering for all locations types if a need arises in the future.
Differential Revision: https://reviews.llvm.org/D103649
Nick Desaulniers [Fri, 18 Jun 2021 20:58:34 +0000 (13:58 -0700)]
[GCOVProfiling] don't profile Fn's w/ noprofile attribute
Similar to D104475, the Linux kernel would like to avoid compiler
generated code in certain functions. The no_profile function
attribute can be used in C to generate the the noprofile fn attr in IR.
Respect that from GCOVProfiling.
Link: https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D104257
Nick Desaulniers [Fri, 18 Jun 2021 20:33:44 +0000 (13:33 -0700)]
[Clang][Codegen] Add GNU function attribute 'no_profile' and lower it to noprofile
noprofile IR attribute already exists to prevent profiling with PGO;
emit that when a function uses the newly added no_profile function
attribute.
The Linux kernel would like to avoid compiler generated code in
functions annotated with such attribute. We already respect this for
libcalls to fentry() and mcount().
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223
Link: https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/
Reviewed By: MaskRay, void, phosek, aaron.ballman
Differential Revision: https://reviews.llvm.org/D104475
Leonard Chan [Fri, 18 Jun 2021 20:39:58 +0000 (13:39 -0700)]
[NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads
Once D104553 lands, CreateCurrentThread will be able to accept optional
parameters for initializing the hwasan thread object. On fuchsia, we can get
stack info in the platform-specific InitThreads and pass it through
CreateCurrentThread. On linux, this is a no-op.
Differential Revision: https://reviews.llvm.org/D104561
Jez Ng [Fri, 18 Jun 2021 06:32:31 +0000 (02:32 -0400)]
[lld-macho] Have path-related functions return std::string, not StringRef
findLibrary() returned a StringRef while findFramework & other helper
functions returned std::strings. Standardize on std::string.
(I initially tried making the helper functions all return StringRefs,
but I realized we shouldn't return input StringRefs since their
lifetimes would not be obvious from the calling code.)
Jez Ng [Fri, 18 Jun 2021 20:35:46 +0000 (16:35 -0400)]
[lld-macho] Handle non-extern symbols marked as private extern
Previously, we asserted that such a case was invalid, but in fact
`ld -r` can emit such symbols if the input contained a (true) private
extern, or if it contained a symbol started with "L".
Non-extern symbols marked as private extern are essentially equivalent
to regular TU-scoped symbols, so no new functionality is needed.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D104502
Arnamoy Bhattacharyya [Fri, 18 Jun 2021 19:37:36 +0000 (15:37 -0400)]
[flang][OpenMP] Add semantic checks for occurrence of nested Barrier regions
This patch adds the following nesting check for `barrier` constructs:
```
A barrier region may not be closely nested inside a worksharing, loop, task, taskloop, critical, ordered, atomic, or master region.
```
Also adds a test case for the check,
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D99888
Arthur O'Dwyer [Mon, 1 Mar 2021 22:08:24 +0000 (17:08 -0500)]
[libc++] [P1518R2] Better CTAD behavior for containers with allocators.
P1518 does the following in C++23 but we'll just do it in C++17 as well:
- Stop requiring `Alloc` to be an allocator on some container-adaptor deduction guides
- Stop deducing from `Allocator` on some sequence container constructors
- Stop deducing from `Allocator` on some other container constructors (libc++ already did this)
The affected constructors are the "allocator-extended" versions of
constructors where the non-allocator arguments are already sufficient
to deduce the allocator type. For example,
std::pmr::vector<int> v1;
std::vector v2(v1, std::pmr::new_delete_resource());
std::stack s2(v1, std::pmr::new_delete_resource());
Differential Revision: https://reviews.llvm.org/D97742
Felix Berger [Mon, 24 May 2021 13:45:24 +0000 (09:45 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Directly examine the initializing var's initializer.
This fixes false positive cases where a reference is initialized outside of a
block statement and then its initializing variable is modified. Another case is
when the looped over container is modified.
Differential Revision: https://reviews.llvm.org/D103021
Reviewed-by: ymandel
Craig Topper [Fri, 18 Jun 2021 19:10:17 +0000 (12:10 -0700)]
[RISCV] Teach vsetvli insertion to remember when predecessors have same AVL and SEW/LMUL ratio if their VTYPEs otherwise mismatch.
Previously we went directly to unknown state on VTYPE mismatch.
If we instead remember the partial match, we can use this to
still use X0, X0 vsetvli in successors if AVL and needed SEW/LMUL
ratio match.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D104069
Hongtao Yu [Fri, 18 Jun 2021 01:15:45 +0000 (18:15 -0700)]
[CSSPGO][llvm-profgen] Ignore LBR records after interrupt transition
If we have seen an inwards transition from external code to internal code, but not a following outwards transition, the inwards transition is likely due to interrupt which is usually unpaired. Ignore current and subsequent entries since they are likely from an unrelated pre-interrupt context.
LBR records from different interrupt context are unrelated and they should not be mixed together. Currenlty the OS does this for task-scheduling interrupt but not for all interrupts.
Reviewed By: wenlei, wlei
Differential Revision: https://reviews.llvm.org/D104276
Anshil Gandhi [Fri, 18 Jun 2021 19:04:12 +0000 (13:04 -0600)]
[AMDGPU] [CodeGen] Fold negate llvm.amdgcn.class into test mask
Implemented the transformation of xor (llvm.amdgcn.class x, mask), -1 into
llvm.amdgcn.class(x, ~mask). Added LIT tests as well.
Differential Revision: https://reviews.llvm.org/D104049
Hongtao Yu [Wed, 16 Jun 2021 18:51:39 +0000 (11:51 -0700)]
[CSSPGO] Fix an invalid hash table reference issue in the CS preinliner.
We were using a `StringMap` object to store all profiles to be emitted. The object is basically an unordered hash table, therefore updating it in the process of trasvering it may cause issue since the underlying bucket array could change.
I'm also moving the `csspgo-preinliner` switch around so that no context tri will be constructed (by the constructor of `CSPreInliner`) when the switch is off.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D104267
Andrew Browne [Thu, 17 Jun 2021 21:52:09 +0000 (14:52 -0700)]
[DFSan] Cleanup code for platforms other than Linux x86_64.
These other platforms are unsupported and untested.
They could be re-added later based on MSan code.
Reviewed By: gbalats, stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D104481
Krzysztof Parzyszek [Fri, 18 Jun 2021 18:16:45 +0000 (13:16 -0500)]
Revert "Delay initialization of OptBisect"
This reverts commit
ec91df8d8195b8b759a89734dba227da1eaa729f.
It was committed by accident.
Krzysztof Parzyszek [Fri, 18 Jun 2021 18:13:09 +0000 (13:13 -0500)]
XFAIL a testcase on Hexagon (missing-abstract-variable.ll)
This seems to be a common problem among several architectures.
Krzysztof Parzyszek [Fri, 18 Jun 2021 17:24:03 +0000 (12:24 -0500)]
Delay initialization of OptBisect
When LLVM is used in other projects, it may happen that global cons-
tructors will execute before the call to ParseCommandLineOptions.
Since OptBisect is initialized via a constructor, and has no ability
to be updated at a later time, passing "-opt-bisect-limit" to the
parse function may have no effect.
To avoid this problem use a cl::cb (callback) to set the bisection
limit when the option is actually processed.
Differential Revision: https://reviews.llvm.org/D104551
Asher Mancinelli [Fri, 18 Jun 2021 17:52:59 +0000 (11:52 -0600)]
[OpenMP] Update FAQ for enabling cuda offloading
Add an FAQ entry and add a few lines to an existing one. Document
the use of `GCC_INSTALL_PREFIX` for pointing clang to correct
GCC installation for two-stage build.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D104474
Florian Mayer [Fri, 18 Jun 2021 11:55:40 +0000 (12:55 +0100)]
[hwasan] Clarify report for allocation-tail-overwritten.
Explain what the given stack trace means before showing it, rather than
only in the paragraph at the end.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104523
Leonard Chan [Wed, 16 Jun 2021 17:24:51 +0000 (10:24 -0700)]
[compiler-rt][hwasan] Move Thread::Init into hwasan_linux.cpp
This allows for other implementations to define their own version of `Thread::Init`.
This will be the case for Fuchsia where much of the thread initialization can be
broken up between different thread hooks (`__sanitizer_before_thread_create_hook`,
`__sanitizer_thread_create_hook`, `__sanitizer_thread_start_hook`). Namely, setting
up the heap ring buffer and stack info and can be setup before thread creation.
The stack ring buffer can also be setup before thread creation, but storing it into
`__hwasan_tls` can only be done on the thread start hook since it's only then we
can access `__hwasan_tls` for that thread correctly.
Differential Revision: https://reviews.llvm.org/D104248
peter klausler [Thu, 17 Jun 2021 20:13:19 +0000 (13:13 -0700)]
[flang] Runtime implementation for default derived type formatted I/O
This is *not* user-defined derived type I/O, but rather Fortran's
built-in capabilities for using derived type data in I/O lists
and NAMELIST groups.
This feature depends on having the derived type description tables
that are created by Semantics available, passed through compilation
as initialized static objects to which pointers can be targeted
in the descriptors of I/O list items and NAMELIST groups.
NAMELIST processing now handles component references on input
(e.g., "&GROUP x%component = 123 /").
The C++ perspectives of the derived type information records
were transformed into proper classes when it was necessary to add
member functions to them.
The code in Semantics that generates derived type information
was changed to emit derived type components in component order,
not alphabetic order.
Differential Revision: https://reviews.llvm.org/D104485
Walter Erquinigo [Fri, 18 Jun 2021 17:10:57 +0000 (10:10 -0700)]
[lldb-vscode] attempt to fix flakiness
There are many tests failing intermittently for lldb-vscode after
https://reviews.llvm.org/rGaa4685c0fb3aab5acb90be5fd3eb5ba8bf1e3211. I'm
unsure if this actually the culprit, so I'm softly removing that feature
to see if that fixes the issue.
Nico Weber [Fri, 18 Jun 2021 15:47:49 +0000 (11:47 -0400)]
[lld/mac] Support -data_in_code_info, -function_starts flags
These are on by default, but there's also an explicit flag for them.
Differential Revision: https://reviews.llvm.org/D104543
Greg McGary [Fri, 18 Jun 2021 16:38:50 +0000 (09:38 -0700)]
Rename option -icf MODE to --icf=MODE
The `icf` command-line option is not present in ld64, so it should use the LLD option syntax, which begins with double dashes and separates primary option from any suboption with the equal sign.
Differential Revision: https://reviews.llvm.org/D104548
Jingu Kang [Mon, 14 Jun 2021 15:42:00 +0000 (16:42 +0100)]
[AArch64] Add TableGen patterns to generate uaddlv
uaddv(uaddlp(x)) ==> uaddlv(x)
addp(uaddlp(x)) ==> uaddlv(x)
Differential Revision: https://reviews.llvm.org/D104236
Vyacheslav Zakharin [Fri, 18 Jun 2021 15:54:10 +0000 (08:54 -0700)]
[NFC][libomptarget] Build elf_common with PIC.
Differential Revision: https://reviews.llvm.org/D104545
Vyacheslav Zakharin [Fri, 18 Jun 2021 14:17:23 +0000 (07:17 -0700)]
[NFC][libomptarget] Fixed -DLLVM_ENABLE_RUNTIMES="openmp" build.
Differential Revision: https://reviews.llvm.org/D104535
Muhammad Omair Javaid [Fri, 18 Jun 2021 15:19:38 +0000 (15:19 +0000)]
Fix build failure on 32 bit Arm
This patch fixes build failure caused by commit
f27e4548fc42876f66dac260ca3b6df0d5fd5fd6 on 32 bit arm.
Differential Revision: https://reviews.llvm.org/D103292
Saleem Abdulrasool [Fri, 18 Jun 2021 15:19:16 +0000 (08:19 -0700)]
RISCV: simplify a test case for RISCV (NFCI)
The output of the object file is unimportant and entirely discarded.
Simply redirect the output to `/dev/null` or `NUL` as the case may be.
Additionally, the space between the labels is unimportant. There is no
need to add space between the labels. Two labels at the same address
are sufficient to generate the difference expression and should still
test the same behaviour.
Matt Morehouse [Fri, 18 Jun 2021 15:10:41 +0000 (08:10 -0700)]
[HWASan] Run LAM tests with -hwasan-generate-tags-with-calls.
The default callback instrumentation in x86 LAM mode uses ASLR bits
to randomly choose a tag, and thus has a 1/64 chance of choosing a
stack tag of 0, causing stack tests to fail intermittently. By using
__hwasan_generate_tag to pick tags, we guarantee non-zero tags and
eliminate the test flakiness.
aarch64 doesn't seem to have this problem using thread-local addresses
to pick tags, so perhaps we can remove this workaround once we implement
a similar mechanism for LAM.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104470
Matheus Izvekov [Fri, 19 Mar 2021 02:32:06 +0000 (03:32 +0100)]
[clang] Implement P2266 Simpler implicit move
This Implements [[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html|P2266 Simpler implicit move]].
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D99005
Sean Silva [Thu, 17 Jun 2021 21:33:59 +0000 (14:33 -0700)]
[mlir] Add notes about using external interface application.
Differential Revision: https://reviews.llvm.org/D104489
Simon Pilgrim [Fri, 18 Jun 2021 13:58:47 +0000 (14:58 +0100)]
[DAG] SelectionDAG::computeKnownBits - use APInt::insertBits to merge subvector knownbits. NFCI.
As noticed on D104472 we can use APInt::insertBits which will avoid a lot of temporary APInt creations
Tomasz Kamiński [Fri, 18 Jun 2021 11:20:17 +0000 (14:20 +0300)]
[analyzer] Handle NTTP invocation in CallContext.getCalleeDecl()
This fixes a crash in MallocChecker for the situation when operator new (delete) is invoked via NTTP and makes the behavior of CallContext.getCalleeDecl(Expr) identical to CallEvent.getDecl().
Reviewed By: vsavchenko
Differential Revision: https://reviews.llvm.org/D103025
Simon Tatham [Fri, 18 Jun 2021 12:43:13 +0000 (13:43 +0100)]
[libclang] Fix error handler in translateSourceLocation.
Given an invalid SourceLocation, translateSourceLocation will call
clang_getNullLocation, and then do nothing with the result. But
clang_getNullLocation has no side effects: it just constructs and
returns a null CXSourceLocation value.
Surely the intention was to //return// that null CXSourceLocation to
the caller, instead of throwing it away and pressing on anyway.
Reviewed By: miyuki
Differential Revision: https://reviews.llvm.org/D104442
Lang Hames [Fri, 18 Jun 2021 12:12:39 +0000 (22:12 +1000)]
[ORC][C-bindings] Re-order object transform function arguments.
ObjInOut is an in-out parameter not a return value argument, so by convention
it should come after the context value (Ctx).
Lang Hames [Fri, 18 Jun 2021 11:42:43 +0000 (21:42 +1000)]
[ORC] Use uint8_t rather than char for RPC wrapper-function calls.
This partially reverts
838490de7ed, which broke some Solaris bots. Apparently
Solaris defines int8_t as char rather than signed char, which made the
SerializationTypeName<char> specialization a redefinition.
This partial revert isolates use of uint8_t buffers to ORC-RPC handling of
wrapper functions only. The TargetProcessControl::runWrapper method will
continue to use char buffers.
Matheus Izvekov [Mon, 7 Jun 2021 23:38:13 +0000 (01:38 +0200)]
[clang] Exclude function pointers on DefaultedComparisonAnalyzer
This implements a more comprehensive fix than was done at D95409.
Instead of excluding just function pointer subobjects, we also
exclude any user-defined function pointer conversion operators.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D103855
Lang Hames [Fri, 18 Jun 2021 09:48:20 +0000 (19:48 +1000)]
[ORC] Add support for dumping objects to the C API.
Provides ObjectTransformLayer APIs, a getter to access the
ObjectTransformLayer member of LLJIT, and the DumpObjects utility
to make construction of a dump-to-disk transform easy.
An example showing how the new APIs can be used has been added in
llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects.
Liqiang Tao [Fri, 18 Jun 2021 10:52:00 +0000 (18:52 +0800)]
Revert D104028 "[llvm][Inliner] Add an optional PriorityInlineOrder"
Max Kazantsev [Fri, 18 Jun 2021 10:30:36 +0000 (17:30 +0700)]
[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration (try 3)
This patch handles one particular case of one-iteration loops for which SCEV
cannot straightforwardly prove BECount = 1. The idea of the optimization is to
symbolically execute conditional branches on the 1st iteration, moving in topoligical
order, and only visiting blocks that may be reached on the first iteration. If we find out
that we never reach header via the latch, then the backedge can be broken.
This implementation uses InstSimplify. SCEV version was rejected due to high
compile time impact.
Differential Revision: https://reviews.llvm.org/D102615
Reviewed By: nikic
Uday Bondhugula [Fri, 18 Jun 2021 05:31:46 +0000 (11:01 +0530)]
[MLIR] Introduce scf.execute_region op
Introduce the execute_region op that is able to hold a region which it
executes exactly once. The op encapsulates a CFG within itself while
isolating it from the surrounding control flow. Proposal discussed here:
https://llvm.discourse.group/t/introduce-std-inlined-call-op-proposal/282
execute_region enables one to inline a function without lowering out all
other higher level control flow constructs (affine.for/if, scf.for/if)
to the flat list of blocks / CFG form. It thus allows the benefit of
transforms on higher level control flow ops available in the presence of
the inlined calls. The inlined calls continue to benefit from
propagation of SSA values across their top boundary. Functions won’t
have to remain outlined until later than desired. Abstractions like
affine execute_regions, lambdas with implicit captures could be lowered
to this without first lowering out structured loops/ifs or outlining.
But two potential early use cases are of: (1) an early inliner (which
can inline functions by introducing execute_region ops), (2) lowering of
an affine.execute_region, which cleanly maps to an scf.execute_region
when going from the affine dialect to the scf dialect.
Differential Revision: https://reviews.llvm.org/D75837
Haojian Wu [Fri, 18 Jun 2021 09:48:33 +0000 (11:48 +0200)]
[Attributor] Fix UB behavior on uninitalized bool variables.
Found by ASAN.
Jay Foad [Fri, 18 Jun 2021 09:48:56 +0000 (10:48 +0100)]
[AMDGPU] Update generated checks. NFC.
Daniil Seredkin [Wed, 2 Jun 2021 04:55:38 +0000 (11:55 +0700)]
[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)
InstCombine didn't perform (sext bool X) * (sext bool X) --> zext (and X, X) which can result in just (zext X). The patch adds regression tests to check this transformation and adds a check for equality of mul's operands for that case.
Differential Revision: https://reviews.llvm.org/D104193
Max Kazantsev [Fri, 18 Jun 2021 09:25:09 +0000 (16:25 +0700)]
[Test] Add XFAIL unit test for PR50765
Diana Picus [Fri, 18 Jun 2021 09:04:01 +0000 (09:04 +0000)]
[flang] Rewrite test for CPU_TIME
Don't rely on volatile writes to keep the CPU busy - it seems MSVC
optimizes them out, so we don't get different values for 'start' and
'end' on Windows. Rewrite the test to loop until we get a different
value for 'end'.
Fix suggested by Michael Kruse in
https://reviews.llvm.org/rG57e85622bbdb2eb18cc03df2ea457019c58f6912#inline-6002
Committing to fix the Windows buildbot, post-commit comments welcome!
Liqiang Tao [Fri, 18 Jun 2021 08:55:18 +0000 (16:55 +0800)]
[llvm][Inliner] Add an optional PriorityInlineOrder
This patch adds an optional PriorityInlineOrder, which uses the heap to order inlining.
The callsite which size is smaller would have a higher priority.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D104028
Max Kazantsev [Fri, 18 Jun 2021 08:49:56 +0000 (15:49 +0700)]
[NFC] Assert non-zero factor before division
This is to ensure that zero denominator leads to controlled
assertion failure rather than UB.
Matthias Springer [Fri, 18 Jun 2021 08:34:30 +0000 (17:34 +0900)]
[mlir][linalg] Fix PadTensorOp constructor
Differential Revision: https://reviews.llvm.org/D104510
patacca [Fri, 18 Jun 2021 07:53:01 +0000 (09:53 +0200)]
[Polly][Isl] Refactoring IslAstInfo::getBuild() and IslAstInfo::IslAstUserPayload::Build to use isl++. NFC
Polly uses algorithms from the Integer Set Library (isl), which is a library written in C and which is incompatible with the rest of the LLVM as it is written in C++.
Changes made:
- Refactoring the method `IslAstInfo::getBuild()`
- `IslAstInfo::IslAstUserPayload.Build` now uses C++ types instead of C types
- Removing destructor of `IslAstInfo::IslAstUserPayload`
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D104370
Haojian Wu [Fri, 18 Jun 2021 07:18:03 +0000 (09:18 +0200)]
[Attributor] Don't print the call-graph in a hard-coded file.
This looks like not a practical pattern in our codebase (it could fail
in some sandbox environement).
Instead we print it via standard output, and it is controled by the
-attributor-print-call-graph, this follows a similiar pattern of attributor-print-dep.
Siva Chandra Reddy [Fri, 18 Jun 2021 07:23:15 +0000 (07:23 +0000)]
[libc][Obvious] Add the new header file PlatformDefs.h to the fputil target.
Tomasz Miąsko [Fri, 18 Jun 2021 07:27:50 +0000 (09:27 +0200)]
[Demangle][Rust] Parse dot suffix
Allow mangled names to include an arbitrary dot suffix, akin to vendor
specific suffix in Itanium mangling.
Primary motivation is a support for symbols renamed during ThinLTO
import / promotion (ThinLTO is the default configuration for optimized
builds in rustc).
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D104358
Daniil Seredkin [Fri, 18 Jun 2021 07:19:52 +0000 (14:19 +0700)]
Revert "[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)"
This reverts commit
31053338c97b36ffb582f9c04a74cec69cce3e70.
Siva Chandra Reddy [Fri, 18 Jun 2021 06:59:55 +0000 (06:59 +0000)]
[libc] Add few macro definitions to make it easy to accommodate Windows.
The new macro definitions have been used to add Windows specific
specializations.
Daniil Seredkin [Wed, 2 Jun 2021 04:55:38 +0000 (11:55 +0700)]
[InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)
InstCombine didn't perform (sext bool X) * (sext bool X) --> zext (and X, X) which can result in just (zext X). The patch adds regression tests to check this transformation and adds a check for equality of mul's operands for that case.
Differential Revision: https://reviews.llvm.org/D104193
Bjorn Pettersson [Fri, 18 Jun 2021 06:58:44 +0000 (08:58 +0200)]
[polly][GPGPU] Fixup related to overloading exponent type in llvm.powi
Commit
4c7f820b2b206bb changed the llvm.powi intrinsic to support
different 'int' sizes for the exponent. That happened to break
the IntrinsicToLibdeviceFunc mapping in PPCGCodeGeneration, which
obviously should have been updated as part of commit
4c7f820b2b
(https://reviews.llvm.org/D99439).
The shortcoming was found by buildbots that use
-DPOLLY_ENABLE_GPGPU_CODEGEN=ON
This patch should fixup the problem.
Fangrui Song [Fri, 18 Jun 2021 06:38:17 +0000 (23:38 -0700)]
Revert D103717 "[InstrProfiling] Make __profd_ unconditionally private for ELF"
This reverts commit
76d0747e0807307780ba84cbd7e5c80b20c26bd7.
If a group has `__llvm_prf_vals` due to static value profiler counters
(`NS!=0`), we cannot make `__llvm_prf_data` private, because a prevailing text
section may reference `__llvm_prf_data` and will cause a `relocation refers to a
discarded section` linker error.
Note: while a `__profc_` group is non-prevailing, it may be referenced by a
prevailing text section due to inlining.
```
group section [ 66] `.group' [__profc__ZN5clang20EmitClangDeclContextERN4llvm12RecordKeeperERNS0_11raw_ostreamE] contains 4 sections:
[Index] Name
[ 67] __llvm_prf_cnts
[ 68] __llvm_prf_vals
[ 69] __llvm_prf_data
[ 70] .rela__llvm_prf_data
```
Johannes Doerfert [Sun, 16 May 2021 05:12:08 +0000 (00:12 -0500)]
[Attributor][FIX] Arguments of unknown functions can be undef
This should fix PR50683. The wrong assumption was that we
could always know what the callee is when we replace a call site
argument with undef. We wanted to know that to remove the `noundef`
that might be attached to the argument. Since no callee means we
did the propagation on the caller site, there is no need to remove
an attribute. It is only needed if we replace all uses and therefore
pass `undef` instead of the value that was passed in otherwise.
Johannes Doerfert [Fri, 18 Jun 2021 00:01:22 +0000 (19:01 -0500)]
[Attributor] Allow to skip the initial update for a new AA
Users might want to run initialize for a set of AAs without an
intermediate update step. Running update eagerly is not a requirement
anyway so we make it optional.
Johannes Doerfert [Thu, 17 Jun 2021 18:04:26 +0000 (13:04 -0500)]
[Attributor] Use a centralized value simplification interface
To allow outside AAs that simplify values we need to ensure all value
simplification goes through the Attributor, not AAValueSimplify (or any
of the other AAs we have already like AAPotentialValues). This patch
also introduces an interface for the outside AAs to register
simplification callbacks for an IRPosition. To make this work as
expected we have to pass IRPositions instead of Values in
AAValueSimplify, which makes sense by itself.
Johannes Doerfert [Mon, 10 May 2021 01:02:18 +0000 (20:02 -0500)]
[Attributor] Introduce a helper do deal with constant type mismatches
If we simplify values we sometimes end up with type mismatches. If the
value is a constant we can often cast it though to still allow
propagation. The logic is now put into a helper and it replaces some
ad hoc things we did before.
This also introduces the AA namespace for abstract attribute related
functions and types.
Differential Revision: https://reviews.llvm.org/D103856
Johannes Doerfert [Thu, 17 Jun 2021 16:11:16 +0000 (11:11 -0500)]
[Attributor] Make sure Heap2Stack works properly on a GPU target
If the target stack is not accessible between different running
"threads" we have to make sure not to create allocas for mallocs
that might be used by multiple "threads". The "use check" is
sufficient to prevent this but if we apply the "free check" we have
to make sure the pointer is not communicated to others before
the free is reached.
Differential Revision: https://reviews.llvm.org/D98608
Johannes Doerfert [Wed, 12 May 2021 03:13:40 +0000 (22:13 -0500)]
[OpenMP][NFC] Expose AAExecutionDomain and rename its getter
The initial use for AAExecutionDomain was to determine if a single
thread executes a block. While this is sometimes informative most
of the time, and for other reasons, we actually want to know if it
is the "initial thread". Thus, the thread that started execution on
the current device. The deduction needs to be adjusted in a follow
up as the methods we use right not are looking for the OpenMP thread
id which is resets whenever a thread enters a parallel region. What
we basically want is to look for `llvm.nvvm.read.ptx.sreg.ntid.x` and
equivalent functions.
Johannes Doerfert [Thu, 10 Jun 2021 22:21:15 +0000 (17:21 -0500)]
[Attributor][NFC] Add test from PR49606
It is not clear to me how we fixed this, I reverted a few candidates but
I couldn't make the test fail. Still worth having it in our regression
suite.
Johannes Doerfert [Tue, 8 Jun 2021 00:11:41 +0000 (19:11 -0500)]
[Attributor][NFC] Precommit a set of test cases for load simplification
Johannes Doerfert [Thu, 6 May 2021 21:42:01 +0000 (16:42 -0500)]
[Attributor][NFC] AAReachability is currently stateless, don't invalidate it
We invalidated AAReachabilityImpl directly which is not helpful and
confusing as we still used it regardless. We now avoid invalidating it
(not needed anyway) and add checks for the state. This has by itself no
actual effect but prepares for later extensions.
George Balatsouras [Thu, 17 Jun 2021 21:55:05 +0000 (14:55 -0700)]
[dfsan] Replace dfs$ prefix with .dfsan suffix
The current naming scheme adds the `dfs$` prefix to all
DFSan-instrumented functions. This breaks mangling and prevents stack
trace printers and other tools from automatically demangling function
names.
This new naming scheme is mangling-compatible, with the `.dfsan`
suffix being a vendor-specific suffix:
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-structure
With this fix, demangling utils would work out-of-the-box.
Reviewed By: stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D104494