Scott Linder [Mon, 12 Sep 2022 22:52:51 +0000 (22:52 +0000)]
dos2unix AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Differential Revision: https://reviews.llvm.org/D133733
Alex Bradbury [Tue, 13 Sep 2022 15:58:07 +0000 (16:58 +0100)]
[RISCV] Implement isMaskAndCmp0FoldingBeneficial hook
This hook is currently only used by CodeGenPrepare, which will sink *and
duplicate* an 'and' into a block that has an 'icmp 0' user of it if the
hook returns true.
This hook is less useful for RISC-V than for targets like AArch64 that
have a TBZ (test bit and branch if zero instruction), but may still be
profitable if Zbs is available and a BEXTI can be selected.
Conservatively, we return false even if Zbs is enabled for any masks
that fit in the ANDI immediate because it's possible the only use is a
branch on the result, and ANDI+BNEZ => BEXTI+BNEZ isn't a profitable
transformation.
Differential Revision: https://reviews.llvm.org/D131492
Zequan Wu [Fri, 9 Sep 2022 19:39:29 +0000 (12:39 -0700)]
[gn build] port
a3172df59c32 (check-lldb)
https://reviews.llvm.org/rGa3172df59c32aac48c113eb7d6a1324aaa95c474 breaks
check-lldb gn build.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D133604
Gabriel Ravier [Tue, 13 Sep 2022 16:32:02 +0000 (09:32 -0700)]
[lldb] Fixed a number of typos
I went over the output of the following mess of a command:
(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel
--xargs -0 cat | aspell list --mode=none --ignore-case | grep -E
'^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' |
aspell pipe -W3 | grep : | cut -d' ' -f2 | less)
and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).
Differential revision: https://reviews.llvm.org/D131122
Christian Sigg [Wed, 7 Sep 2022 09:31:31 +0000 (11:31 +0200)]
[MLIR] Remove unused lit test replacements.
The following replacements have been changed to `%mlir_lib_dir`:
- `%linalg_test_lib_dir`
- `%cuda_wrapper_library_dir`
- `%spirv_wrapper_library_dir`
- `%vulkan_wrapper_library_dir`
- `%mlir_runner_utils_dir`
- `%mlir_integration_test_dir`
If there are no requests to delay submission, I plan to submit this on 9/13/2002 (Tuesday).
See also PSA: https://discourse.llvm.org/t/psa-removing-mlir-lit-test-replacements/65124
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D133409
Jessica Paquette [Tue, 13 Sep 2022 17:19:17 +0000 (10:19 -0700)]
[llvm-remarkutil] Make tryParseRemarksFromInputFile static
All the functions in this file should be static to avoid ODR violations.
Daniel Bertalan [Fri, 9 Sep 2022 15:18:10 +0000 (17:18 +0200)]
[lld-macho] Sort data-in-code entries
Previously, we would add entries to DataInCodeSection in the order they
appeared in input files. Because of this, entries would not be sorted if
sections were reordered due to e.g. `-order_file` or call graph profile
sorting. ld64 always keeps data-in-code information sorted.
This commit also fixes an incorrect assertion. The original assertion
from D103006 used to check that data-in-code entries are sorted in the
input objects -- likely because we use binary search on that data. In
D115556, the assertion was moved into `collectDataInCodeEntries`, but
the checked variable's name was not changed, so it ended up checking the
final contents of the DataInCodeSection.
We no longer crash when building LLVM with PGO using an asserts build of
LLD as the linker.
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1265937
Numbers for linking the Chromium Framework reproducer from #48001, which
has 6829 data-in-code entries:
x before
+ after
N Min Max Median Avg Stddev
x 20 2.1076453 2.3059683 2.1132485 2.1350302 0.
049905767
+ 20 2.1069031 2.3915262 2.14465 2.1728429 0.
084065898
No difference proven at 95.0% confidence
Differential Revision: https://reviews.llvm.org/D133581
Slava Zakharin [Fri, 9 Sep 2022 20:33:23 +0000 (13:33 -0700)]
[mlir][arith] Canonicalization patterns for subi.
subi(addi(a, b), b) -> a
subi(addi(a, b), a) -> b
subi(subi(a, b), a) -> subi(0, b)
Differential Revision: https://reviews.llvm.org/D133615
David M. Lary [Tue, 13 Sep 2022 15:26:32 +0000 (17:26 +0200)]
lldb: Add support for R_386_32 relocations to ObjectFileELF
I encountered an issue where `p &variable` was finding an incorrect address for
32-bit PIC ELF files loaded into a running process. The problem was that the
R_386_32 ELF relocations were not being applied to the DWARF section, so all
variables in that file were reporting as being at the start of their respective
section. There is an assert that catches this on debug builds, but silently
ignores the issue on non-debug builds.
In this changeset, I added handling for the R_386_32 relocation type to
ObjectFileELF, and a supporting function to ELFRelocation to differentiate
between DT_REL & DT_RELA in ObjectFileELF::ApplyRelocations().
Demonstration of issue:
```
[dmlary@host work]$ cat rel.c
volatile char padding[32] = "make sure var isnt at .data+0";
volatile char var[] = "test";
[dmlary@host work]$ gcc -c rel.c -FPIC -fpic -g -m32
[dmlary@host work]$ lldb ./exec
(lldb) target create "./exec"
Current executable set to '/home/dmlary/src/work/exec' (i386).
(lldb) process launch --stop-at-entry
Process 21278 stopped
* thread #1, name = 'exec', stop reason = signal SIGSTOP
frame #0: 0xf7fdb150 ld-2.17.so`_start
ld-2.17.so`_start:
-> 0xf7fdb150 <+0>: movl %esp, %eax
0xf7fdb152 <+2>: calll 0xf7fdb990 ; _dl_start
ld-2.17.so`_dl_start_user:
0xf7fdb157 <+0>: movl %eax, %edi
0xf7fdb159 <+2>: calll 0xf7fdb140
Process 21278 launched: '/home/dmlary/src/work/exec' (i386)
(lldb) image add ./rel.o
(lldb) image load --file rel.o .text 0x40000000 .data 0x50000000
section '.text' loaded at 0x40000000
section '.data' loaded at 0x50000000
(lldb) image dump symtab rel.o
Symtab, file = rel.o, num_symbols = 13:
Debug symbol
|Synthetic symbol
||Externally Visible
|||
Index UserID DSX Type File Address/Value Load Address Size Flags Name
------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
[ 0] 1 SourceFile 0x0000000000000000 0x0000000000000000 0x00000004 rel.c
[ 1] 2 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 2] 3 Invalid 0x0000000000000000 0x50000000 0x0000000000000020 0x00000003
[ 3] 4 Invalid 0x0000000000000025 0x0000000000000000 0x00000003
[ 4] 5 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 5] 6 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 6] 7 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 7] 8 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 8] 9 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 9] 10 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 10] 11 Invalid 0x0000000000000000 0x0000000000000020 0x00000003
[ 11] 12 X Data 0x0000000000000000 0x50000000 0x0000000000000020 0x00000011 padding
[ 12] 13 X Data 0x0000000000000020 0x50000020 0x0000000000000005 0x00000011 var
(lldb) p &var
(volatile char (*)[5]) $1 = 0x50000000
```
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D132954
Kazu Hirata [Tue, 13 Sep 2022 16:30:06 +0000 (09:30 -0700)]
[Vectorize] Fix a warning
This patch fixes:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5879:5: error:
expression result unused [-Werror,-Wunused-value]
Arthur Eubanks [Mon, 12 Sep 2022 22:05:00 +0000 (15:05 -0700)]
[SimplifyCFG] Don't hoist allocas
D129370 started hoisting allocas across stacksave/stackrestore
boundaries which is wrong.
Reviewed By: chill, rnk
Differential Revision: https://reviews.llvm.org/D133730
Valery N Dmitriev [Tue, 6 Sep 2022 21:42:28 +0000 (14:42 -0700)]
[SLP] Unify main/alternate selection for CmpInst instructions
Make main/alternate operation selection logic for CmpInst
consistent across SLP vectorizer.
Differential Revision: https://reviews.llvm.org/D133430
Craig Topper [Tue, 13 Sep 2022 16:07:56 +0000 (09:07 -0700)]
[LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in ExpandIntRes_ADDSUB.
This is the ultimate fallback code if UADDO isn't supported.
If the target uses 0/1 we used one compare, but if the target doesn't
use 0/1 we emitted two compares. Regardless of boolean constants we
should only need to check that the Result is less than one of the
original operands. So we only need one compare.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D133708
Hendrik Greving [Fri, 9 Sep 2022 17:32:52 +0000 (10:32 -0700)]
[ValueTypes] Define MVTs for v256i2/v128i4.
Adds MVT::v256i2, MVT::v128i4.
Differential Revision: https://reviews.llvm.org/D133603
Alex Zinenko [Tue, 13 Sep 2022 14:24:51 +0000 (16:24 +0200)]
[mlir] optional verbose debug messages for transform application
Introduce the additional "transform-dialect-print-top-level-after-all" debug
category that allows the user to print the paylaod IR after each transformation
performed by the transform dialect. This is useful for understanding and
debugging the effects of individual transformations in complex transformations
scripts, including in downstreams, without having to modify the transformation
script itself.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D133775
Alex Bradbury [Tue, 13 Sep 2022 15:50:08 +0000 (16:50 +0100)]
[RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for resulting canonicalisation
As the Zbs extension includes bext[i] for bit extract, we can
unconditionally return true from this hook. This hook causes the DAG
combiner to perform the following canonicalisation:
and (not (srl X, C)), 1 --> (and X, 1<<C) == 0
and (srl (not X), C)), 1 --> (and X, 1<<C) == 0
As simply changing the hook causes a codegen regression, this patch also
modifies a BEXTI pattern to match this canonicalised form.
As BSETINVMask is now used for BEXT as well as BSET and BINV, it has
been renamed to the more generic SingleBitSetMask.
There is one codegen change in bittest.ll for bittest_31_i64 (NOT+BEXTI
rather than NOT+SRLIW). This is neutral in terms of code quality.
Differential Revision: https://reviews.llvm.org/D131482
Craig Topper [Tue, 13 Sep 2022 15:41:32 +0000 (08:41 -0700)]
[RISCV] Fix a bug in i32 FP_TO_UINT_SAT lowering on RV64.
We use the saturating behavior of fcvt.wu.h/s/d but forgot to
take into account that fcvt.wu will sign extend the saturated
result. According to computeKnownBits a promoted FP_TO_UINT_SAT
is expected to zero extend the saturated value.
In many case the upper bits aren't be demanded so this wouldn't
be an issue. But if we computeKnownBits caused an AND to be removed
it would be a bug.
This patch inserts an AND during to zero the upper bits.
Unfortunately, this pessimizes code if we aren't able to tell if
the upper bits are demanded. To fix that we could custom type
promote the FP_TO_UINT_SAT with SEXT_INREG after it, but I'll
leave that for future work.
I haven't found a failure from this, I was revisiting the code to
add vector support and spotted it.
Differential Revision: https://reviews.llvm.org/D133746
Nicolas Vasilache [Tue, 13 Sep 2022 07:51:56 +0000 (00:51 -0700)]
[mlir][Vector] Support broadcast vector type in distribution of vector.warp_execute_on_lane_0.
This revision significantly improves and tests the broadcast behavior of vector.warp_execute_on_lane_0.
Previously, the implementation of the broadcast behavior of vector.warp_execute_on_lane_0
assumed that the broadcasted value was always of scalar type.
This is not necessarily the case.
Differential Revision: https://reviews.llvm.org/D133767
Aaron Ballman [Tue, 13 Sep 2022 15:06:01 +0000 (11:06 -0400)]
Correct the __has_c_attribute value for fallthrough
The original proposal was seen in Apr 2019 and we accidentally used
that date (201904L) as the feature testing value. However, WG14 N2408
was adopted at the Oct 2019 meeting and so that's the correct date for
the feature testing macro. The committee draft for C2x shows 201910L
for this value, so this changes brings us in line with the standard.
Alex Zinenko [Tue, 13 Sep 2022 13:57:14 +0000 (15:57 +0200)]
[mlir] improve the error message in expensive transform checks
Include the transform op being applied when reporting it using an invalidated
handle. This was missing previously and made it harder for the user to
understand where the handle is being used, especially if the transform script
included some sort of iteration.
Reviewed By: guraypp
Differential Revision: https://reviews.llvm.org/D133774
Nico Weber [Tue, 13 Sep 2022 14:48:33 +0000 (10:48 -0400)]
[gn build] port
30578c08568bc
David Green [Tue, 13 Sep 2022 14:47:41 +0000 (15:47 +0100)]
[AArch64] Sink splat(s/zext(..)) to uses
If the Shuffle is a splat and the operand is a zext/sext, sinking the
operand and the s/zext can help create indexed s/umull. This is
especially useful to prevent i64 mul being scalarized.
Differential Revision: https://reviews.llvm.org/D133355
Matt Arsenault [Tue, 13 Sep 2022 13:57:22 +0000 (09:57 -0400)]
LiveRegUnits: Break register loop when a clobber is encountered
Christian Sigg [Tue, 13 Sep 2022 07:32:54 +0000 (09:32 +0200)]
[MLIR] Only substitute `mlir-spirv-cpu-runner` tool if enabled
This tool is only used if `MLIR_ENABLE_SPIRV_CPU_RUNNER` was specified and should only be substituted in that case. Alternatively, we could make the substitution optional.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D133752
Aaron Ballman [Tue, 13 Sep 2022 13:36:54 +0000 (09:36 -0400)]
Update the C Status page for the Clang 15 release
Now that Clang 15 is out, we can swap all the unreleased entries over.
Aaron Ballman [Tue, 13 Sep 2022 13:27:13 +0000 (09:27 -0400)]
Correct the __has_c_attribute value for maybe_unused
The original proposal was adopted in Apr 2019, but was subsequently
updated by WG14 N2662 in June 2021. We already supported the attribute
on a label and it behaved as expected, but we had not bumped the
feature test value.
Nico Weber [Tue, 13 Sep 2022 13:07:16 +0000 (09:07 -0400)]
Revert "[llvm-dwp] Report the filename if it cannot be found"
This reverts commit
35028d417bb32bc05294e77c9ddcf50f24f277eb.
Breaks tests on Windows, see https://reviews.llvm.org/D133549#3785952
Simon Pilgrim [Tue, 13 Sep 2022 12:46:44 +0000 (13:46 +0100)]
[LoopVectorize][X86] Add uniform shift costs checks for VF=1/2/4
Matt Arsenault [Tue, 13 Sep 2022 00:58:00 +0000 (20:58 -0400)]
DeadMachineInstructionElim: Don't repeat per-function init
This was happening for every iteration but only needs to be done once.
Matt Arsenault [Mon, 12 Sep 2022 22:54:41 +0000 (18:54 -0400)]
LiveRegUnits: Cleanup isReg checks
This is the common case and should be checked first. Provides a very
marginal compile time improvement on the example I'm looking at.
Aaron Ballman [Tue, 13 Sep 2022 12:17:55 +0000 (08:17 -0400)]
Fix the LLVM sphinx build
This addresses the failures found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/25899
Aaron Ballman [Tue, 13 Sep 2022 12:09:55 +0000 (08:09 -0400)]
Correct the __has_c_attribute value for nodiscard
The original proposal was adopted in Apr 2019 and so the previous value
was 201904L. However, a subsequent proposal (N2448) was adopted to add
an optional message argument to the attribute. We already support that
functionality, but had not bumped the feature test value.
Animesh Kumar [Thu, 25 Aug 2022 10:01:05 +0000 (15:31 +0530)]
[OpenMP] Extend lit test for parallel for simd construct
This construct is being tested for atomic operation based upon
the test 5.0/parallel_for_simd/test_parallel_for_simd_atomic.c
from the SOLLVE repo: https://github.com/SOLLVE/sollve_vv
Differential Revision: https://reviews.llvm.org/D132643
Tres Popp [Tue, 13 Sep 2022 08:21:55 +0000 (10:21 +0200)]
[mlir] Decrease stack allocations in Presburger's Matrix
The class set a SmallVector stack allocation size to 64 elements which
is uncommonly large. These structures are then used extensively and
copied often in functions which led to stack frame sizes considered
excessively large for some use cases.
Differential Revision: https://reviews.llvm.org/D133761
Zain Jaffal [Tue, 13 Sep 2022 10:35:17 +0000 (11:35 +0100)]
[InstCombine] Test for matrix multiplication negation optimisation.
If one of the operands is negated in a multiplication we can optimise the operation by moving the negation to the smallest operand or to the result
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D133287
Simon Pilgrim [Tue, 13 Sep 2022 10:22:54 +0000 (11:22 +0100)]
[X86] Add GFNI test coverage for bitreverse codegen
We should be able to efficiently use the vector version for scalar bitreverse, like we do for XOP.
Simon Pilgrim [Mon, 12 Sep 2022 15:42:07 +0000 (16:42 +0100)]
[CostModel][X86] Add CostKinds test coverage for bitreverse intrinsics
Alexander Kornienko [Tue, 13 Sep 2022 10:09:40 +0000 (12:09 +0200)]
Revert "[clang] template / auto deduction deduces common sugar"
This reverts commit
d200db38637884fd0b421802c6094b2a03ceb29e, which causes a
clang crash. See https://reviews.llvm.org/D111283#3785755
Test case for convenience:
```
template <typename T>
using P = int T::*;
template <typename T, typename... A>
void j(P<T>, T, A...);
template <typename T>
void j(P<T>, T);
struct S {
int b;
};
void g(P<S> k, S s) { j(k, s); }
```
David Spickett [Mon, 12 Sep 2022 13:10:02 +0000 (13:10 +0000)]
[llvm][AArch64] Explain why certain registers are reserved on Arm64EC
This extends
4658366d95d5e398baad956225cc4ba339d5b037 to add a note
explaining why the register is reserved.
note: x13 is clobbered by asynchronous signals when using Arm64EC.
I've added testing for w/x registers and v/q/s/d and h floating point
registers.
llvm will accept, but silently do nothing with, b registers. So they
are not tested here (clang rejects them so at least for C you're safe anyway).
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D133701
Jay Foad [Tue, 13 Sep 2022 09:50:22 +0000 (10:50 +0100)]
[AMDGPU] Add GFX11 globalisel test coverage for fptosi/fptoui
Pavel Samolysov [Tue, 13 Sep 2022 08:04:30 +0000 (11:04 +0300)]
[NFC][ScheduleDAGInstrs] Use structure bindings and emplace_back
Some uses of std::make_pair and the std::pair's first/second members
in the ScheduleDAGInstrs.[cpp|h] files were replaced with using of the
vector's emplace_back along with structure bindings from C++17.
Dmitry Preobrazhensky [Tue, 13 Sep 2022 09:41:39 +0000 (12:41 +0300)]
[AMDGPU][MC][GFX11] Add a helper function for identification of VOPD instructions
Differential Revision: https://reviews.llvm.org/D133608
Dmitry Preobrazhensky [Tue, 13 Sep 2022 09:37:30 +0000 (12:37 +0300)]
[AMDGPU][MC] Add detection of mandatory literals in parser
Differential Revision: https://reviews.llvm.org/D133606
Sven van Haastregt [Tue, 13 Sep 2022 09:10:48 +0000 (10:10 +0100)]
[OpenCL] Guard depth image builtins
Ensure any uses of `image2d_depth_t` and `image2d_array_depth_t` are
guarded behind the `cl_khr_depth_images` extension in
`OpenCLBuiltins.td`.
Fix a few missing guards in `opencl-c.h`.
jacquesguan [Wed, 31 Aug 2022 08:58:37 +0000 (16:58 +0800)]
[RISCV][test] Add test for the cost model of vector insert/extract element.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133005
Sylvestre Ledru [Tue, 13 Sep 2022 08:53:59 +0000 (10:53 +0200)]
Revert "[clang, llvm] Add __declspec(safebuffers), support it in CodeView"
Causing:
https://github.com/llvm/llvm-project/issues/57709
This reverts commit
ab56719acd98778fb2e48fa425ac7c8d27bdea86.
Jean Perier [Tue, 13 Sep 2022 08:39:33 +0000 (10:39 +0200)]
[flang][runtime] ensure character compares to blank are unsigned
CompareToBlankPadding was doing signed compare on architecture where
`char` is signed. This caused `'abc'//char(128) > 'abc'` to evaluate
to false at runtime instead of true.
Differential Revision: https://reviews.llvm.org/D133693
Timm Bäder [Sun, 11 Sep 2022 12:39:52 +0000 (14:39 +0200)]
[clang][Interp][NFC] Use constexpr if in OffsetHelper
Add is a template parameter, so we can use constexpr if here.
Timm Bäder [Sat, 10 Sep 2022 10:55:41 +0000 (12:55 +0200)]
[clang][Interp][NFC] InterpFrame::getParam can be const
Make stackRef() const as well and use that.
Timm Bäder [Sat, 10 Sep 2022 10:51:50 +0000 (12:51 +0200)]
[clang][Interp][NFC] InterpFrame::getLocal() can be const
Make localRef() const and use that.
Timm Bäder [Sat, 10 Sep 2022 07:42:02 +0000 (09:42 +0200)]
[clang][Interp][NFC] InterpFrame: localBlock() can be const
Timm Bäder [Tue, 6 Sep 2022 07:31:17 +0000 (09:31 +0200)]
[clang][Interp][NFC] Forward-declare Pointer in PrimType header
No need to include the full Pointer.h here.
Timm Bäder [Wed, 31 Aug 2022 07:24:03 +0000 (09:24 +0200)]
[clang][Interp] Handle DeclRefExpr of reference types
References are implemented through pointers, so we need a second deref
when encountering a DeclRefExpr of a reference type.
Differential Revision: https://reviews.llvm.org/D132997
Haojian Wu [Tue, 13 Sep 2022 08:26:00 +0000 (10:26 +0200)]
Nikita Popov [Mon, 12 Sep 2022 16:29:53 +0000 (18:29 +0200)]
[BasicAA] Delay getAllocTypeSize() call (NFC)
This call is expensive, so don't perform it for zero indices.
Also rename the variable to use Alloc rather than Alloca, this
doesn't have anything to do with allocas in particular.
Florian Hahn [Tue, 13 Sep 2022 08:09:18 +0000 (09:09 +0100)]
[LV] Mark Instr as const in scalarizeInstruction. (NFC).
This is to reduce the diff in follow-up changes.
David Green [Tue, 13 Sep 2022 07:57:15 +0000 (08:57 +0100)]
[TypePromotionPass] Don't treat phi's as ToPromote
This attempts to stop the type promotion pass transforming where it is
not profitable, by not marking PhiNodes as ToPromote and being more
aggressive about pulling extends out of loops.
Differential Revision: https://reviews.llvm.org/D133203
Martin Storsjö [Fri, 26 Aug 2022 13:47:07 +0000 (16:47 +0300)]
[clang] Explicitly set the EmulatedTLS codegen option. NFC.
Set the EmulatedTLS option based on `Triple::hasDefaultEmulatedTLS()`
if the user didn't specify it; set `ExplicitEmulatedTLS` to true
in `llvm::TargetOptions` and set `EmulatedTLS` to Clang's
opinion of what the default or preference is.
This avoids any risk of deviance between the two.
This affects one check of `getCodeGenOpts().EmulatedTLS` in
`shouldAssumeDSOLocal` in CodeGenModule, but as that check only
is done for `TT.isWindowsGNUEnvironment()`, and
`hasDefaultEmulatedTLS()` returns false for such environments
it doesn't make any current testable difference - thus NFC.
Some mingw distributions carry a downstream patch, that enables
emulated TLS by default for mingw targets in `hasDefaultEmulatedTLS()`
- and for such cases, this patch does make a difference and fixes the
detection of emulated TLS, if it is implicitly enabled.
Differential Revision: https://reviews.llvm.org/D132916
Matthias Gehre [Tue, 13 Sep 2022 07:29:24 +0000 (08:29 +0100)]
Move ExpandLargeDivRem to llvm/test/CodeGen/X86 because they need a triple
jacquesguan [Fri, 9 Sep 2022 08:39:08 +0000 (16:39 +0800)]
[mlir][NFC] Fix polynomial Approx test.
This patch refators the polynomial Approx test. Now we pass the constant as function argument to avoid constant folder.
Link: https://github.com/llvm/llvm-project/issues/57613
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D133562
Balazs Benics [Tue, 13 Sep 2022 07:04:27 +0000 (09:04 +0200)]
[analyzer] Dump the environment entry kind as well
By this change the `exploded-graph-rewriter` will display the class kind
of the expression of the environment entry. It makes easier to decide if
the given entry corresponds to the lvalue or to the rvalue of some
expression.
It turns out the rewriter already had support for visualizing it, but
probably was never actually used?
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D132109
Zi Xuan Wu (Zeson) [Thu, 8 Sep 2022 07:46:30 +0000 (15:46 +0800)]
[CSKY] Fix the Predicates of instruction selection
Some select node Pattern with register cmp instruction should be guarded
by iHas2E3.
Balazs Benics [Tue, 13 Sep 2022 06:58:46 +0000 (08:58 +0200)]
[analyzer] LazyCompoundVals should be always bound as default bindings
`LazyCompoundVals` should only appear as `default` bindings in the
store. This fixes the second case in this patch-stack.
Depends on: D132142
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D132143
Balazs Benics [Tue, 13 Sep 2022 06:58:46 +0000 (08:58 +0200)]
[analyzer] Prefer wrapping SymbolicRegions by ElementRegions
It turns out that in certain cases `SymbolRegions` are wrapped by
`ElementRegions`; in others, it's not. This discrepancy can cause the
analyzer not to recognize if the two regions are actually referring to
the same entity, which then can lead to unreachable paths discovered.
Consider this example:
```lang=C++
struct Node { int* ptr; };
void with_structs(Node* n1) {
Node c = *n1; // copy
Node* n2 = &c;
clang_analyzer_dump(*n1); // lazy...
clang_analyzer_dump(*n2); // lazy...
clang_analyzer_dump(n1->ptr); // rval(n1->ptr): reg_$2<int * SymRegion{reg_$0<struct Node * n1>}.ptr>
clang_analyzer_dump(n2->ptr); // rval(n2->ptr): reg_$1<int * Element{SymRegion{reg_$0<struct Node * n1>},0 S64b,struct Node}.ptr>
clang_analyzer_eval(n1->ptr != n2->ptr); // UNKNOWN, bad!
(void)(*n1);
(void)(*n2);
}
```
The copy of `n1` will insert a new binding to the store; but for doing
that it actually must create a `TypedValueRegion` which it could pass to
the `LazyCompoundVal`. Since the memregion in question is a
`SymbolicRegion` - which is untyped, it needs to first wrap it into an
`ElementRegion` basically implementing this untyped -> typed conversion
for the sake of passing it to the `LazyCompoundVal`.
So, this is why we have `Element{SymRegion{.}, 0,struct Node}` for `n1`.
The problem appears if the analyzer evaluates a read from the expression
`n1->ptr`. The same logic won't apply for `SymbolRegionValues`, since
they accept raw `SubRegions`, hence the `SymbolicRegion` won't be
wrapped into an `ElementRegion` in that case.
Later when we arrive at the equality comparison, we cannot prove that
they are equal.
For more details check the corresponding thread on discourse:
https://discourse.llvm.org/t/are-symbolicregions-really-untyped/64406
---
In this patch, I'm eagerly wrapping each `SymbolicRegion` by an
`ElementRegion`; basically canonicalizing to this form.
It seems reasonable to do so since any object can be thought of as a single
array of that object; so this should not make much of a difference.
The tests also underpin this assumption, as only a few were broken by
this change; and actually fixed a FIXME along the way.
About the second example, which does the same copy operation - but on
the heap - it will be fixed by the next patch.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D132142
Haojian Wu [Tue, 13 Sep 2022 06:57:43 +0000 (08:57 +0200)]
Fix a -Wswitch warning.
jacquesguan [Sat, 20 Aug 2022 13:33:00 +0000 (21:33 +0800)]
[RISCV] Add cost model for compare and select instructions.
This patch adds cost model for vector compare and select instructions. For vector FP compare instruction, it only add the comparisions supported natively.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D132296
Max Kazantsev [Tue, 13 Sep 2022 05:31:07 +0000 (12:31 +0700)]
[SCEVExpander] Recompute poison-generating flags on hoisting. PR57187
Instruction being hoisted could have nuw/nsw flags inferred from the old
context, and we cannot simply move it to the new location keeping them
because we are going to introduce new uses to them that didn't exist before.
Example in https://github.com/llvm/llvm-project/issues/57187 shows how
this can produce branch by poison from initially well-defined program.
This patch forcefully recomputes poison-generating flag in the new context.
Differential Revision: https://reviews.llvm.org/D132022
Reviewed By: fhahn, nikic
Zhang Qing Shan [Sat, 10 Sep 2022 00:05:20 +0000 (08:05 +0800)]
[llvm-dwp] Get the DWO file from relative path if the absolute path is not valid
Extend the llvm-dwp to support searching the DWOs that from relative path for the
case that build from remote building system(different comp_dir).
Reviewd By: dblaikie
Differential Revision: https://reviews.llvm.org/D133480
Chuanqi Xu [Tue, 13 Sep 2022 05:03:34 +0000 (13:03 +0800)]
[C++20] [Modules] Make member functions with a in-class definition in HU implicitly inline
According to [dcl.inline]p7/note4,
> In the global module, a function defined within a class definition is
> implicitly inline.
And the declarations in the header unit are attached to the global
module fragment. So the function defined within a class definition in
header units should be implicitly inline too.
This fixes https://github.com/llvm/llvm-project/issues/57571.
Zhang Qing Shan [Tue, 13 Sep 2022 04:56:23 +0000 (12:56 +0800)]
[llvm-dwp] Report the filename if it cannot be found
For now, we report nothing if the execution/dwo file is missing, which is confusing.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D133549
Ting Wang [Tue, 13 Sep 2022 04:47:47 +0000 (00:47 -0400)]
[PowerPC][NFC] Add base test case to show redundant spill of vector registers
Reviewed By: lkail
Differential Revision: https://reviews.llvm.org/D133543
Craig Topper [Tue, 13 Sep 2022 03:27:25 +0000 (20:27 -0700)]
[RISCV] Add test cases with result of fp_to_s/uint_sat sign/zero-extended from i32 to i64. NFC
I believe the result for fp_to_uint_sat is incorrect for this case.
Jordan Rupprecht [Tue, 13 Sep 2022 02:41:06 +0000 (19:41 -0700)]
[test] Increase test assertion for reasonable auxv values.
While auxv keys are usually small, e.g. less than 50, they can sometimes be larger, especially on a downstream kernel where a custom auxv entry is intentionally high to avoid conflicting with the standard lower numbers. This test fails on a system with an auxv value bigger than 1000, but instead of putting this test at that value plus one, it looks like 2023 (i.e. `AT_SUN_CAP_HW2`) is another large one out there. Use 2500 as a limit to still have this be a reasonable "small" check but still allow all known auxv keys.
Semi-related change: this test case prints the auxv dict at the trace level, but only _after_ the assertion fails, making it not print what the offending value is as the test case aborts. Move it earlier so we can see what the "unreasonable" auxv value is.
Yeting Kuo [Mon, 5 Sep 2022 13:57:22 +0000 (21:57 +0800)]
[RISCV] Add assertion of hasVecPolicyOp to catch masked intrinsic without policy operand.
The original code may have incorrect result if there is a masked instruction
without policy operand to make us set its policy to TUMU. The patch adds an
assertion to catch the instruction.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133302
Fangrui Song [Tue, 13 Sep 2022 02:09:08 +0000 (19:09 -0700)]
[ELF] Cache compute_thread_count. NFC
gonglingqin [Tue, 13 Sep 2022 01:38:03 +0000 (09:38 +0800)]
[LoongArch] Add codegen support for ISD::FMA
Differential Revision: https://reviews.llvm.org/D133281
Vincent Lee [Tue, 13 Sep 2022 01:56:44 +0000 (18:56 -0700)]
[llvm-lipo] Fix create-arch-asm test by requiring x86 and aarch64 target
https://reviews.llvm.org/D133729 broke the buildbots because some
don't build with both x86 and aarch64 targets. Adding REQUIRES
to make sure this test only runs when specifying for both arch.
Vincent Lee [Mon, 12 Sep 2022 21:52:08 +0000 (14:52 -0700)]
[llvm-lipo] Support object files with bitcode asm
llvm-lipo crashes when trying to use inputs that contain bitcode asm instructions.
This happens when trying to create universal binaries for LLVM with LTO.
https://reviews.llvm.org/D118575 is a similar change that ran into this same issue, and I'm
mirroring the same change by registering the targets to fix this issue.
Reviewed By: alexander-shaposhnikov, keith
Differential Revision: https://reviews.llvm.org/D133729
Mehdi Amini [Mon, 29 Aug 2022 12:10:15 +0000 (12:10 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in OpFormatGen.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 12:09:27 +0000 (12:09 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in OpDefinitionsGen.cpp (NFC)
Nico Weber [Tue, 13 Sep 2022 01:02:02 +0000 (21:02 -0400)]
[gn build] port
a85e4aa37dec
Rob Suderman [Tue, 13 Sep 2022 00:12:33 +0000 (17:12 -0700)]
[mlir][tosa] Added tosa.reverse folder
Fold cases where a tosa.reverse is a splat or reversing a dim
of length-1.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D133144
Matt Arsenault [Mon, 12 Sep 2022 23:58:57 +0000 (19:58 -0400)]
DeadMachineInstructionElim: Fix typo
Lang Hames [Tue, 13 Sep 2022 00:06:59 +0000 (17:06 -0700)]
[ORC-RT] Update headers for rename of include/orc in
a85e4aa37de.
The ORC runtime include directory was renamed from 'orc' to 'orc_rt' in
a85e4aa37de. Update includes to match.
Jessica Paquette [Mon, 12 Sep 2022 23:50:15 +0000 (16:50 -0700)]
Attempt to pacify buildbots after
7d80b94ca3
Some compilers (like all the ones I've tried) seem to NVRO the
Expected<std::vector<unique_ptr>> but other ones (like some of the bots) seem
to not want to.
Change the return type to Error and pass in the vector as an output parameter
to try and fix things.
Greg Clayton [Fri, 9 Sep 2022 23:45:33 +0000 (16:45 -0700)]
Fix DW_OP_convert to resolve the CU relative offset correctly.
Debugging some DWARF5 binaries was causing errors to appear when DWARFExpression::Evaluate was called:
error: GetDIE for DIE 0x31 is outside of its CU 0x123450
The issue is in the DWARF expression evaluator. Fixed with this.
Differential Revision: https://reviews.llvm.org/D133623
Adrian Prantl [Mon, 12 Sep 2022 23:51:03 +0000 (16:51 -0700)]
Fix make invocation to pass in the correct source file
Lang Hames [Mon, 12 Sep 2022 16:51:04 +0000 (09:51 -0700)]
[ORC-RT] Drop the 'clang_rt.' prefix from the ORC runtime.
The ORC runtime isn't used by clang -- the prefix was just cargo-culted with
the rest of the XRay config when the ORC runtime was introduced. We now want to
make parts of it available for clients to link directly, so this seems like a
good time to fix the name.
Adrian Prantl [Mon, 12 Sep 2022 23:47:46 +0000 (16:47 -0700)]
Force system C++ stdlib in test that forces system clang.
Unfortunately these options are still not upstream.
Adrian Prantl [Mon, 12 Sep 2022 23:36:46 +0000 (16:36 -0700)]
Fix make invocation to pass in the correct source file
Craig Topper [Mon, 12 Sep 2022 23:36:14 +0000 (16:36 -0700)]
[RISCV] Move some vector test into the rvv test directory. NFC
Aiden Grossman [Mon, 12 Sep 2022 23:21:29 +0000 (23:21 +0000)]
[nfc] Refactor SlotIndex::getInstrDistance to better reflect actual functionality
This patch refactors SlotIndex::getInstrDistance to
SlotIndex::getApproxInstrDistance to better describe the actual
functionality of this function. This patch also adds in some additional
comments better documenting the assumptions that this function makes to
increase clarity.
Based on discussion on the LLVM Discourse:
https://discourse.llvm.org/t/odd-behavior-in-slotindex-getinstrdistance/64934/5
Reviewed By: mtrofin, foad
Differential Revision: https://reviews.llvm.org/D133386
Nico Weber [Mon, 12 Sep 2022 23:19:23 +0000 (19:19 -0400)]
[gn build] port
7d80b94ca3ab (llvm-remarkutil)
Vitaly Buka [Mon, 12 Sep 2022 23:13:31 +0000 (16:13 -0700)]
[test][clangd] Another try to fix bots after
72142fbac4
Amara Emerson [Sun, 11 Sep 2022 15:28:44 +0000 (16:28 +0100)]
[GlobalISel] Fix crash when lowering G_SELECT of pointer vectors.
The bit masking lowering only works for vectors of scalars, so for pointer
element types we need to add some casting.
Differential Revision: https://reviews.llvm.org/D133672
Amara Emerson [Sun, 11 Sep 2022 15:14:58 +0000 (16:14 +0100)]
[GlobalISel][Legalizer] Fix minScalarEltSameAsIf to handle p0 element types.
The mutation the action generates tries to change the input type into the
element type of larger vector type. This doesn't work if the larger element
type is a vector of pointers since it creates an illegal mutation between
scalar and pointer types.
Differential Revision: https://reviews.llvm.org/D133671
Mehdi Amini [Mon, 29 Aug 2022 12:08:00 +0000 (12:08 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in AttrOrTypeFormatGen.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 11:59:46 +0000 (11:59 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in TestTilingInterface.cpp (NFC)
Fangrui Song [Mon, 12 Sep 2022 22:56:36 +0000 (15:56 -0700)]
[MinGW] Reject explicit hidden visibility applied to dllexport and hidden/protected applied to dllimport
Hidden visibility is incompatible with dllexport.
Hidden and protected visibilities are incompatible with dllimport.
(PlayStation uses dllexport protected.)
When an explicit visibility attribute applies on a dllexport/dllimport
declaration, report a Frontend error (Sema does not compute visibility).
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D133266
Jessica Paquette [Mon, 12 Sep 2022 22:17:57 +0000 (15:17 -0700)]
Add missing description to llvm-remarkutil doc header
Doc builder caught this:
```
File ".../llvm/src/llvm/docs/conf.py", line 271, in process_rst
name,description = title.split(' - ', 1)
ValueError: not enough values to unpack (expected 2, got 1)
```