Alexey Bataev [Tue, 31 May 2022 20:51:27 +0000 (13:51 -0700)]
[SLP]Fix PR55796: insert point for extractelements from different basic blocks.
Extractelement instructions may come from different basic blocks, need
to take it into account when looking for a last instruction in the
bundle to prevent compiler crash.
Differential Revision: https://reviews.llvm.org/D126777
Stephen Long [Wed, 1 Jun 2022 16:39:32 +0000 (09:39 -0700)]
[MSVC] Fix pragma alloc_text failing for C files
`isExternCContext()` is returning false for functions in C files
Reviewed By: rnk, aaron.ballman
Differential Revision: https://reviews.llvm.org/D126559
Simon Pilgrim [Wed, 1 Jun 2022 16:39:07 +0000 (17:39 +0100)]
[Hexagon] Regenerate store-imm-amode.ll
Simon Pilgrim [Wed, 1 Jun 2022 15:29:05 +0000 (16:29 +0100)]
[AMDGPU] Regenerate fabs.f16.ll tests
Scott Linder [Wed, 25 May 2022 17:17:53 +0000 (17:17 +0000)]
[AMDGPU][NFC] Refactor AMDGPUCallingConv.td
Rename CalleeSavedRegs defs to avoid being overly specific:
* CSR_AMDGPU_AGPRs_32_255 => CSR_AMDGPU_AGPRs
* CSR_AMDGPU_SGPRs_30_31 + CSR_AMDGPU_SGPRs_32_105 => CSR_AMDGPU_SGPRs
* CSR_AMDGPU_SI_Gfx_SGPRs_4_29 + CSR_AMDGPU_SI_Gfx_SGPRs_64_105 =>
CSR_AMDGPU_SI_Gfx_SGPRs
* CSR_AMDGPU_HighRegs => CSR_AMDGPU
* CSR_AMDGPU_HighRegs_With_AGPRs => CSR_AMDGPU_GFX90AInsts
* CSR_AMDGPU_SI_Gfx_With_AGPRs => CSR_AMDGPU_SI_Gfx_GFX90AInsts
Introduce a class RegMask to mark the cases where we use the
CalleeSavedRegs class purely as an expedient way to produce a mask.
Update the names of these masks to not mention "CSR". Other targets also
seem to do this, so a reasonable alternative is to actually update
table-gen to include a new class to do this explicitly, but the current
approach seems harmless so I opted to just make it more explicit.
Reviewed By: arsenm, sebastian-ne
Differential Revision: https://reviews.llvm.org/D109008
Mats Petersson [Mon, 17 Jan 2022 13:54:09 +0000 (13:54 +0000)]
[flang][OpenMP]Make omp.wsloop arguments appear in memory (#1277)
As per issue #1196, the loop induction variable, which is an argument
in the omp.wsloop operation, does not have a memory location, so when
passed to a function or subroutine, the reference to the value is not
a memory location, but the value of the induction variable. The callee
function/subroutine is then trying to dereference memory at address 1
or some other "not a good memory location".
This is fixed by creating a temporary memory location and storing the
value of the induction variable in that.
Test fixes as a consequence of the changed code generated.
Add checking for some of the omp-unstructured.f90 to check for alloca,
store and load operations, to ensure the correct flow. Add a test
for CYCLE inside a omp-do loop.
Also convert to use -emit-fir in the omp-unstructrued, and make
the symbol matching consistent in the omp-wsloop-variable test.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D126711
Matthias Braun [Tue, 31 May 2022 23:49:24 +0000 (16:49 -0700)]
TensorFlowCompile: Add object file to list of sources rather than LINK_LIBS
Differential Revision: https://reviews.llvm.org/D126736
Arjun P [Tue, 31 May 2022 17:17:46 +0000 (18:17 +0100)]
[MLIR][Presburger] Simplex: remove redundant zeroing out of row
This fillRow(..., 0) is redundant because when the size of the tableau is
consistent, the resize always creates a new row, which is zero-initialized.
Also added asserts throughout to ensure the dimensions of the tableau remain
consistent.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D126709
Arjun P [Wed, 1 Jun 2022 15:53:51 +0000 (16:53 +0100)]
[MLIR][Presburger] Matrix: inline trivial accessors
This resolves a comment from https://reviews.llvm.org/D126708
that was previously missed.
Arjun P [Tue, 31 May 2022 16:48:05 +0000 (17:48 +0100)]
[MLIR][Presburger] Move Matrix accessors inline
This gives a 1.5x speedup on the Presburger unittests.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D126708
Mark de Wever [Mon, 30 May 2022 16:22:00 +0000 (18:22 +0200)]
[libc++][format] Fixes string-literal formatting.
Formatting a string-literal had an off-by-one issue where the NUL
terminator became part of the formatted output.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D126665
PeixinQiao [Wed, 1 Jun 2022 15:42:07 +0000 (23:42 +0800)]
[NFC][MLIR] Fix -Wtype-limits warning
Fix the warning: comparison of unsigned expression in ‘>= 0’ is always
true.
Reviewed By: kiranchandramohan, shraiysh
Differential Revision: https://reviews.llvm.org/D126784
Mital Ashok [Wed, 1 Jun 2022 15:34:40 +0000 (11:34 -0400)]
Fix std::has_unique_object_representations for _BitInt types with padding bits
"std::has_unique_object_representations<_BitInt(N)>" was always true,
even if the type has padding bits (since the trait assumes all integer
types have no padding bits). The standard has an explicit note that
this should not hold for types with padding bits.
Differential Revision: https://reviews.llvm.org/D125802
Luke Nihlen [Wed, 1 Jun 2022 15:29:48 +0000 (11:29 -0400)]
Expand definition deprecation warning to include constexpr statements.
Clang currently warns on definitions downgraded to declarations
with a const modifier, but not for a constexpr modifier. This patch
updates the warning logic to warn on both inputs, and adds a test to
check the additional case as well.
See also: https://bugs.chromium.org/p/chromium/issues/detail?id=1284718
Differential Revision: https://reviews.llvm.org/D126664
Craig Topper [Wed, 1 Jun 2022 15:13:49 +0000 (08:13 -0700)]
[RISCV] Fix i64<->f64 and i32<->f32 bitcasts with VLS vectors enabled.
We enable a custom handler to optimize conversions between scalars
and fixed vectors. Unfortunately, the custom handler picks up scalar
to scalar conversions as well. If the scalar types are both legal,
we wouldn't match any of the fixed vector cases and would return SDValue()
causing the LegalizeDAG to expand the bitcast through memory.
This patch fixes this by checking if it's a scalar to scalar conversion
and returns `Op` if both types are legal.
Differential Revision: https://reviews.llvm.org/D126739
PeixinQiao [Wed, 1 Jun 2022 14:40:51 +0000 (22:40 +0800)]
[flang] Add semantic checks for threadprivate and declare target directives
This patch supports the following checks:
```
[5.1] 2.21.2 THREADPRIVATE Directive
The threadprivate directive must appear in the declaration section of
a scoping unit in which the common block or variable is declared.
[5.1] 2.14.7 Declare Target Directive
The directive must appear in the declaration section of a scoping unit
in which the common block or variable is declared.
```
Reviewed By: kiranchandramohan, shraiysh, NimishMishra
Differential Revision: https://reviews.llvm.org/D125767
Denis Antrushin [Wed, 1 Jun 2022 11:58:32 +0000 (18:58 +0700)]
[TwoAddressInstructionPass] Relax assert in statepoint processing.
D124631 added special processing for STATEPOINT instructions.
It appears that assertion added there is too strong. We can get two
tied operands with the same register tied to different defs. If we
hit such case, do not process it in statepoint-specific code and
delegate it to common case.
Simon Pilgrim [Wed, 1 Jun 2022 14:28:11 +0000 (15:28 +0100)]
[ARM] uxtb.ll - adjust armv6 triple so the update_llc_test_checks.py script can be used to regenerate the tests
No need to specify armv6-apple-darwin in these UXTB codegen tests
Simon Pilgrim [Wed, 1 Jun 2022 14:25:58 +0000 (15:25 +0100)]
[ARM][Thumb2] Refresh UXTB16 tests to match optimized IR from instcombine
As discussed on D77804, instcombine will have already performed a similar SimplifyMultipleUseDemandedBits call which will break the UXTB16 pattern that was being match in these DAG tests
I've updated the existing tests so that it match the instcombine IR (with a suitable FIXME) and added an equivalent test pattern suggested by @dmgreen
Balazs Benics [Wed, 1 Jun 2022 14:12:54 +0000 (16:12 +0200)]
[analyzer] Fix wrong annotation of PointerToMemberData
Unfortunately I don't have a reproducer for this.
Reported by @mikaelholmen!
Differential Revision: https://reviews.llvm.org/D126198
Simon Pilgrim [Wed, 1 Jun 2022 14:09:37 +0000 (15:09 +0100)]
[X86] LowerVSETCC - merge getConstant() calls with flipped/unflipped sign masks. NFCI.
Sanjay Patel [Wed, 1 Jun 2022 13:46:29 +0000 (09:46 -0400)]
[x86] fix miscompile from wrongly identified fneg
We may need to peek through a bitcast when identifying an fneg idiom
via its pool constant, but we can't allow a different-sized constant
in that match.
This is noted in issue #55758 with an example that needs fast-math,
but as the test here shows, this has potential to miscompile more
generally (no fast-math required).
Differential Revision: https://reviews.llvm.org/D126775
Guillaume Chatelet [Wed, 1 Jun 2022 13:53:36 +0000 (13:53 +0000)]
[libc] fix typo in BUILD.bazel feature
Matt Arsenault [Wed, 27 Apr 2022 00:35:01 +0000 (20:35 -0400)]
CodeGen: Move getAddressSpaceForPseudoSourceKind into TargetMachine
Avoid the dependency on TargetInstrInfo, which depends on the subtarget
and therefore the individual function.
Currently AMDGPU is constructing PseudoSourceValue instances in MachineFunctionInfo.
In order to facilitate copying MachineFunctionInfo, we need to stop allocating these
there. Alternatively we could allow targets to subclass PseudoSourceValueManager,
and allocate them similarly to MachineFunctionInfo.
Sanjay Patel [Wed, 1 Jun 2022 12:05:35 +0000 (08:05 -0400)]
[x86] add test for mismatched fneg; NFC
issue #55758
Guillaume Chatelet [Wed, 1 Jun 2022 11:57:11 +0000 (11:57 +0000)]
[libc] Apply no-builtin everywhere, remove unnecessary flags
Note, this is a re-submission of D125894 with `features = ["-header_modules"]`
added to the main BUILD.bazel file.
Some functions like `stpncpy` are implemented in terms of `memset` but are not
currently using `-fno-builtin-memset`. This is somewhat hidden by the fact that
we use `-ffreestanding` globally and that `-ffreestanding` implies
`-fno-builtin` for Clang.
This patch also removes `-mllvm -combiner-global-alias-analysis` that is Clang
specific and that does not bring substantial gains on modern processors.
Also we keep `-mllvm --tail-merge-threshold=0` for aarch64 in CMakeLists.txt
but we omit it in the Bazel config. This is because Bazel consumes the source
files directly and so it can use PGO to take optimal decisions locally.
Differential Revision: https://reviews.llvm.org/D126773
Mikhail Goncharov [Wed, 1 Jun 2022 13:30:10 +0000 (15:30 +0200)]
Fix potentially uninitialized memory
For https://github.com/llvm/llvm-project/commit/
7d76d6095880f34914d85d876b260cc4a4ea640d
Alexander Kornienko [Wed, 1 Jun 2022 12:27:14 +0000 (14:27 +0200)]
Revert "[LAA] Initial support for runtime checks with pointer selects."
This reverts commit
5890b30105999a137e72e42f3760bebfd77001ca as per discussion
on the review thread: https://reviews.llvm.org/D114487#3547560.
LLVM GN Syncbot [Wed, 1 Jun 2022 13:19:42 +0000 (13:19 +0000)]
[gn build] Port
a0dcbe45bd83
LLVM GN Syncbot [Wed, 1 Jun 2022 13:19:41 +0000 (13:19 +0000)]
[gn build] Port
2011052150e1
Matt Arsenault [Wed, 20 Apr 2022 15:37:53 +0000 (11:37 -0400)]
llvm-reduce: Add reduction pass to remove regalloc hints
I'm a bit confused by what's actually stored for the allocation
hints. The MIR parser only handles the "simple" case where there's a
single hint. I don't really understand the assertion in
clearSimpleHint, or under what circumstances there are multiple hint
registers.
Matt Arsenault [Tue, 19 Apr 2022 20:42:27 +0000 (16:42 -0400)]
llvm-reduce: Add pass to reduce MIR instruction flags
Florian Hahn [Wed, 1 Jun 2022 12:30:32 +0000 (13:30 +0100)]
[LAA] Remove unused RuntimeCheckingPtrGroup constructor (NFC).
The constructor is not used. Remove it.
Alexander Kornienko [Wed, 1 Jun 2022 10:27:53 +0000 (12:27 +0200)]
Revert "[InstCombine] Combine instructions of type or/and where AND masks can be combined."
This reverts commit
ec4adf1f6c333d3d36663d8f763c0896407f1b61. The commit causes
clang to hang on a certain input:
```
$ cat q.cc
int f(int a, int b) {
int c = ((unsigned char)(a >> 23) & 925);
if (a)
c = (a >> 23 & b) | ((unsigned char)(a >> 23) & 925) | (b >> 23 & 157);
return c;
}
$ time ./clang-15-10515 --target=x86_64--linux-gnu -O1 -c q.cc
^C
real 0m45.072s
user 0m0.025s
sys 0m0.099s
```
Kiran Chandramohan [Wed, 1 Jun 2022 11:48:20 +0000 (11:48 +0000)]
[Flang] Lower the infinite do loop
The basic infinite loop is lowered to a branch to the body of the
loop, and the body containing a back edge as its terminator.
Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D126697
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Haojian Wu [Wed, 1 Jun 2022 11:42:46 +0000 (13:42 +0200)]
[pseudo] Build inc files when cxx.bnf changes.
Add the cxx.bnf file as a dependency of custom gen commands, so that the
inc files can be rebuilt when cxx.bnf changes.
Simon Pilgrim [Wed, 1 Jun 2022 11:31:18 +0000 (12:31 +0100)]
[X86] Fix typo in extraction type introduced in rGed0303aa2251e4484a2b4ff7f236c9f7cdfb2092
It doesn't look like we have test coverage for this at the moment :(
Christian Sigg [Wed, 1 Jun 2022 11:10:28 +0000 (13:10 +0200)]
Nikita Popov [Wed, 1 Jun 2022 10:54:58 +0000 (12:54 +0200)]
[llvm-c-test] Always set opaque pointers mode
Avoid a behavior change when opaque pointers are enabled by default.
Sheng [Wed, 1 Jun 2022 10:46:38 +0000 (18:46 +0800)]
[NFC] fix typo
Sander de Smalen [Mon, 30 May 2022 11:16:03 +0000 (13:16 +0200)]
[Clang] NFCI: Add a new bit HasExtraBitfields to FunctionType.
The FunctionTypeExtraBitfields is currently only available when the
ExceptionSpecificationType == Dynamic, which means that there is no other
way to use or extend the FunctionTypeExtraBitfields independently of the
exception specification type.
This patch adds a new field HasExtraBitfields to specify
whether the prototype has trailing ExtraBitfields.
This patch intends to be NFC and is required for future extension
and use of the ExtraBitfields struct.
Reviewed By: aaron.ballman, erichkeane
Differential Revision: https://reviews.llvm.org/D126642
Christian Sigg [Wed, 1 Jun 2022 10:06:28 +0000 (12:06 +0200)]
Fix bazel build after
59b273a166b9d1165015b5cf10c21641cc01d682.
Reviewed By: tpopp
Differential Revision: https://reviews.llvm.org/D126765
Simon Pilgrim [Wed, 1 Jun 2022 09:38:48 +0000 (10:38 +0100)]
[X86] combineConcatVectorOps - add support for concatenation VSELECT/BLENDV nodes
If the LHS/RHS selection operands can be cheaply concatenated back together then replace 2 x 128-bit selection nodes with 1 x 256-bit node
Addresses the regression introduced in the bug fix from rGd5af6a38082b39ae520a328e44dc29ebcb036bb2
Florian Hahn [Wed, 1 Jun 2022 09:41:04 +0000 (10:41 +0100)]
[VPlan] Use region for each loop in native path.
This patch updates the VPlan native path to use VPRegionBlocks for all
loops in a loop nest. Up to now, only the outermost loop used a region.
This is a step towards unifying both paths and keep things consistent
between them. It also prepares various code-gen parts for modeling the
pre-header in the inner loop vectorizer (D121624).
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D123005
Andrew Ng [Tue, 31 May 2022 14:51:13 +0000 (15:51 +0100)]
[LSAN] Fix up LSAN weak symbols for Windows
Differential Revision: https://reviews.llvm.org/D126703
Nicolas Vasilache [Wed, 1 Jun 2022 09:05:52 +0000 (09:05 +0000)]
[mlir][SCF] Add parallel abstraction on tensors.
This revision adds `scf.foreach_thread` and other supporting abstractions
that allow connecting parallel abstractions and tensors.
Discussion is available [here](https://discourse.llvm.org/t/rfc-parallel-abstraction-for-tensors-and-buffers/62607).
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126555
lewuathe [Wed, 1 Jun 2022 07:25:19 +0000 (09:25 +0200)]
[mlir][complex] Lowering complex.tanh to standard
Lowering complex.tanh to standard dialects including math, arith.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D126521
Guillaume Chatelet [Tue, 31 May 2022 08:09:34 +0000 (08:09 +0000)]
[libc][mem*] Address facility + test enum support
This patch is a subpart of D125768 intented to make the review easier.
The `Address` struct represents a pointer but also adds compile time knowledge
like alignment or temporal/non-temporal that helps with downstream instruction
selection.
Differential Revision: https://reviews.llvm.org/D125966
Nicolas Vasilache [Wed, 1 Jun 2022 09:04:20 +0000 (09:04 +0000)]
Revert "[mlir][SCF] Add parallel abstraction on tensors."
This reverts commit
9b7193f852874a035d9ede1f7464c9fc5b7dca7a.
This is an older branch that was committed by mistake and does not include addressed review comments, an updated version will come next.
Nicolas Vasilache [Fri, 27 May 2022 16:12:44 +0000 (16:12 +0000)]
[mlir][SCF] Add parallel abstraction on tensors.
This revision adds `scf.foreach_thread` and other supporting abstractions
that allow connecting parallel abstractions and tensors.
Discussion is available [here](https://discourse.llvm.org/t/rfc-parallel-abstraction-for-tensors-and-buffers/62607).
serge-sans-paille [Tue, 31 May 2022 13:05:13 +0000 (15:05 +0200)]
[Clang][Driver] More explicit message when failing to find sanitizer resource file
Compiler-rt doesn't provide support file for cfi on s390x ad ppc64le (at least).
When trying to use the flag, we get a file error.
This is an attempt at making the error more explicit.
Differential Revision: https://reviews.llvm.org/D120484
Andrzej Warzynski [Wed, 1 Jun 2022 08:45:29 +0000 (08:45 +0000)]
[flang] Make sure that `flang` is also installed
This patch makes sure that `flang` (symlink to `flang-to-external-fc`)
is installed alongside other Flang tools. Fixes build failures in
clang-aarch64-full-2stage [1] introduced after merging
https://reviews.llvm.org/D125832.
[1] https://lab.llvm.org/buildbot/#/builders/179/builds/3799
Differential Revision: https://reviews.llvm.org/D126760
Nikita Popov [Tue, 10 May 2022 10:07:20 +0000 (12:07 +0200)]
[ValueTracking] Enable -branch-on-poison-as-ub by default
Now that SimpleLoopUnswitch and other transforms no longer introduce
branch on poison, enable the -branch-on-poison-as-ub option by
default. The practical impact of this is mostly better flag
preservation in SCEV, and some freeze instructions no longer being
necessary.
Differential Revision: https://reviews.llvm.org/D125299
Guillaume Chatelet [Wed, 1 Jun 2022 08:41:56 +0000 (08:41 +0000)]
[libc] Add support for enum in EXPECT_EQ
LLVM GN Syncbot [Wed, 1 Jun 2022 08:37:55 +0000 (08:37 +0000)]
[gn build] Port
d157019482e1
David Spickett [Tue, 31 May 2022 10:10:12 +0000 (10:10 +0000)]
[libcxx] Temporarily skip Arm configs
The machine hosting these agents will be down
for maintenance June 2nd.
We (Linaro) will remove this once the agents are back online.
Differential Revision: https://reviews.llvm.org/D126688
Florian Hahn [Wed, 1 Jun 2022 08:32:59 +0000 (09:32 +0100)]
[VPlan] Remove unused native utilities incompatible with nested regions.
The implementations of VPlanDominatorTree, VPlanLoopInfo and VPlanPredicator
are all incompatible with modeling loops in VPlans as region without
explicit back-edges.
Those pieces are not actively used and only exercised by a few gtest
unit tests. They are at the moment blocking progress towards unifying
the native and inner-loop vectorizer paths in D121624 and D123005.
I think we should not block forward progress on unused pieces of code,
so this patch removes the utilities for now. The plan is to re-introduce
them as needed in a way that is compatible with the unified VPlan scheme
used in both the inner loop vectorizer and the native path.
Reviewed By: sguggill
Differential Revision: https://reviews.llvm.org/D123017
Martin Storsjö [Sat, 28 May 2022 21:44:07 +0000 (00:44 +0300)]
[Windows] Don't try to wildcard expand paths starting with \\?\
Paths that start with `\\?\` are absolute paths, and aren't expected
to be used with wildcard expressions.
Previously, the `?` at the start of the path triggered the condition
for a potential wildcard, which caused the path to be split and
reassembled. In builds with `LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON`,
this caused a path like e.g. `\\?\D:\tmp\hello.cpp` to be reassembled
into `\\?\D:\tmp/hello.cpp` which isn't a valid path (as such
absolute paths must use backslashes consistently).
This fixes https://github.com/mstorsjo/llvm-mingw/issues/280.
I'm not sure if there's any straightforward way to add a test
for this case, unfortunately.
Differential Revision: https://reviews.llvm.org/D126675
Martin Storsjö [Thu, 25 Nov 2021 22:34:47 +0000 (00:34 +0200)]
[MC] [Win64EH] Check that the SEH unwind opcodes match the actual instructions
It's a fairly common issue that the generating code incorrectly marks
instructions as narrow or wide; check that the instruction lengths
add up to the expected value, and error out if it doesn't. This allows
catching code generation bugs.
Also check that prologs and epilogs are properly terminated, to
catch other code generation issues.
Differential Revision: https://reviews.llvm.org/D125647
Martin Storsjö [Fri, 26 Nov 2021 08:22:36 +0000 (10:22 +0200)]
[MC] [Win64EH] Optimize the ARM unwind info
Use the packed unwind info format if possible; otherwise try to
create a packed epilog.
Differential Revision: https://reviews.llvm.org/D125646
Martin Storsjö [Thu, 11 Nov 2021 10:06:49 +0000 (12:06 +0200)]
[ARM] [MC] Add support for writing ARM WinEH unwind info
This includes .seh_* directives for generating it from assembly.
It is designed fairly similarly to the ARM64 handling.
For .seh_handler directives, such as
".seh_handler __C_specific_handler, @except" (which is supported
on x86_64 and aarch64 so far), the "@except" bit doesn't work in
ARM assembly, as '@' is used as a comment character (on all current
platforms).
Allow using '%' instead of '@' for this purpose. This convention
is used by GAS in similar contexts already,
e.g. [1]:
Note on targets where the @ character is the start of a comment
(eg ARM) then another character is used instead. For example the
ARM port uses the % character.
In practice, this unfortunately means that all such .seh_handler
directives will need ifdefs for ARM.
Contrary to ARM64, on ARM, it's quite common that we can't evaluate
e.g. the function length at this point, due to instructions whose
length is finalized later. (Also, inline jump tables end with
a ".p2align 1".)
If unable to to evaluate the function length immediately, emit
it as an MCExpr instead. If we'd implement splitting the unwind
info for a function (which isn't implemented for ARM64 yet either),
we wouldn't know whether we need to split it though.
Avoid calling getFrameIndexOffset() on an unset
FuncInfo.UnwindHelpFrameIdx, to avoid triggering asserts in the
preexisting testcase CodeGen/ARM/Windows/wineh-basic.ll. (Once
MSVC exception handling is fully implemented, those changes
can be reverted.)
[1] https://sourceware.org/binutils/docs/as/Section.html#Section
Differential Revision: https://reviews.llvm.org/D125645
Martin Storsjö [Wed, 18 May 2022 07:32:47 +0000 (10:32 +0300)]
[MC] [Win64EH] Wrap the epilog instructions in a struct. NFC.
For ARM SEH, the epilogs will need a little more associated data than
just the plain list of opcodes.
This is a preparatory refactoring for D125645.
Differential Revision: https://reviews.llvm.org/D125879
Diana Picus [Tue, 31 May 2022 10:55:56 +0000 (10:55 +0000)]
[flang] Upstream lowering of real control loops
Upstream the code for handling loops with real control variables from
the fir-dev branch at
https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev/
Also add a test.
Loops with real-valued control variables are always lowered to
unstructured loops. The real-valued control variables are handled the
same as integer ones, the only difference is that they need to use
floating point instructions instead of the integer equivalents.
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Balázs Kéri [Wed, 1 Jun 2022 07:10:18 +0000 (09:10 +0200)]
[clang][ASTImporter] Add support for import of UsingPackDecl.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D125986
Ping Deng [Wed, 1 Jun 2022 07:31:02 +0000 (07:31 +0000)]
[DAGCombine][NFC] Add braces to 'else' to match braced 'if'
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D126624
Benjamin Kramer [Wed, 1 Jun 2022 07:33:02 +0000 (09:33 +0200)]
[mlir][complex] Remove unused variables. NFC.
Dossay Oryspayev [Tue, 31 May 2022 17:09:59 +0000 (22:39 +0530)]
[flang][OpenMP] Added parser support for defaultmap (OpenMP 5.0)
This patch adds parser support for defaultmap clause [OpenMP 5.0].
Reviewed By: kiranchandramohan, peixin, shraiysh
Differential Revision: https://reviews.llvm.org/D124190
lewuathe [Wed, 1 Jun 2022 07:12:18 +0000 (09:12 +0200)]
[mlir][complex] Add tan op for complex dialect
Add tangent operation for complex dialect. This is the follow-up change of https://reviews.llvm.org/D126521
Differential Revision: https://reviews.llvm.org/D126685
Fangrui Song [Wed, 1 Jun 2022 07:18:54 +0000 (00:18 -0700)]
[ELF][test] Change some tests to use SHF_COMPRESSED instead of legacy .zdebug
Gabor Marton [Thu, 26 May 2022 15:41:51 +0000 (17:41 +0200)]
[analyzer] Handle SymbolCast in SValBuilder
Make the SimpleSValBuilder to be able to look up and use a constraint
for an operand of a SymbolCast, when the operand is constrained to a
const value.
This part of the SValBuilder is responsible for constant folding. We
need this constant folding, so the engine can work with less symbols,
this way it can be more efficient. Whenever a symbol is constrained with
a constant then we substitute the symbol with the corresponding integer.
If a symbol is constrained with a range, then the symbol is kept and we
fall-back to use the range based constraint manager, which is not that
efficient. This patch is the natural extension of the existing constant
folding machinery with the support of SymbolCast symbols.
Differential Revision: https://reviews.llvm.org/D126481
Peixin-Qiao [Wed, 1 Jun 2022 06:38:46 +0000 (14:38 +0800)]
[flang] Add semantic check for named constant as function result
Similar to procedure argument, the function result cannot be one
named constant.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D126693
owenca [Thu, 26 May 2022 23:07:53 +0000 (16:07 -0700)]
[Docs] Clarify the guideline on omitting braces
While working on a clang-format option RemoveBracesLLVM that removes
braces following the guideline, we were unsure about what to do with
the braces of do-while loops. The ratio of using to omitting the
braces is about 4:1 in the llvm-project source, so it will help to
add an example to the guideline.
Also cleans up the original examples including making the nested if
example more targeted on avoiding potential dangling else situations.
Differential Revision: https://reviews.llvm.org/D126512
Endre Fülöp [Sun, 22 May 2022 21:28:10 +0000 (23:28 +0200)]
[clang-tidy] Extend cert-oop57-cpp to check non-zero memset values
Clang Tidy check cert-oop57-cpp now checks for arbitrary-valued
arguments in memset expressions containing non-trivially
default-constructible instances. Previously it only checked literal 0 values.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D126186
Endre Fülöp [Wed, 1 Jun 2022 06:21:16 +0000 (08:21 +0200)]
Revert "[clang-tidy] Extend cert-oop57-cpp to check non-zero memset values"
Revert to fix a ReleaseNote issue.
This reverts commit
d33f199910fa02cf7072f3227913e670c98d03a9.
Endre Fülöp [Sun, 22 May 2022 21:28:10 +0000 (23:28 +0200)]
[clang-tidy] Extend cert-oop57-cpp to check non-zero memset values
Clang Tidy check cert-oop57-cpp now checks for arbitrary-valued
arguments in memset expressions containing non-trivially
default-constructible instances. Previously it only checked literal 0 values.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D126186
wangpc [Wed, 1 Jun 2022 05:48:57 +0000 (13:48 +0800)]
[RISCV] Set target-abi explicitly to reduce codegen results
As mentioned in D125947, we can reduce codegen results by
adding an explicit hard single-float ABI.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D126640
Fangrui Song [Wed, 1 Jun 2022 05:39:43 +0000 (22:39 -0700)]
[AArch64][test] Replace -march with -mtriple for llc RUN lines
-march is error-prone: -march inherits the OS and environment from the default
target triple. Use -mtriple which is more common.
Fangrui Song [Wed, 1 Jun 2022 05:35:07 +0000 (22:35 -0700)]
[X86][test] Remove unneeded -mtriple from llc RUN lines
Tue Ly [Sun, 8 May 2022 17:45:40 +0000 (13:45 -0400)]
[libc] Implement FLAGS option for generating all combinations for targets.
Add FLAGS option for add_header_library, add_object_library,
add_entrypoint_object, and add_libc_unittest.
In general, a flag is a string provided for supported functions under the
multi-valued option `FLAGS`. It should be one of the following forms:
FLAG_NAME
FLAG_NAME__NO
FLAG_NAME__ONLY
A target will inherit all the flags of its upstream dependency.
When we create a target `TARGET_NAME` with a flag using (add_header_library,
add_object_library, ...), its behavior will depend on the flag form as follow:
- FLAG_NAME: The following 2 targets will be generated:
`TARGET_NAME` that has `FLAG_NAME` in its `FLAGS` property.
`TARGET_NAME.__NO_FLAG_NAME` that depends on `DEP.__NO_FLAG_NAME` if
`TARGET_NAME` depends on `DEP` and `DEP` has `FLAG_NAME` in its `FLAGS`
property.
- FLAG_NAME__ONLY: Only generate 1 target `TARGET_NAME` that has `FLAG_NAME`
in its `FLAGS` property.
- FLAG_NAME__NO: Only generate 1 target `TARGET_NAME.__NO_FLAG_NAME` that
depends on `DEP.__NO_FLAG_NAME` if `DEP` is in its DEPENDS list and `DEP`
has `FLAG_NAME` in its `FLAGS` property.
To show all the targets generated, pass SHOW_INTERMEDIATE_OBJECTS=ON to cmake.
To show all the targets' dependency and flags, pass
`SHOW_INTERMEDIATE_OBJECTS=DEPS` to cmake.
To completely disable a flag FLAG_NAME expansion, set the variable
`SKIP_FLAG_EXPANSION_FLAG_NAME=TRUE`.
Reviewed By: michaelrj, sivachandra
Differential Revision: https://reviews.llvm.org/D125174
Reid Kleckner [Wed, 1 Jun 2022 04:15:46 +0000 (21:15 -0700)]
Revert "[Bazel][GN] Reuse the GN LLVM config file generation code"
This reverts commit
e2ee8bf9818189b900e65d6ea8f1ae6fc75455ce.
This change is beyond my ability to integrate into Google's internal
build configuration tonight.
Zi Xuan Wu (Zeson) [Wed, 1 Jun 2022 02:42:33 +0000 (10:42 +0800)]
[CSKY] Fix error of underestimated function size by save/restore R15(LR) when we use BSR far jump.
In CSKYConstantIslands, when fix up an unconditional branch(CSKY::BR32) whose destination is
too far away to fit in its displacement field, and if the R15(LR) register has been
spilled in the prologue, then we can use BSR to implement a far jump. So we need estimate function
size, and spill R15(LR) when the function size >= unconditional branch(CSKY::BR32) can reach.
EstimateFunctionSizeInBytes function adds up all instructions and constant pool entries(each entry is 4 bytes).
Fangrui Song [Wed, 1 Jun 2022 02:55:50 +0000 (19:55 -0700)]
[Hexagon][test] Fix some tests on linux-musl
-march=hexagon uses the default target triple and changes the arch part of
hexagon. On linux-musl, this essentially becomes hexagon-unknown-linux-musl
which has different code generation. Use -mtriple instead.
Link: https://github.com/llvm/llvm-project/issues/48936
Nemanja Ivanovic [Wed, 1 Jun 2022 02:49:28 +0000 (21:49 -0500)]
[PowerPC] Remove const from paired vector store builtins
For some reason, we implemented the xx_stxvp intrinsics
to require a const pointer. This absolutely doesn't make
sense for a store. Remove the const from the definition.
Reid Kleckner [Fri, 27 May 2022 19:21:33 +0000 (12:21 -0700)]
[Bazel][GN] Reuse the GN LLVM config file generation code
Currently, the Bazel build uses static, checked in [llvm-]config.h files
in combination with global macro definitions to mimic CMake's generated
headers. This change reuses the write_cmake_config.py script from the GN
build to generate the headers from source in the same way. The purpose
is to ensure that the Bazel build stays up to date with any changes to
the CMake config files. The write_cmake_config.py script has good error
checking to ensure that unneeded, stale variables are not passed, and
that any missing variables are reported as errors.
I tried to closely follow the logic in the GN build here:
llvm/utils/gn/secondary/llvm/include/Config/BUILD.gn
The duplication between this file and config.bzl is significant, and we
could consider going further, but I'd like to hold off on it for now.
The GN build changes are to move the write_cmake_config.py script up to
//llvm/utils/write_cmake_config.py, and update the paths accordingly.
The next logical change is to generate Clang's config.h header.
Differential Revision: https://reviews.llvm.org/D126581
Reid Kleckner [Wed, 1 Jun 2022 02:39:35 +0000 (19:39 -0700)]
[Bazel] Add missing dep after mlgo test change
f46dd19b480496d2ba0a57d12935882e530f2b93
Yaxun (Sam) Liu [Tue, 31 May 2022 15:17:39 +0000 (11:17 -0400)]
[HIP] Pass -Xoffload-linker option to device linker
Reuse -Xoffload-linker option for HIP toolchain.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D126704
Yaxun (Sam) Liu [Mon, 30 May 2022 19:21:14 +0000 (15:21 -0400)]
[HIP] Fix static lib name on windows
clang by default assumes static library name to be xxx.lib
when -lxxx is specified on Windows with MSVC environment,
instead of libxxx.a.
This patch fixes static device library unbundling for that.
It falls back to libxxx.a if xxx.lib is not found.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D126681
Phoebe Wang [Wed, 1 Jun 2022 01:24:34 +0000 (09:24 +0800)]
[X86] Add support for `-mharden-sls=[none|all|return|indirect-jmp]`
The patch addresses the feature request from https://github.com/ClangBuiltLinux/linux/issues/1633. The implementation borrows a lot from aarch64.
Reviewed By: nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D126137
Chenbing Zheng [Wed, 1 Jun 2022 01:29:05 +0000 (09:29 +0800)]
[InstCombine] [NFC] remove useless TODO
Alexander Yermolovich [Tue, 31 May 2022 23:56:57 +0000 (16:56 -0700)]
[BOLT][DWARF] Fix dwarf5-debug-line test
After D126484, order in .debug-line-str and .debug-line is different. Changed
test accordingly.
Differential Revision: https://reviews.llvm.org/D126733
Mariusz Borsa [Fri, 27 May 2022 23:15:07 +0000 (16:15 -0700)]
[Sanitizers][Darwin] Deprecate SANITIZER_MAC - fail compilation if encountered
Previous couple commits replaced SANITIZER_MAC with SANITIZER_APPLE in bulk.
This change will prompt anyone still trying to use SANITIZER_MAC to rename.
Differential Revision: https://reviews.llvm.org/D126577
Xiang Li [Tue, 10 May 2022 21:22:29 +0000 (14:22 -0700)]
[HLSL] add -D option for dxc mode.
Create dxc_D as alias to option D which Define <macro> to <value> (or 1 if <value> omitted).
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D125338
Maksim Panchenko [Wed, 23 Feb 2022 03:06:25 +0000 (19:06 -0800)]
[BOLT] Add new class for symbolizing X86 instructions
Summary:
While disassembling instructions, we need to replace certain immediate
operands with symbols. This symbolizing process relies on reading
relocations against instructions. However, some X86 instructions can
have multiple immediate operands and up to two relocations against
them. Thus, correctly matching a relocation to an operand is not
always possible without knowing the operand offset within the
instruction.
Luckily, LLVM provides an interface for passing the required info from
the disassembler via a virtual MCSymbolizer class. Creating a
target-specific version allows a precise matching of relocations to
operands.
This diff adds X86MCSymbolizer class that performs X86-specific
symbolizing (currently limited to non-branch instructions).
Reviewers: yota9, Amir, ayermolo, rafauler, zr33
Differential Revision: https://reviews.llvm.org/D120928
Zakk Chen [Mon, 30 May 2022 05:31:12 +0000 (22:31 -0700)]
[RISCV][NFC] Rename variables in rvv intrinsics related files.
This patch does the same thing as D125886 did.
- Use `Overloaded` rather than `Mangled`.
- Use `Prototype` or `Desc` rather than `Seq`, it's not just a string
sequence.
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D126634
wren romano [Tue, 31 May 2022 21:39:34 +0000 (14:39 -0700)]
[mlir][sparse] Using x-macros in the function-suffix functions
By defining the `{primary,overhead}TypeFunctionSuffix` functions via the same x-macros used to generate the runtime library's functions themselves, this helps avoid bugs from typos or things getting out of sync.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D126720
Mircea Trofin [Tue, 3 May 2022 23:10:07 +0000 (16:10 -0700)]
[mlgo] Incrementally update FunctionPropertiesInfo during inlining
Re-computing FunctionPropertiesInfo after each inlining may be very time
consuming: in certain cases, e.g. large caller with lots of callsites,
and when the overall IR doesn't increase (thus not tripping a size bloat
threshold).
This patch addresses this by incrementally updating
FunctionPropertiesInfo.
Differential Revision: https://reviews.llvm.org/D125841
Eli Friedman [Tue, 31 May 2022 23:51:03 +0000 (16:51 -0700)]
[LoopIdiom] Fix bailout for aliasing in memcpy transform.
Commit
dd5991cc modified the aliasing checks here to allow transforming
a memcpy where the source and destination point into the same object.
However, the change accidentally made the code skip the alias check for
other operations in the loop.
Instead of completely skipping the alias check, just skip the check for
whether the memcpy aliases itself.
Differential Revision: https://reviews.llvm.org/D126486
Jim Ingham [Wed, 1 Jun 2022 00:22:18 +0000 (17:22 -0700)]
Fix a copy-paste error in "br com add -s py -o 'some_python' BKPT_NAME"
The function that was supposed to iterate over all the breakpoints sharing
BKPT_NAME stopped after the first one because of a reversed "if success"
condition.
Differential Revision: https://reviews.llvm.org/D126730
Adrian Prantl [Tue, 31 May 2022 20:54:58 +0000 (13:54 -0700)]
Adapt LLDB for D120540.
In https://reviews.llvm.org/D120540 the -fcxx-modules flag changed
semantics and specifying it explicitly seems to no longer be what we
want here.
Yuki Okushi [Fri, 27 May 2022 10:49:41 +0000 (19:49 +0900)]
[test] Remove an outdated FIXME
rG6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292 removed the backticks and this FIXME comment is no longer necessary.
Differential Revision: https://reviews.llvm.org/D126528