Serge Pavlov [Tue, 1 Jun 2021 05:30:17 +0000 (12:30 +0700)]
[PowerPC] Split tests for constrained intrinsics
The test CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll checks code
generation for constrained floating point intrinsics. Many test cases in
it were implemented using operations on constants. Constant folding of
constrained intrinsics would make these test cases almost useless,
because they would check only constant loading.
To keep the tests useful, operations on constants were replaced with
operations on function parameters.
Differential Revision: https://reviews.llvm.org/D103259
Max Kazantsev [Tue, 1 Jun 2021 04:11:15 +0000 (11:11 +0700)]
[Test] Add one more loop deletion irreducible CFG test
Lewuathe [Tue, 1 Jun 2021 03:47:42 +0000 (03:47 +0000)]
Fix invalid math formulas in quantization doc
A single backslash is not properly escaped in the web documentation. We can make sure to escape for rendering subscripts.
Additionally, it also fixed the mal-formed equations in //"Affine to fixed point"// and //"Fixed point to affine"// sections. With this fix, the page is rendered as follows.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D101252
Nathan Chancellor [Tue, 1 Jun 2021 03:11:46 +0000 (20:11 -0700)]
Revert "[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)"
This reverts commit
4f2fd3818b0eb26806f366bc37369349aeedcaf9.
The Linux kernel fails to build after this commit. See
https://reviews.llvm.org/D99481 for a reproducer.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Arthur Eubanks [Mon, 31 May 2021 23:11:03 +0000 (16:11 -0700)]
[OpaquePtr] Remove some uses of PointerType::getElementType()
Albion Fung [Mon, 31 May 2021 20:58:05 +0000 (15:58 -0500)]
[PowerPC] Improve f32 to i32 bitcast code gen
The code gen for f32 to i32 bitcast is not currently the most efficient;
this patch removes some unneccessary instructions gerneated.
Differential revision: https://reviews.llvm.org/D100782
Bjorn Pettersson [Mon, 31 May 2021 20:35:09 +0000 (22:35 +0200)]
[HIP] Relax checks in hip-include-path.hip test case again
The tightened checks from commit
722c39fef5ab6 did not work
fully for buildbots using symlinks in repo paths. This patch
is not fully reverting
722c39fef5ab6, as we still match that
there is a "/lib" somewhere in the path before "/clang/".
So this is once again a bit fragile in case someone would put
their repo in a base directory, for example, named
"/scratch/lib/foo/clang/llvm-project/". But it is atleast a
bit better than the original checks (avoiding the problem that
commit
722c39fef5ab6 was solving).
Congzhe Cao [Mon, 31 May 2021 20:11:04 +0000 (16:11 -0400)]
[LoopInterhcange] Handle movement of reduction phis appropriately
This patch fixes pr43326 and pr48212.
Currently when we move reduction phis to the right place,
loop interchange assumes the first phi in loop headers is
an induction phi, skips the first phi and assumes the rest
of phis are candidate reduction phis to move. However, it
may not always be the case.
This patch loops over all phis in loop headers and considers
a phi node as a candidate reduction phi to move only when it
is indeed a reduction phi across outer and inner loop.
Reviewed By: Whitney
Differential Revision: https://reviews.llvm.org/D102743
Florian Hahn [Mon, 31 May 2021 19:23:43 +0000 (20:23 +0100)]
[LoopDeletion] Add additional test cases with more nested loops.
Also remove mustprogress function attribute from one of the tests
Extends test coverage for D103382.
Martin Storsjö [Mon, 31 May 2021 08:35:01 +0000 (08:35 +0000)]
[libcxx] [test] Fix the include_as_c.sh.cpp test in MSVC configurations
Avoid including a header that is known not to work with clang in MSVC
mode when compiling as C.
(Alternatively, this could be something like "XFAIL: clang && msvc",
but I think it's more useful to actually check the rest of the test
instead of expecting the whole test to fail.)
Differential Revision: https://reviews.llvm.org/D103400
Martin Storsjö [Mon, 31 May 2021 10:01:59 +0000 (10:01 +0000)]
[libcxx] [test] Remove an incorrect TEST_HAS_ALIGNED_ALLOC define from test_macros.h
This was added inconsistently in
19fd9039ca242f408493b5c662f9d908eab8555e; Windows doesn't have the
aligned_alloc function (neither MSVC nor MinGW toolchains) and we don't
define _LIBCPP_HAS_ALIGNED_ALLOC while building libcxx.
Differential Revision: https://reviews.llvm.org/D103399
Martin Storsjö [Mon, 31 May 2021 09:32:51 +0000 (09:32 +0000)]
[libcxx] Define LIBCPP_HAS_TIMESPEC_GET for MSVC configurations
This define was out of sync with the corresponding define in tests, it
was added inconsistently in
171c77b7dad4a050aca23ff7ca1b75f87560fefb.
Modern MSVC environments do have these typedefs and functions.
Differential Revision: https://reviews.llvm.org/D103398
Martin Storsjö [Fri, 28 May 2021 09:55:44 +0000 (09:55 +0000)]
[libcxx] [test] Don't look for the literal spelling __mbstate_t in warnings
While the code uses the type name `std::mbstate_t`, the warning message
mentions the original underlying type, which is a C library internal
type name.
On Windows this type is called `_Mbstatet` instead of `__mbstate_t`. Use
expect-warning-re to avoid spelling out the literal name of the type.
Due to issues with the detection of the clang-verify feature, these
tests have been skipped in the Windows CI configuration so far.
Differential Revision: https://reviews.llvm.org/D103309
Florian Hahn [Mon, 31 May 2021 11:06:28 +0000 (12:06 +0100)]
[LV] Try to sink users recursively for first-order recurrences.
Update isFirstOrderRecurrence to explore all uses of a recurrence phi
and check if we can sink them. If there are multiple users to sink, they
are all mapped to the previous instruction.
Fixes PR44286 (and another PR or two).
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D84951
Andi Drebes [Mon, 31 May 2021 17:14:48 +0000 (22:44 +0530)]
[MLIR] Add dialect prefix to all operations from Math
Prefix all operations from the ODS of the `Math` dialect with `Math_`
in order to avoid name clashes when including `MathOps.td` in other
TableGen files (e.g., for `FloatUnaryOp`, which also exists in
`Standard`).
Reviewed By: jpienaar, mehdi_amini
Differential Revision: https://reviews.llvm.org/D103248
Qiu Chaofan [Mon, 31 May 2021 17:15:49 +0000 (01:15 +0800)]
[PowerPC] Fix x86 vector intrinsics wrapper compilation under C++
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D103386
Nico Weber [Mon, 31 May 2021 17:17:10 +0000 (13:17 -0400)]
[gn build] make libunwind build on macOS
Christopher Di Bella [Fri, 28 May 2021 17:53:54 +0000 (17:53 +0000)]
[libcxx][nfc] moves std `advance`, `next`, and `prev` into their headers
Differential Revision: https://reviews.llvm.org/D103329
Andi Drebes [Mon, 31 May 2021 15:53:32 +0000 (21:23 +0530)]
[MLIR] Specify namespace for standard dialect using cppNamespace field
The `::mlir` namespace for operations from standard is currently
defined by enclosing the header file generated from the ODS in
`Ops.td` in a namespace in `Ops.h`. However, when referencing
operations from `Ops.td` in other TableGen files, this causes the
generated C++ code to refer to classes from the global namespace
instead of `::mlir`.
By defining the namespace through the `cppNamespace` field for
`StandardOps_Dialect` directly in `Ops.td` instead, the ODS
becomes reusable in other TableGen files through simple
inclusion.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D103234
Arthur Eubanks [Thu, 27 May 2021 03:32:04 +0000 (20:32 -0700)]
[OpaquePtr] Clean up some uses of Type::getPointerElementType()
These depend on pointee types.
Abbas Sabra [Mon, 31 May 2021 08:38:17 +0000 (10:38 +0200)]
Re-commit [clang] Add support for the "abstract" contextual keyword of MSVC
https://docs.microsoft.com/en-us/cpp/extensions/abstract-cpp-component-extensions?view=msvc-160
Note: like the already supported "sealed" keyword, the "abstract"
keyword is supported by MSVC by default.
This re-commits
818338add77411f5e9713247ea66142f332ef350 with added
initialization of Parser::Ident_abstract.
Differential revision: https://reviews.llvm.org/D102517
Harald van Dijk [Mon, 31 May 2021 16:36:57 +0000 (12:36 -0400)]
[libc++] [test] Fix a few tests for 32-bit x86
Fixes bug https://llvm.org/PR48939.
Differential Revision: https://reviews.llvm.org/D102359
Arthur Eubanks [Mon, 31 May 2021 16:00:33 +0000 (09:00 -0700)]
[test] Properly match parameter/argument ABI attributes
These were found with D103412.
Andrea Di Biagio [Mon, 31 May 2021 15:39:35 +0000 (16:39 +0100)]
[MCA][NFCI] Minor changes to InstrBuilder and Instruction.
This is based on the assumption that most simulated instructions don't define
more than one or two registers. This is true for example on x86, where
most instruction definitions don't declare more than one register write.
The default code region size has been increased from 8 to 16. This is based on
the assumption that, for small microbenchmarks, the typical code snippet size is
often less than 16 instructions.
mca::Instruction now uses bitfields to pack flags.
No functional change intended.
Arthur Eubanks [Mon, 31 May 2021 16:02:07 +0000 (09:02 -0700)]
[test] Fix addr-label.ll after D99707
Needs REQUIRES.
Louis Dionne [Thu, 27 May 2021 16:56:12 +0000 (12:56 -0400)]
[libc++] Update all the pre-defined iterator types for C++20
Make sure we provide the correct It::difference_type member and update
the tests and synopses to be accurate.
Supersedes D102657 and D103101 (thanks to the original authors).
Differential Revision: https://reviews.llvm.org/D103273
Arthur Eubanks [Thu, 1 Apr 2021 06:12:36 +0000 (23:12 -0700)]
Remove "Rewrite Symbols" from codegen pipeline
It breaks up the function pass manager in the codegen pipeline.
With empty parameters, it looks at the -mllvm flag -rewrite-map-file.
This is likely not in use.
Add a check that we only have one function pass manager in the codegen
pipeline.
Some tests relied on the fact that we had a module pass somewhere in the
codegen pipeline.
addr-label.ll crashes on ARM due to this change. This is because a
ARMConstantPoolConstant containing a BasicBlock to represent a
blockaddress may hold an invalid pointer to a BasicBlock if the
blockaddress is invalidated by its BasicBlock getting removed. In that
case all referencing blockaddresses are RAUW a constant int. Making
ARMConstantPoolConstant::CVal a WeakVH fixes the crash, but I'm not sure
that's the right fix. As a workaround, create a barrier right before
ISel so that IR optimizations can't happen while a
ARMConstantPoolConstant has been created.
Reviewed By: rnk, MaskRay, compnerd
Differential Revision: https://reviews.llvm.org/D99707
Arthur O'Dwyer [Sat, 29 May 2021 17:09:07 +0000 (13:09 -0400)]
[libc++] Avoid `result_type` and `unary/binary_function` in <valarray>.
Give each of the relevant functional operators a `__result_type`
instead, so that we can keep using those typedefs in <valarray>
even when the public binder typedefs are removed in C++20.
Differential Revision: https://reviews.llvm.org/D103371
Anirudh Prasad [Mon, 31 May 2021 15:26:26 +0000 (11:26 -0400)]
[AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 2
- This patch is the second (and hopefully final) part of providing HLASM syntax for inline asm statements for z/OS to LLVM (continuing on from https://reviews.llvm.org/D98276)
- This second part deals with providing label support
- As mentioned in https://reviews.llvm.org/D98276, if the first token is not a space we process the first token as a label, and the remaining tokens as a possible machine instruction
- To achieve this, a new `parseAsHLASMLabel` function is introduced. This function processes the first token, validates whether it is an "acceptable" label according to HLASM standards, and then emits it
- After handling and emitting the label, call the `parseAsMachineInstruction` instruction to process the remaining tokens as a machine instruction.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D103320
Daniil Fukalov [Wed, 12 May 2021 19:43:16 +0000 (22:43 +0300)]
[NFC] MemoryDependenceAnalysis cleanup.
1. Removed redundant includes,
2. Removed never defined and used `releaseMemory()`.
3. Fixed member functions names first letter case.
4. Renamed duplicate (in nested struct `NonLocalPointerInfo`) name
`NonLocalDeps` to `NonLocalDepsMap`.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D102358
Tobias Gysi [Mon, 31 May 2021 13:30:56 +0000 (13:30 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in verification (NFC).
Replace the uses of deprecated Structured Op Interface methods in LinalgInterfaces.cpp. This patch is based on https://reviews.llvm.org/D103394.
Differential Revision: https://reviews.llvm.org/D103404
Mikhail Goncharov [Mon, 31 May 2021 13:33:15 +0000 (15:33 +0200)]
Revert "[clang] Add support for the "abstract" contextual keyword of MSVC"
This reverts commit
818338add77411f5e9713247ea66142f332ef350.
Tests fail under sanitizer: https://lab.llvm.org/buildbot/#/builders/5/builds/8150
Tobias Gysi [Mon, 31 May 2021 12:46:32 +0000 (12:46 +0000)]
[mlir][linalg] Update Structured Op Interface (NFC).
Adding methods to access operand properties via OpOperands and mark outdated methods as deprecated.
Differential Revision: https://reviews.llvm.org/D103394
Sanjay Patel [Mon, 31 May 2021 12:53:09 +0000 (08:53 -0400)]
[SDAG] add check to sext-of-setcc fold to bypass changing a legal op
I accidentaly pushed a draft of D103280 that was discussed
during the review, but it was not supposed to be the final
version.
Rather than revert and recommit, I'm updating the existing
code. This way we have a record of the codegen diff that
would result if we decide to remove this predicate in the
future.
Nico Weber [Mon, 31 May 2021 12:53:07 +0000 (08:53 -0400)]
[libunwind] fix -Wc++98-compat-extra-semi without _LIBUNWIND_HIDE_SYMBOLS
Frederik Gossen [Mon, 31 May 2021 11:51:20 +0000 (13:51 +0200)]
[MLIR][Shape] Remove duplicate operands of `shape.assuming_all` op
Differential Revision: https://reviews.llvm.org/D103403
Roman Lebedev [Mon, 31 May 2021 11:38:26 +0000 (14:38 +0300)]
[NFC] ScalarEvolution: apply SSO to the ExprValueMap value
ExprValueMap is a map from SCEV * to a set-vector of (Value *, ConstantInt *) pair,
and while the map itself will likely be big-ish (have many keys),
it is a reasonable assumption that each key will refer to a small-ish
number of pairs.
In particular looking at n=512 case from
https://bugs.llvm.org/show_bug.cgi?id=50384,
the small-size of 4 appears to be the sweet spot,
it results in the least allocations while minimizing memory footprint.
```
$ for i in $(ls heaptrack.opt.*.gz); do echo $i; heaptrack_print $i | tail -n 6; echo ""; done
heaptrack.opt.0-orig.gz
total runtime: 14.32s.
calls to allocation functions: 8222442 (574192/s)
temporary memory allocations: 2419000 (168924/s)
peak heap memory consumption: 190.98MB
peak RSS (including heaptrack overhead): 239.65MB
total memory leaked: 67.58KB
heaptrack.opt.1-n1.gz
total runtime: 13.72s.
calls to allocation functions: 7184188 (523705/s)
temporary memory allocations: 2419017 (176338/s)
peak heap memory consumption: 191.38MB
peak RSS (including heaptrack overhead): 239.64MB
total memory leaked: 67.58KB
heaptrack.opt.2-n2.gz
total runtime: 12.24s.
calls to allocation functions: 6146827 (502355/s)
temporary memory allocations: 2418997 (197695/s)
peak heap memory consumption: 163.31MB
peak RSS (including heaptrack overhead): 211.01MB
total memory leaked: 67.58KB
heaptrack.opt.3-n4.gz
total runtime: 12.28s.
calls to allocation functions: 6068532 (494260/s)
temporary memory allocations: 2418985 (197017/s)
peak heap memory consumption: 155.43MB
peak RSS (including heaptrack overhead): 201.77MB
total memory leaked: 67.58KB
heaptrack.opt.4-n8.gz
total runtime: 12.06s.
calls to allocation functions: 6068042 (503321/s)
temporary memory allocations: 2418992 (200646/s)
peak heap memory consumption: 166.03MB
peak RSS (including heaptrack overhead): 213.55MB
total memory leaked: 67.58KB
heaptrack.opt.5-n16.gz
total runtime: 12.14s.
calls to allocation functions: 6067993 (499958/s)
temporary memory allocations: 2418999 (199307/s)
peak heap memory consumption: 187.24MB
peak RSS (including heaptrack overhead): 233.69MB
total memory leaked: 67.58KB
```
While that test may be an edge worst-case scenario,
https://llvm-compile-time-tracker.com/compare.php?from=
dee85d47d9f15fc268f7b18f279dac2774836615&to=
98a57e31b1947d5bcdf4a5605ac2ab32b4bd5f63&stat=instructions
agrees that this also results in improvements in the usual situations.
Uday Bondhugula [Mon, 31 May 2021 12:27:22 +0000 (17:57 +0530)]
[MLIR] Fix warnings in AffineOps.cpp
Fix warnings in AffineOps.cpp.
Differential Revision: https://reviews.llvm.org/D103374
Pushpinder Singh [Mon, 31 May 2021 07:19:41 +0000 (07:19 +0000)]
[AMDGPU][Libomptarget][NFC] Split host and device malloc
This patch splits the code path for host and device malloc.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D103389
Alexey Lapshin [Thu, 27 May 2021 11:07:35 +0000 (14:07 +0300)]
[llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing.
During reviewing D102277 it was decided to remove lazy options processing
from llvm-objcopy CopyConfig structure. This patch transforms processing of ELF
lazy options into the in-place processing.
Differential Revision: https://reviews.llvm.org/D103260
Mikhail Goncharov [Mon, 31 May 2021 11:29:33 +0000 (13:29 +0200)]
fix test for symlinked clang
c1ee4fb5af49a
Sanjay Patel [Mon, 31 May 2021 11:14:01 +0000 (07:14 -0400)]
[SDAG] try harder to fold casts into vector compare
sext (vsetcc X, Y) --> vsetcc (zext X), (zext Y) --
(when the zexts are free and a bunch of other conditions)
We have a couple of similar folds to this already for vector selects,
but this pattern slips through because it is only a setcc.
The tests are based on the motivating case from:
https://llvm.org/PR50055
...but we need extra logic to get that example, so I've left that as
a TODO for now.
Differential Revision: https://reviews.llvm.org/D103280
Juneyoung Lee [Mon, 31 May 2021 10:25:06 +0000 (19:25 +0900)]
fix broken clang tests after
7161bb87c914
Djordje Todorovic [Fri, 21 May 2021 12:29:23 +0000 (05:29 -0700)]
[LiveDebugVariables] Stop trimming locations of non-inlined vars
The D35953, D62650 and D73691 introduced trimming of variables locations
in LiveDebugVariables pass, since there are some cases where after
the virtregrewrite we have exploded number of DBG_VALUEs created for some
inlined variables. As it looks, all problematic cases were regarding
inlined variables, so it seems reasonable to stop trimming the location
ranges for non-inlined variables.
It has very good impact on the llvm-locstats report.
Differential Revision: https://reviews.llvm.org/D102917
Fraser Cormack [Thu, 27 May 2021 15:47:36 +0000 (16:47 +0100)]
[RISCV] Scale scalably-typed split argument offsets by VSCALE
This patch fixes a bug in lowering scalable-vector types in RISC-V's
main calling convention. When scalable-vector types are split and passed
indirectly, the target is responsible for scaling the offset --
initially set to the known-minimum store size -- by the scalable factor.
Before this we were issuing overlapping loads or stores to the different
parts, leading to incorrect codegen.
Credit to @HsiangKai for spotting this.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D103262
Juneyoung Lee [Mon, 31 May 2021 09:40:40 +0000 (18:40 +0900)]
[InsCombine] Fix a few remaining vec transforms to use poison instead of undef
This is a patch that replaces shufflevector and insertelement's placeholder value with poison.
Underlying motivation is to fix the semantics of shufflevector with undef mask to return poison instead
(D93818)
The consensus has been made in the late 2020 via mailing list as well as the thread in https://bugs.llvm.org/show_bug.cgi?id=44185 .
This patch is a simple syntactic change to the existing code, hence directly pushed as a commit.
David Green [Mon, 31 May 2021 09:22:37 +0000 (10:22 +0100)]
[DSE] Remove stores in the same loop iteration
DSE will currently only remove stores in the same block unless they can
be guaranteed to be loop invariant. This expands that to any stores that
are in the same Loop, at the same loop level. This should still account
for where AA/MSSA will not handle aliasing between loops, but allow the
dead stores to be removed where they overlap in the same loop iteration.
It requires adding loop info to DSE, but that looks fairly harmless.
The test case this helps is from code like this, which can come up in
certain matrix operations:
for(i=..)
dst[i] = 0;
for(j=..)
dst[i] += src[i*n+j];
After LICM, this becomes:
for(i=..)
dst[i] = 0;
sum = 0;
for(j=..)
sum += src[i*n+j];
dst[i] = sum;
The first store is dead, and with this patch is now removed.
Differntial Revision: https://reviews.llvm.org/D100464
Raphael Isemann [Mon, 31 May 2021 09:06:55 +0000 (11:06 +0200)]
[lldb][NFC] Remove unused var in SBDebugger::GetInternalVariableValue
This variable was originally just the default return value but got unused
in
6920b52be6f8731692a9bff4fe6a7b596cda00c5 .
Fraser Cormack [Fri, 28 May 2021 11:06:15 +0000 (12:06 +0100)]
[RISCV] Support vector conversions between fp and i1
This patch custom lowers FP_TO_[US]INT and [US]INT_TO_FP conversions
between floating-point and boolean vectors. As the default action is
scalarization, this patch both supports scalable-vector conversions and
improves the code generation for fixed-length vectors.
The lowering for these conversions can piggy-back on the existing
lowering, which lowers the operations to a supported narrowing/widening
conversion and then either an extension or truncation.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103312
Dmitry Polukhin [Thu, 27 May 2021 07:57:26 +0000 (00:57 -0700)]
[clang] NFC: split HeaderMapTest to have re-usable header map implementation for testing
NFC changes required for https://reviews.llvm.org/D103142
Test Plan: check-clang
Differential Revision: https://reviews.llvm.org/D103229
Andy Wingo [Mon, 31 May 2021 08:55:15 +0000 (10:55 +0200)]
Revert "[WebAssembly][CodeGen] IR support for WebAssembly local variables"
This reverts commit
bf35f4af51cddd743435bb6b94a45592c967891a. There was
an error in a shared-library build.
Abbas Sabra [Mon, 31 May 2021 08:38:17 +0000 (10:38 +0200)]
[clang] Add support for the "abstract" contextual keyword of MSVC
https://docs.microsoft.com/en-us/cpp/extensions/abstract-cpp-component-extensions?view=msvc-160
Note: like the already supported "sealed" keyword, the "abstract"
keyword is supported by MSVC by default.
Differential revision: https://reviews.llvm.org/D102517
Andy Wingo [Wed, 21 Apr 2021 13:41:48 +0000 (15:41 +0200)]
[WebAssembly][CodeGen] IR support for WebAssembly local variables
This patch adds TargetStackID::WasmLocal. This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.
For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1. SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there. Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.
Differential Revision: https://reviews.llvm.org/D101140
Tres Popp [Sun, 30 May 2021 17:50:54 +0000 (19:50 +0200)]
[mlir][NFC] Remove illegal TanhOp in LLVMConversionTarget
No tests fail and this seems to be technical debt from when the math
dialect was created. This should not be there as it prevents users from
configuring their converion target freely and results in unexpected
behavior on seemingly unrelated ops.
Differential Revision: https://reviews.llvm.org/D103388
Matthias Springer [Mon, 31 May 2021 08:22:35 +0000 (17:22 +0900)]
[mlir] Support permutation maps in vector transfer op folder
Fold away in_bounds attribute even if the transfer op has a non-identity permutation map.
Differential Revision: https://reviews.llvm.org/D103133
cynecx [Mon, 31 May 2021 08:00:35 +0000 (09:00 +0100)]
[LangRef] update according to unwinding support in inline asm
https://reviews.llvm.org/D95745 introduced a new `unwind` keyword for inline assembler expressions. Inline asms marked with the `unwind` keyword allows stack unwinding from inline assembly because the compiler emits unwinding information ("around" the inline asm) as it would for calls/invokes. Unwinding the stack from within non-unwind inline asm may cause UB.
Reviewed By: Amanieu
Differential Revision: https://reviews.llvm.org/D102642
Martin Storsjö [Fri, 28 May 2021 09:53:27 +0000 (09:53 +0000)]
[libcxx] [test] Add UNSUPPORTED: msvc in a couple verify.cpp tests
Due to issues with the detection of the clang-verify feature, these
tests have been skipped in the Windows CI configuration so far.
Differential Revision: https://reviews.llvm.org/D103308
Tres Popp [Sun, 30 May 2021 17:43:27 +0000 (19:43 +0200)]
[mlir][NFC] Rename MathToLLVM->MathToLibm
Kadir Cetinkaya [Mon, 31 May 2021 05:42:15 +0000 (07:42 +0200)]
[clangd] Move gtest include to TestTU.cpp from TestTU.h
Hyeongyu Kim [Mon, 31 May 2021 05:05:29 +0000 (14:05 +0900)]
[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)
As noted in PR45210: https://bugs.llvm.org/show_bug.cgi?id=45210
...the bug is triggered as Eli say when sext(idx) * ElementSize overflows.
```
// assume that GV is an array of 4-byte elements
GEP = gep GV, 0, Idx // this is accessing Idx * 4
L = load GEP
ICI = icmp eq L, value
=>
ICI = icmp eq Idx, NewIdx
```
The foldCmpLoadFromIndexedGlobal function simplifies GEP+load operation to icmp.
And there is a problem because Idx * ElementSize can overflow.
Let's assume that the wanted value is at offset 0.
Then, there are actually four possible values for Idx to match offset 0: 0x00..00, 0x40..00, 0x80..00, 0xC0..00.
We should return true for all these values, but currently, the new icmp only returns true for 0x00..00.
This problem can be solved by masking off (trailing zeros of ElementSize) bits from Idx.
```
...
=>
Idx' = and Idx, 0x3F..FF
ICI = icmp eq Idx', NewIdx
```
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D99481
Ben Shi [Mon, 31 May 2021 02:30:46 +0000 (10:30 +0800)]
[AVR][NFC] Refactor 8-bit & 16-bit shifts
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D98335
Bruce Mitchener [Sun, 30 May 2021 14:14:17 +0000 (21:14 +0700)]
[lldb] Fix typos. NFC.
Differential Revision: https://reviews.llvm.org/D103381
Chris Lattner [Sun, 30 May 2021 19:22:08 +0000 (12:22 -0700)]
[CSE] Make domInfo a stored property, cut use of DominanceInfo::hasDominanceInfo. NFC.
CSE is the only client of this API, refactor it a bit to pull the query
internally to make changes to DominanceInfo a bit easier. This commit
also improves comments a bit.
Lang Hames [Sat, 29 May 2021 18:42:09 +0000 (11:42 -0700)]
[ORC-RT] Add common.h -- Logging, casting and remote dispatch utilities.
Lang Hames [Sat, 29 May 2021 00:08:23 +0000 (17:08 -0700)]
[ORC-RT] Add OrcRTCWrapperFunctionResult.
OrcRTCWrapperFunctionResult is a C struct that can be used to return serialized
results from "wrapper functions" -- functions that deserialize an argument
buffer, call through to an actual implementation function, then serialize and
return the result of that function. Wrapper functions allow calls between ORC
and the ORC Runtime to be written using a single signature,
WrapperFunctionResult(const char *ArgData, size_t ArgSize), and without coupling
either side to a particular transport mechanism (in-memory, TCP, IPC, ... the
actual mechanism will be determined by the TargetProcessControl implementation).
OrcRTCWrapperFunctionResult is designed to allow small serialized buffers to
be returned by value, with larger serialized results stored on the heap. They
also provide an error state to report failures in serialization/deserialization.
David Green [Sun, 30 May 2021 17:02:14 +0000 (18:02 +0100)]
[ARM] Guard against loop variant gather ptr operands
This ensures that the operands of any gather/scatter instructions that
we attempt to push out of the loop are invariant, preventing invalid IR
from being generated.
Ben Shi [Sun, 30 May 2021 15:44:43 +0000 (23:44 +0800)]
[AVR] Improve inline assembly
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D96394
Florian Hahn [Sun, 30 May 2021 15:34:30 +0000 (16:34 +0100)]
[LoopDeletion] Add more tests with infinite sub-loops & mustprogress.
A couple of additional tests inspired by PR50511.
Butygin [Wed, 19 May 2021 19:04:29 +0000 (22:04 +0300)]
[mlir] StandardToLLVM: option to disable AllocOp lowering
Differential Revision: https://reviews.llvm.org/D103237
Ben Shi [Sun, 30 May 2021 14:39:07 +0000 (22:39 +0800)]
[clang][AVR] Add avr-libc/include to clang system include paths
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D97669
Roman Lebedev [Sun, 30 May 2021 13:40:01 +0000 (16:40 +0300)]
Revert "[clang-tidy] Simplify static assert check"
This patch starts to produce a very obvious false-positives,
despite the fact the preexisting tests already cover the pattern.
they clearly don't actually cover it.
https://godbolt.org/z/3zdqvbfxj
This reverts commit
1709bb8c7395418236ec94fe3b9d91fed746452b.
Florian Hahn [Sun, 30 May 2021 11:11:18 +0000 (12:11 +0100)]
[VectorCombine] Add tests with noundef index for load scalarization.
Sanjay Patel [Sun, 30 May 2021 10:43:33 +0000 (06:43 -0400)]
[InstCombine] fix miscompile from vector select substitution
This is similar to the fix in
c590a9880d7a ( PR49832 ), but
we missed handling the pattern for select of bools (no compare
inst).
We can't substitute a vector value because the equality condition
replacement that we are attempting requires that the condition
is true/false for the entire value. Vector select can be partly
true/false.
I added an assert for vector types, so we shouldn't hit this again.
Fixed formatting while auditing the callers.
https://llvm.org/PR50500
Florian Hahn [Sat, 29 May 2021 17:50:14 +0000 (18:50 +0100)]
[DAGCombine] Poison-prove scalarizeExtractedVectorLoad.
extractelement is poison if the index is out-of-bounds, so just
scalarizing the load may introduce an out-of-bounds load, which is UB.
To avoid introducing new UB, we can mask the index so it only contains
valid indices.
Fixes PR50382.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D103077
Mindong Chen [Sun, 30 May 2021 09:13:48 +0000 (17:13 +0800)]
[NFCI] Move DEBUG_TYPE definition below #includes
When you try to define a new DEBUG_TYPE in a header file, DEBUG_TYPE
definition defined around the #includes in files include it could
result in redefinition warnings even compile errors.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D102594
Pengxuan Zheng [Mon, 17 May 2021 19:16:07 +0000 (12:16 -0700)]
[SafeStack] Use proper API to get stack guard
Using the proper API automatically sets `__stack_chk_guard` to `dso_local` if
`Reloc::Static`. This wasn't strictly necessary until recently when dso_local was
no longer implied by `TargetMachine::shouldAssumeDSOLocal` for
`__stack_chk_guard`. By using the proper API, we can avoid generating unnecessary
GOT relocations.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D102646
Arthur Eubanks [Sun, 30 May 2021 06:08:15 +0000 (23:08 -0700)]
Revert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"
This reverts commit
1c7f32334d4becc725b9025fd32291a0e5729acd.
Some code still needs to properly set parameter ABI attributes, see
D101806.
Arthur Eubanks [Sun, 30 May 2021 05:40:07 +0000 (22:40 -0700)]
Revert "[NFC] Use ArgListEntry indirect types more in ISel lowering"
This reverts commit
bc7d15c61da78864b35e3c114294d6e4db645611.
Dependent change is to be reverted.
Xuanda Yang [Sun, 30 May 2021 01:51:41 +0000 (09:51 +0800)]
[analyzer] MallocSizeof: sizeof pointer type is compatible with void*
source: https://bugs.llvm.org/show_bug.cgi?id=50214
Make sizeof pointer type compatible with void* in MallocSizeofChecker.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D103358
Arthur O'Dwyer [Wed, 19 May 2021 15:57:04 +0000 (11:57 -0400)]
[libc++] Alphabetize and include-what-you-use. NFCI.
Differential Revision: https://reviews.llvm.org/D102781
Arthur O'Dwyer [Sat, 29 May 2021 17:12:16 +0000 (13:12 -0400)]
[libc++] [modules] Add __threading_support to the modulemap.
It looks to me as if *every* helper header needs to be added to the modulemap,
actually; which is unfortunate since we keep proliferating them at such a
rapid pace.
Fangrui Song [Sat, 29 May 2021 21:30:44 +0000 (14:30 -0700)]
[InstrProfiling][test] Improve tests
Arthur O'Dwyer [Sat, 29 May 2021 14:13:14 +0000 (10:13 -0400)]
[libc++] [test] Update "test_compare.h" users to avoid removed-in-C++20 members. NFCI.
Drive-by minor improvements to a couple of uses of min_pointer.
Differential Revision: https://reviews.llvm.org/D103366
David Green [Sat, 29 May 2021 20:04:26 +0000 (21:04 +0100)]
[ARM] Guard against WhileLoopStart kill flags
If the operand of the WhileLoopStart is flagged as killed, that
currently gets propogated to both the t2CMPri as the instruction is
reverted, and the newly created t2DoLoopStart. Only the second should
remain as killing the operand, the first dropping the flags.
Chris Lattner [Sat, 29 May 2021 17:50:15 +0000 (10:50 -0700)]
[Dominance] Speed up recalculate noticable, NFC.
This avoids trying to find the RegionKindInterface for every
operation in the program, we only need it if they have regions.
Differential Revision: https://reviews.llvm.org/D103367
Chris Lattner [Sat, 29 May 2021 17:33:20 +0000 (10:33 -0700)]
[Verifier] Inline a method to simplify the code in preparation for bigger changes, NFC.
Differential Revision: https://reviews.llvm.org/D103365
mydeveloperday [Sat, 29 May 2021 15:43:55 +0000 (16:43 +0100)]
[clang-format] successive C# attributes cause line breaking issues
{D74265} reduced the aggressiveness of line breaking following C# attributes, however this change removed any support for attributes on properties, causing significant ugliness to be introduced.
This revision goes some way to addressing that by re-introducing the more aggressive check to `mustBreakBefore()`, but constraining it to the most common cases where we use properties which should not impact the "caller info attributes" or the "[In , Out]" decorations that are normally put on pinvoke
It does not address my additional concerns of the original change regarding multiple C# attributes, as these are somewhat incorrectly handled by virtue of the fact its not recognising the second attribute as an attribute at all. But instead thinking its an array.
The purpose of this revision is to get back to where we were for the most common of cases as a stepping stone to resolving this. However {D74265} has broken a lot of C# code and this revision will go someway alone to addressing the majority.
Reviewed By: jbcoe, HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D103307
Jessica Clarke [Sat, 29 May 2021 14:11:37 +0000 (15:11 +0100)]
Revert "[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases"
The replacement doesn't work for llc, but it is needed by
patchable-function-entry.ll.
This reverts commit
aa9a30b83a06e3e5e68e32ea645ec2d9edc27efc.
Jessica Clarke [Sat, 29 May 2021 13:59:46 +0000 (14:59 +0100)]
[Support] Fix getMainExecutable on FreeBSD when called via an absolute path
On FreeBSD, absolute paths are passed unmodified in AT_EXECPATH, but
relative paths are resolved to absolute paths, and any symlinks will be
followed in the process. This means that the resource dir calculation
will be wrong if Clang is invoked as an absolute path to a symlink, and
this currently causes clang/test/Driver/rocm-detect.hip to fail on
FreeBSD. Thus, make sure to call realpath on the result, just like is
done on macOS.
Whilst here, clean up the old fallback auxargs loop to use the actual
type for auxargs rather than using lots of hacky casts that rely on
addresses and pointers being the same (which is not the case on CHERI,
and thus Arm's prototype Morello, although for little-endian systems it
happens to work still as the word-sized integer will be padded to a full
pointer, and it's someone academic given dereferencing past the end of
environ will give a bounds fault, but CheriBSD is new enough that the
elf_aux_info path will be used). This also makes the code easier to
follow, and removes the confusing double-increment of p.
Reviewed By: dim, arichardson
Differential Revision: https://reviews.llvm.org/D103346
Jessica Clarke [Sat, 29 May 2021 13:57:19 +0000 (14:57 +0100)]
[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases
Whilst here, also remove a couple of unnecessary -o - instances.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D103201
Sanjay Patel [Sat, 29 May 2021 12:52:26 +0000 (08:52 -0400)]
[InstCombine] fold zext of masked bit set/clear
This does not solve PR17101, but it is one of the
underlying diffs noted here:
https://bugs.llvm.org/show_bug.cgi?id=17101#c8
We could ease the one-use checks for the 'clear'
(no 'not' op) half of the transform, but I do not
know if that asymmetry would make things better
or worse.
Proofs:
https://rise4fun.com/Alive/uVB
Name: masked bit set
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp ne i32 %and, 0
%r = zext i1 %cmp to i32
=>
%s = lshr i32 %x, %y
%r = and i32 %s, 1
Name: masked bit clear
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp eq i32 %and, 0
%r = zext i1 %cmp to i32
=>
%xn = xor i32 %x, -1
%s = lshr i32 %xn, %y
%r = and i32 %s, 1
Note: this is a re-post of a patch that I committed at:
rGa041c4ec6f7a
The commit was reverted because it exposed another bug:
rGb212eb7159b40
But that has since been corrected with:
rG8a156d1c2795189 ( D101191 )
Differential Revision: https://reviews.llvm.org/D72396
Sanjay Patel [Fri, 28 May 2021 20:03:09 +0000 (16:03 -0400)]
[InstCombine] reduce code duplication; NFC
Denys Petrov [Fri, 28 May 2021 13:52:44 +0000 (16:52 +0300)]
[analyzer] Use Optional as a return type of StoreManager::castRegion
Summary: Make StoreManager::castRegion function usage safier. Replace `const MemRegion *` with `Optional<const MemRegion *>`. Simplified one of related test cases due to suggestions in D101635.
Differential Revision: https://reviews.llvm.org/D103319
Ulrich Weigand [Sat, 29 May 2021 10:15:18 +0000 (12:15 +0200)]
[SystemZ] Set getExtendForAtomicOps to ISD::ANY_EXTEND
The implementation of subword atomics does not actually
guarantee the result is zero-extended, which now caused
build bot failures after https://reviews.llvm.org/D101342
was landed.
LLVM GN Syncbot [Sat, 29 May 2021 07:51:43 +0000 (07:51 +0000)]
[gn build] Port
b13edf6e907b
Mark de Wever [Sat, 29 May 2021 07:50:26 +0000 (09:50 +0200)]
Revert "[libc++] NFC: Move unwrap_iter to its own header"
This reverts commit
9968896cd62a62b11ac61085534dd598c4bd3c60.
This commit seems to cause the build failures of main.
Nikita Popov [Sat, 29 May 2021 07:31:28 +0000 (09:31 +0200)]
[LoopUnroll] Make DomTree explicitly required (NFC)
Some of the code was already assuming that DT is non-null, so
make that requirement more explicit and remove unnecessary null
checks.
LemonBoy [Sat, 29 May 2021 06:50:34 +0000 (08:50 +0200)]
[AtomicExpandPass][AArch64] Promote xchg with floating-point types to integer ones
Follow the same strategy used for atomic loads/stores by converting the operands to equally-sized integer types.
This change prevents the atomic expansion pass from generating illegal LL/SC pairs when targeting AArch64: `expand-atomicrmw-xchg-fp.ll` would previously instantiate intrinsics such as `llvm.aarch64.ldaxr.p0f32` that cannot be lowered.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D103232
Fangrui Song [Sat, 29 May 2021 04:33:32 +0000 (21:33 -0700)]
[InstrProfiling][test] Fix stale linkage.ll
Fangrui Song [Sat, 29 May 2021 04:14:03 +0000 (21:14 -0700)]
[InstrProfiling][test] Fix stale tests
* Change linkage/visibility of __profn_ variables to match the reality
* alwaysinline.ll: Add "EnableValueProfiling", otherwise it doesn't test available_externally alwaysinline.
* Delete PR23499.ll - covered by other comdat tests.