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
Yuki Okushi [Sun, 29 May 2022 01:11:10 +0000 (10:11 +0900)]
[clangd] Remove a test with a duplicate of FileCacheTests
FIXME says it should be removed so followed it.
Differential Revision: https://reviews.llvm.org/D126608
Alexander Shaposhnikov [Tue, 31 May 2022 21:40:50 +0000 (21:40 +0000)]
[CodeGen][AArch64] Add support for LDAPR
This diff adds support for LDAPR (RCPC extension)
(https://github.com/llvm/llvm-project/issues/55561).
Differential revision: https://reviews.llvm.org/D126250
Test plan: ninja check-all
wren romano [Tue, 31 May 2022 20:06:10 +0000 (13:06 -0700)]
[mlir][sparse] Improving the FATAL macro
The previous macro definition using `{...}` would fail to compile when the callsite uses a semicolon followed by an else-statement (i.e., `if (...) FATAL(...); else ...;`). Replacing the simple braces with `do{...}while(0)` (n.b., semicolon not included in the macro definition) enables callsites to use the semicolon plus else-statement syntax without problems. The new definition now requires the semicolon at all callsites, but since it was already being called that way nothing changes.
For more explanation, see <https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html>
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D126514
Fangrui Song [Tue, 31 May 2022 21:12:40 +0000 (14:12 -0700)]
[Bazel] Fix typo: startlark=>starlark
Stanislav Mekhanoshin [Tue, 24 May 2022 18:43:00 +0000 (11:43 -0700)]
[AMDGPU] Fix image opcodes GlobalISel on gfx90a.
- Correct flavor of an instruction was not selected.
- GFX90A does not support TFE.
Differential Revision: https://reviews.llvm.org/D126312
LLVM GN Syncbot [Tue, 31 May 2022 21:00:23 +0000 (21:00 +0000)]
[gn build] Port
13e1a653278b
Andrzej Warzynski [Tue, 31 May 2022 20:57:35 +0000 (20:57 +0000)]
[flang][nfc] Fix Windows build
* Breaking change: https://reviews.llvm.org/D125832
* Buildbot failure: https://lab.llvm.org/buildbot/#/builders/172/builds/13123
Sending this without a review - this is a rather straightforward fix.
Michael Jones [Wed, 18 May 2022 23:58:17 +0000 (16:58 -0700)]
[libc] add fprintf and file_writer
This patch adds the file_writer header, which just provides a wrapper
for File->write, as well as fprintf to use it. There are no unit tests
for file_writer since it's too simple to need them, but fprintf does
have a simple test of writing to a file.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D125939
Xiang Li [Thu, 5 May 2022 22:31:22 +0000 (15:31 -0700)]
[HLSL] Enable vector types for hlsl.
Vector types in hlsl is using clang ext_vector_type.
Declaration of vector types is in builtin header hlsl.h.
hlsl.h will be included by default for hlsl shader.
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D125052
Denis Revunov [Tue, 31 May 2022 18:50:59 +0000 (11:50 -0700)]
[BOLT] [AArch64] Handle constant islands spanning multiple functions
Fix BOLT's constant island mapping when a constant island marked by $d
spans multiple functions. Currently, because BOLT only marks the
constant island in the first function where $d is located, if the next
function contains data at its start, BOLT will miss the data and try
to disassemble it. This patch adds code to explicitly go through all
symbols between $d and $x markers and mark their respective offsets as
data, which stops BOLT from trying to disassemble data. It also adds
MarkerType enum and refactors related functions.
Reviewed By: yota9, rafauler
Differential Revision: https://reviews.llvm.org/D126177
Sam McCall [Tue, 31 May 2022 20:29:37 +0000 (22:29 +0200)]
Revert "[clangd] Fix hover crashing on integral or enumeral casts"
This reverts commit
ce5ebf0b9113df8ccaec1bcfd6804fb16cdef69d.
Fails on bots e.g. https://buildkite-cloud.s3.amazonaws.com/logs-by-pipeline/
f8ab115f-a384-49e8-a048-
0f71ab03c5d0/
0181020b-0737-40e5-a05a-
ab198347d8ad/
0181020b-ecbe-4ac6-ad23-
e04c17217893.log?response-content-disposition=inline&response-content-type=text%2Fplain&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQPCP3C7LT7IGTS76%
2F20220531%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220531T202904Z&X-Amz-Expires=600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEDwaCXVzLWVhc3QtMSJGMEQCIEfw6ocELTUWa2mj4reHKLe5OdUmQqVJpPsdZS2wNDhhAiB7qx6Q17HVVY%2BkJZ5hwTQ6b1MkOG4czysfciD9GghJmCrSBAg1EAAaDDAzMjM3OTcwNTMwMyIMgdUfJT4A6wcP2hl2Kq8EefYtGIt0yaiOSfuq05UzI6WcBY9yOOyYCs3%2FJJDvK3jkpiYQhjA1kgVluePIb3P4yOTXs8lv9U6p8HU555Vzvrv1Wg%2FGvx7U398lH8zg%2BqkvEwnpGuRf0pTInPJftg2bgm%2F7l%2BCM6PtW4mRlzjeQ0IoA3AeENqVM35RYtQdh%2BcAZIfV4l7uAySVgwY1yFu0XznuGAVVryZyYcA2cjKkkNE%2F9n2QTo80%2FbZBvoh1bxJqXRbs5WrSnWlIEj3RPX61ir7lDpRNL5tyVlqsv%2BvV01aS%2F9JbM4cNDXZ%2BDwOR1Q%2By1ajJOomuK9Bqm%2Fq8%2B9%2Byo1t8rFSN7I4X%2BGGuicXFQQnIJAkW3zSQlx9SWrf2uDg7cbXL4MukD9cQB5aN8yX85a%2BRcbb5l4%2BOC%2B8UFKMeemUZyEl5PyyJSBnAnzqvKviJPev9Thj9rZeHGEJD9vOkVM%2FG2tOlC7HUxXAE4kuLlAdeKdIOtHz%2Bx8FzRn%2Bgl6EB2nB4kSVLvfgrsrlHS0L0J1zWbN%2F6prqzum%2FEVIhT7Y5fyZRqtygAX2n7iBjQEM3vpF2GTneUI1FlDeQvGPLADFdq7bXSUOt577YOTw1mW1JzqmZljrJeIM40HdMYnuIg3%2FwW8oK6RKGADdW7URPw%2FoFeGKfrnN%2BuDwJKvrRGCpReseGse2sdYIe28rgGHpc5xsp3pzipQDLfW3hTNtM%2FNNuPJjUWZoBRTMr2eMuk2zs2c6jNvnuBTbgXjcdjCbjCX2dmUBjqqAUalggvk2TGoJzTuqAT%2Fj1kz0vnHdmsHY3B9aR2kY501gISXQMKj7l03E7OfFsu4oPzEgmnyQFKcAolRDI%2F7NRmG8HwtP40iTCjflOHIxkJ1%2FnVNqkeyIznUu6zOr589zIjNqFCm74jOfWjj2%2FO8WU4pc%2FRqeBuGzzpQkAIGGxCwsmd3WG8Z8pyMoJomij7c4LO6ep4O0OUESxbXHcIfzUfR6ajPsKFKS9lb&X-Amz-SignedHeaders=host&X-Amz-Signature=96a132be6f99b5cd5cf29f3226115e480508079047bc8639d69c672f1fe9f0c1
wren romano [Tue, 31 May 2022 19:55:01 +0000 (12:55 -0700)]
[mlir][sparse] Factoring out SparseTensorFile class for readSparseTensorShape
The primary goal of this change is to define readSparseTensorShape. Whereas the SparseTensorFile class is merely introduced as a way to reduce code duplication along the way.
Depends On D126106
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D126233
Xiang Li [Fri, 13 May 2022 21:36:27 +0000 (14:36 -0700)]
[HLSL][clang][Driver] Parse target profile early to update Driver::TargetTriple.
This is to avoid err_target_unknown_abi which is caused by use default TargetTriple instead of shader model target triple.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D125585
Georg Kotheimer [Tue, 31 May 2022 19:57:51 +0000 (21:57 +0200)]
[clangd] Fix hover crashing on integral or enumeral casts
When pretty printing the value of an expression, we cannot infer from
the type of the expression the type of the constant that the expression
evaluates to, as the expression might contain a type cast.