Commit Graph

428056 Commits

Author SHA1 Message Date
Philip Reames 4710e78974 [RISCV] Implement RISCVTTIImpl::getMaxVScale correctly
The comments in the existing code appear to pre-exist the standardization of the +v extension. In particular, the specification *does* provide a bound on the maximum value VLEN can take. From what I can tell, the LMUL comment was simply a misunderstanding of what this API returns.

This API returns the maximum value that vscale can take at runtime. This is used in the vectorizer to bound the largest scalable VF (e.g. LMUL in RISCV terms) which can be used without violating memory dependence.

Differential Revision: https://reviews.llvm.org/D128538
2022-06-24 16:51:53 -07:00
Kirill Okhotnikov 27aca975b6 [libc][math] Fix broken compilation due to __builtin_inf/nan functions. 2022-06-25 01:39:32 +02:00
Min-Yih Hsu 87805d6a24 [MCA] Hot fix for -Wmismatched-tags errors on mca::SourceMgr
Hot fix for -Wmismatched-tags build errors regarding mca::SourceMgr
changes introduced in 97579dcc6d.
2022-06-24 16:14:18 -07:00
Min-Yih Hsu b847692ed8 [MCA] Allow mca::Instruction-s to be recycled and reused
This patch introduces a new feature that allows InstrBuilder to reuse
mca::Instruction recycled from IncrementalSourceMgr. This significantly
reduces the memory footprint.
Note that we're only recycling instructions that have static InstrDesc
and no variadic operands.

Differential Revision: https://reviews.llvm.org/D127084
2022-06-24 15:39:51 -07:00
Min-Yih Hsu 97579dcc6d [MCA] Introducing incremental SourceMgr and resumable pipeline
The new resumable mca::Pipeline capability introduced in this patch
allows users to save the current state of pipeline and resume from the
very checkpoint.
It is better (but not require) to use with the new IncrementalSourceMgr,
where users can add mca::Instruction incrementally rather than having a
fixed number of instructions ahead-of-time.

Note that we're using unit tests to test these new features. Because
integrating them into the `llvm-mca` tool will make too many churns.

Differential Revision: https://reviews.llvm.org/D127083
2022-06-24 15:39:51 -07:00
Petr Hosek 048e6bb46b [CMake][compiler-rt] Treat target cflags as list rather than string
This is need after 30dfe016d4.

Differential Revision: https://reviews.llvm.org/D128548
2022-06-24 22:37:00 +00:00
Wei Yi Tee 0f65a3e610 [clang][dataflow] Implement functionality to compare if two boolean values are equivalent.
`equivalentBoolValues` compares equivalence between two booleans. The current implementation does not consider constraints imposed by flow conditions on the booleans and its subvalues.

Depends On D128520

Reviewed By: gribozavr2, xazax.hun

Differential Revision: https://reviews.llvm.org/D128521
2022-06-25 00:10:35 +02:00
Wei Yi Tee 42a7ddb428 [clang][dataflow] Refactor function that queries the solver for satisfiability checking.
Given a set of `Constraints`, `querySolver` adds common background information across queries (`TrueVal` is always true and `FalseVal` is always false) and passes the query to the solver.

`checkUnsatisfiable` is a simple wrapper around `querySolver` for checking that the solver returns an unsatisfiable result.

Depends On D128519

Reviewed By: gribozavr2, xazax.hun

Differential Revision: https://reviews.llvm.org/D128520
2022-06-25 00:05:43 +02:00
Kirill Okhotnikov 349fee08d5 [libc][math] Fix broken aarch64 due to clz refactoring. 2022-06-24 23:59:26 +02:00
Mitch Phillips 243fc3daf6 fix-forward hwasan-globals.cpp (round 2)
Just force the aarch64 target compilation (after making sure the test
only runs if that target is available).

Because global metadata isn't target-specific, just selecting a target
here is fine.

Should fix https://reviews.llvm.org/D127544#3609312
2022-06-24 14:49:37 -07:00
Mitch Phillips fadc98b06b Don't run hwasan-globals.cpp test on non-x86/aarch64
Fix-forward for https://reviews.llvm.org/D127544#3609312

IR pass has some target-specific inline asm lowering that check-fails
for non-x86 non-aarch64 targets.

For now, just run these tests only on those targets.
2022-06-24 14:33:41 -07:00
Xing Xue 60f7bdfd03 [libc++][AIX] Make basic_string layout compatible with earlier version
Summary:
Patch D123580 changed to use bit fields for strings in long and short mode. As a result, this changes the layout of these strings on AIX because bit fields on AIX are 4 bytes, which breaks the ABI compatibility with earlier strings before the change on AIX. This patch uses the attribute 'packed' and anonymous structure to make string layout compatible. This patch will also make test cases alignof.compile.pass.cpp and sizeof.compile.pass.cpp introduced in D127672 pass on AIX.

Reviewed by: philnik, Mordante, hubert.reinterpretcast, libc++

Differential Revision: https://reviews.llvm.org/D128285
2022-06-24 17:25:15 -04:00
Wei Yi Tee 00e9d53453 [clang][dataflow] Move logic for creating implication and iff expressions into `DataflowAnalysisContext` from `DataflowEnvironment`.
To keep functionality of creating boolean expressions in a consistent location.

Depends On D128357

Reviewed By: gribozavr2, sgatev, xazax.hun

Differential Revision: https://reviews.llvm.org/D128519
2022-06-24 23:16:44 +02:00
Kirill Okhotnikov b8e8012aa2 [libc][math] fmod/fmodf implementation.
This is a implementation of find remainder fmod function from standard libm.
The underline algorithm is developed by myself, but probably it was first
invented before.
Some features of the implementation:
1. The code is written on more-or-less modern C++.
2. One general implementation for both float and double precision numbers.
3. Spitted platform/architecture dependent and independent code and tests.
4. Tests covers 100% of the code for both float and double numbers. Tests cases with NaN/Inf etc is copied from glibc.
5. The new implementation in general 2-4 times faster for “regular” x,y values. It can be 20 times faster for x/y huge value, but can also be 2 times slower for double denormalized range (according to perf tests provided).
6. Two different implementation of division loop are provided. In some platforms division can be very time consuming operation. Depend on platform it can be 3-10 times slower than multiplication.

Performance tests:

The test is based on core-math project (https://gitlab.inria.fr/core-math/core-math). By Tue Ly suggestion I took hypot function and use it as template for fmod. Preserving all test cases.

`./check.sh <--special|--worst> fmodf` passed.
`CORE_MATH_PERF_MODE=rdtsc ./perf.sh fmodf` results are

```
GNU libc version: 2.35
GNU libc release: stable
21.166 <-- FPU
51.031 <-- current glibc
37.659 <-- this fmod version.
```
2022-06-24 23:09:14 +02:00
Fangrui Song 5c29ffda90 Revert "[Driver][test] Replace ^//$ with empty string"
This reverts commit 4817b7729a.

It caused some `^/\n` and had some objection about its readability improvement.
2022-06-24 13:52:27 -07:00
Philip Reames a0443dd47c [RISCV] Simplify 16 bit index handling in lowerVECTOR_REVERSE [nfc]
getRealMaxVLen returns an upper bound on the value of VLEN.  We can use this upper bound (which unless explicitly set at command line is going to result in a e8 MaxVLMax of much greater than 256) instead of explicitly handling the unknown case separately from the bounded by number greater than 256 case.

Note as well that this code already implicitly depends on a capped value for VLEN.  If infinite VLEN were possible, than 16 bit indices wouldn't be enough.
2022-06-24 13:08:39 -07:00
Philip Reames f1e1c3ce77 [RISCV] Replace two calls to getMinRVVVectorSizeInBits in fixed length lowering [nfc]
Both of these are only reached if useRVVForFixedLengthVectors is true.  Given that, we know that getRealMinVLen() == getMinRVVVectorSizeInBits().
2022-06-24 13:00:57 -07:00
Wei Yi Tee fb88ea6260 [clang][dataflow] Store flow condition constraints in a single `FlowConditionConstraints` map.
A flow condition is represented with an atomic boolean token, and it is bound to a set of constraints: `(FC <=> C1 ^ C2 ^ ...)`. \
This was internally represented as `(FC v !C1 v !C2 v ...) ^ (C1 v !FC) ^ (C2 v !FC) ^ ...` and tracked by 2 maps:
- `FlowConditionFirstConjunct` stores the first conjunct `(FC v !C1 v !C2 v ...)`
- `FlowConditionRemainingConjuncts` stores the remaining conjuncts `(C1 v !FC) ^ (C2 v !FC) ^ ...`

This patch simplifies the tracking of the constraints by using a single `FlowConditionConstraints` map which stores `(C1 ^ C2 ^ ...)`, eliminating the use of two maps.

Reviewed By: gribozavr2, sgatev, xazax.hun

Differential Revision: https://reviews.llvm.org/D128357
2022-06-24 21:52:16 +02:00
Alexander Yermolovich 11a8dd65ec [BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pc
DWARF 5 added two new attributes DW_AT_call_pc and DW_AT_call_return_pc.
Adding support for them.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D128526
2022-06-24 12:37:58 -07:00
Thomas Raoux d343cdd509 [mlir][vector] Fix bug when swapping scf.for and vector warp op
When creating a scf.for without argument a scf.yield is automatically
created. Make sure we don't create a second one.

Differential Revision: https://reviews.llvm.org/D128405
2022-06-24 19:13:02 +00:00
Philip Reames f1b1bcdbd4 [RISCV] Replace two calls to getMinRVVVectorSizeInBits with getRealMinVLen [nfc]
This doesn't change behavior, it just makes it slightly more obvious what's
going on.  Note that getRealMinVLen is always >= getMinRVVVectorSizeInBits.

The first case is a bit tricky, as you have to know that
getMinRVVVectorSizeInBits returns 0 when not set, and thus is equivalent
to the else value clause.  The new code structure makes it more obvious we
return 0 unless using RVV for fixed length vectors.
2022-06-24 12:07:33 -07:00
Valentin Clement d7ab38f8f4
[flang][OpenACC] Lower parallel loop
Lower the `parallel loop` contrsuct and refactor some of the code
of parallel and loop lowering to be reused.

Also add tests for loop and parallel since they were not upstreamed.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128510
2022-06-24 21:06:21 +02:00
Valentin Clement 56c81d2554
[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types
In merge FSOURCE and TSOURCE must have the same Fortran dynamic types,
but this does not imply that FSOURCE and TSOURCE will be lowered to the
same MLIR types. For instance, TSOURCE may be a character expression
with a compile type constant length (!fir.char<1,4>) while FSOURCE may
have dynamic length (!fir.char<1,?>).

Cast FSOURCE to TSOURCE MLIR types to handle these cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128507

Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-06-24 21:05:15 +02:00
Mitch Phillips faf5e0ec73 Add no_sanitize('hwaddress') (and 'memtag', but that's a no-op).
Currently, `__attribute__((no_sanitize('hwaddress')))` is not possible. Add this piece of plumbing, and now that we properly support copying attributes between an old and a new global variable, add a regression test for the GlobalOpt bug that previously lost the attribute.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D127544
2022-06-24 12:04:11 -07:00
Mitch Phillips f57066401e [HWASan] Use new IR attribute for communicating unsanitized globals.
Globals that shouldn't be sanitized are currently communicated to HWASan
through the use of the llvm.asan.globals IR metadata. Now that we have
an on-GV attribute, use it.

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D127543
2022-06-24 12:04:11 -07:00
Valentin Clement d45d707434
[flang] Explicitly map host associated symbols
Explicitly map host associated symbols in DoConcurrent with shared
locality-spec, clauses in OpenMP/OpenACC. The mapping of host-assoc
symbols is set to their parent SymbolBox. This is achieved through
a new interface function in the AbstractConverter.

This was already upstream for OpenMP.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128518

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2022-06-24 21:03:49 +02:00
Thomas Raoux 7eba5cdf9c [mlir][vector] Relax transfer_write vector distribution pattern
Small change to relax the pattern to support any vector containing a
single element.

Differential Revision: https://reviews.llvm.org/D128545
2022-06-24 19:03:14 +00:00
Valentin Clement 4489ef8e34
[flang] Fix LBOUND with assumed size array and non constant DIM
LBOUND with a non constant DIM argument use the runtime to allow runtime
verification of DIM <= RANK. The interface uses a descriptor. This caused
undefined behavior because the runtime believed it was seeing an explicit
shape arrays with zero extent and returned `1` (the runtime descriptor
does not allow making a difference between an explicit shape and an
assumed size. Assumed size are not meant to be described by runtime
descriptors).

Fix the issue by setting the last extent of assumed size to `1` when
creating the descriptor to inquire about the LBOUND with the runtime.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128509

Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-06-24 21:02:07 +02:00
Philip Reames ae8fac6f98 [LV][RISCV] Add coverage showing scalable codegen when etype != ELEN
We currently have a costing bug around the etype == ELEN case, so add otherwise duplicate tests to show test diffs as I work on other parts of costing.
2022-06-24 11:38:54 -07:00
Venkata Ramanaiah Nalamothu a57b62deef [lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers
The requirements for "thread until <line number>" are:

a) If any code contributed by <line number> or the nearest subsequent of <line number> is executed before leaving the function, stop
b) If you end up leaving the function w/o triggering (a), then stop

In case of (a), since the <line number> may have multiple entries in the line table and the compiler might have scheduled/moved the relevant code across, and the lldb does not know the control flow, set breakpoints on all the line table entries of best match of <line number> i.e. exact or the nearest subsequent line.

Along with the above, currently, CommandObjectThreadUntil is also setting the breakpoints on all the subsequent line numbers after the best match and this latter part is wrong.

This issue is discussed at http://lists.llvm.org/pipermail/lldb-dev/2018-August/013979.html.

In fact, currently `TestStepUntil.py` is not actually testing step until scenarios and `test_missing_one` test fails without this patch if tests are made to run. Fixed the test as well.

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D50304
2022-06-25 00:01:04 +05:30
Fangrui Song 4817b7729a [Driver][test] Replace ^//$ with empty string
The convention does not add //\n. Having all RUN/CHECK lines separated by //\n
makes editor movement difficult (e.g. { } in Vim).
2022-06-24 11:25:03 -07:00
Jonas Devlieghere 87a3293961
[lldb] Move Host::SystemLog out of !defined(_WIN32)
The definition of Host::SystemLog was (unintentionally) guarded by
!defined(_WIN32).
2022-06-24 11:18:31 -07:00
Aart Bik 9a3d60e0d3 [mlir][bufferization][sparse] put restriction on sparse tensor allocation
Putting some direct use restrictions on tensor allocations in the
sparse case enables the use of simplifying assumptions in the
bufferization analysis.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D128463
2022-06-24 10:58:43 -07:00
Jonas Devlieghere 5a08280659
[lldb] Fix flakiness in shell tests that mixed stderr and stdout
Because the diagnostic events are processed by the default event handler
in its own thread, tests cannot rely on output ordering. Split stdout
and stderr to make the test reliable again.
2022-06-24 10:53:15 -07:00
Jonas Devlieghere 1e5d5261e2
[lldb] Add SystemLogHandler for emitting log messages to the system log
Add a system log handler that emits log messages to the operating system
log. In addition to the log handler itself, this patch also introduces a
new Host::SystemLog helper function to abstract over writing to the
system log.

Differential revision: https://reviews.llvm.org/D128321
2022-06-24 10:53:15 -07:00
David Blaikie 4821508d4d Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"
Reverting to simplify some Google-internal rollout issues. Will recommit
in a week or two.

This reverts commit 517bbc64db.
2022-06-24 17:07:47 +00:00
Mingming Liu e0d069598b [Inline] Annotate inline pass name with link phase information for analysis.
The annotation is flag gated; flag is turned off by default.

Differential Revision: https://reviews.llvm.org/D125495
2022-06-24 10:06:43 -07:00
Daniel Douglas d4a7b8de52 [OpenMP][libomp] avoid spin wait and yield on arm64 macOS
This patch changes the default behavior to avoid spin waiting and
yielding. (See “Don’t Keep Threads Active And Idle” section here:
https://developer.apple.com/documentation/apple-silicon/tuning-your-code-s-performance-for-apple-silicon)

We verified using instruments traces that the changes improve scheduling
behavior on macOS.

We also collected results using EPCC schedbench
(https://github.com/LangdalP/EPCC-OpenMP-micro-benchmarks) that are
attached here that show a reduction in standard deviation and max test
run time across all scheduling types. Static scheduling sees dramatic
improvements with these changes, we see a 2-4x average runtime
improvement in the benchmark.

Differential Revision: https://reviews.llvm.org/D126510
2022-06-24 12:02:16 -05:00
Fazlay Rabbi 42bb88e2aa [OpenMP] Initial parsing and sema support for 'masked taskloop' construct
This patch gives basic parsing and semantic support for "masked taskloop"
construct introduced in OpenMP 5.1 (section 2.16.7)

Differential Revision: https://reviews.llvm.org/D128478
2022-06-24 10:00:08 -07:00
Eli Friedman e11bf8de72 [clang codegen] Add dso_local/hidden/etc. markings to VTT declarations
We were marking definitions, but not declarations. Marking declarations
makes computing the address more efficient.

Fixes issue reported at https://discourse.llvm.org/t/63090

Differential Revision: https://reviews.llvm.org/D128482
2022-06-24 09:58:31 -07:00
Akira Hatanaka 5fa4629581 [Sema] Check whether `__auto_type` has been deduced before merging
This fixes a bug in clang where it emits the following diagnostic when
compiling the test case:

"argument to 'sizeof' in 'memset' call is the same pointer type 'S' as
the destination"

The code that merges __auto_type with other types was committed in
https://reviews.llvm.org/D122029.

Differential Revision: https://reviews.llvm.org/D128373
2022-06-24 09:49:07 -07:00
Richard 5e97788a3e [clang-tidy] Update release notes (NFC)
- Sort changes to existing checks by check name
- Correct check link
2022-06-24 10:48:47 -06:00
Jonas Devlieghere 6879391908
[lldb] Replace Host::SystemLog with Debugger::Report{Error,Warning}
As it exists today, Host::SystemLog is used exclusively for error
reporting. With the introduction of diagnostic events, we have a better
way of reporting those. Instead of printing directly to stderr, these
messages now get printed to the debugger's error stream (when using the
default event handler). Alternatively, if someone is listening for these
events, they can decide how to display them, for example in the context
of an IDE such as Xcode.

This change also means we no longer write these messages to the system
log on Darwin. As far as I know, nobody is relying on this, but I think
this is something we could add to the diagnostic event mechanism.

Differential revision: https://reviews.llvm.org/D128480
2022-06-24 09:46:26 -07:00
Alexey Bataev 2faacf61a5 [SLP]Improve shuffles cost estimation where possible.
Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.

Differential Revision: https://reviews.llvm.org/D115462
2022-06-24 09:28:01 -07:00
Joshua Root 146f486ba3 [ObjCopy] Fix type mismatch in writeCodeSignatureData()
The result of pointer subtraction is of type ptrdiff_t, which is not necessarily the same underlying type as ssize_t. This can lead to a compilation error since std::min requires both parameters to be the same type.

Fixes: https://github.com/llvm/llvm-project/issues/54846

Reviewed By: alexander-shaposhnikov, drodriguez, jhenderson

Differential Revision: https://reviews.llvm.org/D128117
2022-06-24 09:14:47 -07:00
Arthur Eubanks e422c0d3b2 [GlobalOpt] Perform store->dominated load forwarding for stored once globals
The initial land incorrectly optimized forwarding non-Constants in non-nosync/norecurse functions. Bail on non-Constants since norecurse should cause global -> alloca promotion anyway.

The initial land also incorrectly assumed that StoredOnceStore was the only store to the global, but it actually means that only one value other than the global initializer is stored. Add a check that there's only one store.

Compile time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=c80b88ee29f34078d2149de94e27600093e6c7c0&to=ef2c2b7772424b6861a75e794f3c31b45167304a&stat=instructions

Reviewed By: nikic, asbirlea, jdoerfert

Differential Revision: https://reviews.llvm.org/D128128
2022-06-24 09:09:26 -07:00
Casey Carter d3cbcc4e89 [libcxx][test] barrier completion functions must be non-throwing
... per N4910 [thread.barrier.class]/5.
2022-06-24 09:06:47 -07:00
Siva Chandra Reddy 300f8da8e8 [libc] Add Uint128 type as a fallback when __uint128_t is not available.
Also, the unused specializations of __int128_t have been removed.

Differential Revision: https://reviews.llvm.org/D128304
2022-06-24 16:03:35 +00:00
Philip Reames 056d63938a [RISCV] Split a vectorizer test runline so that upcoming changes in defaults are visible 2022-06-24 08:48:11 -07:00
Philip Reames adbe718675 [RISCV] Modify a test line so it exercises the intended configuration once we turn on scalable vectorization 2022-06-24 08:48:11 -07:00