Commit Graph

424444 Commits

Author SHA1 Message Date
Serge Pavlov 5537b22ccb Make CompoundStmtBitfields::NumStmts not a bit-field
Number of statements in CompoundStmt is kept in a bit-field of the common
part of Stmt. The field has 24 bits for the number. To allocate a new
bit field (as attempted in https://reviews.llvm.org/D123952), this
number must be reduced, maximal number of statements in a compound
statement becomes smaller. It can result in compilation errors of some
programs.

With this change the number of statements is kept in a field of type
'unsigned int' rather than in bit-field. To make room in CompoundStmtBitfields
LBraceLoc is moved to fields of CompoundStmt.

Differential Revision: https://reviews.llvm.org/D125635
2022-05-20 14:20:09 +07:00
Peixin-Qiao 870f4421ac [flang][OpenMP] Fix the types of worksharing-loop variables
The types of lower bound, upper bound, and step are converted into the
type of the loop variable if necessary. OpenMP runtime requires 32-bit
or 64-bit loop variables. OpenMP loop iteration variable cannot have
more than 64 bits size and will be narrowed.

This patch is part of upstreaming code from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project. (#1256)

Co-authored-by: kiranchandramohan <kiranchandramohan@gmail.com>

Reviewed By: kiranchandramohan, shraiysh

Differential Revision: https://reviews.llvm.org/D125740
2022-05-20 15:16:03 +08:00
jacquesguan 8fc4fcecb8 [RISCV] Add VL patterns for vector widening floating-point fused multiply-add instructions.
This patch adds VL patterns for vector widening floating-point fused multiply-add instructions to support fixed length vector type.

Differential Revision: https://reviews.llvm.org/D124505
2022-05-20 06:56:48 +00:00
eopXD da201aa424 [RISCV][NFC] Remove `*=` operator for LMULType
LMULType always manipulate on Log2LMUL, let all manipulations go
through LMULType::MulLog2LMUL.

Reviewed By: khchen

Differential Revision: https://reviews.llvm.org/D126042
2022-05-19 23:47:44 -07:00
Ivan Kosarev 86803008ea [MIR] Provide location of extra instruction operand when diagnosing it.
Also resolves misspelled FileCheck directives caught with D125604.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D125965
2022-05-20 05:56:25 +01:00
Jonas Devlieghere b9a30b69d8
[lldb] Update test_software_breakpoint_set_and_remove_work for AS
On Apple Silicon the platform arch is arm64 rather than AArch64.
2022-05-19 21:40:20 -07:00
Jonas Devlieghere ea4864007c
[lldb] Fix 'ptsname_r' is only available on macOS 10.13.4 or newer
A deployment target less than 10.13.4 causes an error saying that
'ptsname_r' is only available on macOS 10.13.4 or newer. The current
logic only checks if the symbol is available and doesn't account for the
deployment target. This patch fixes that by adding an availability
check.

Differential revision: https://reviews.llvm.org/D125995
2022-05-19 21:39:52 -07:00
Philip Reames 3e5b1e9ccf [RISCV] Add test showing codegen for unaligned loads and stores of scalar types 2022-05-19 21:07:46 -07:00
Julian Lettner ec563c5a90 [ASan] Add sleep_before_init flag
Also do a little bit of refactoring instead of just copy&paste.

Differential Revision: https://reviews.llvm.org/D126037
2022-05-19 20:41:43 -07:00
Chenbing Zheng cf348f6a2c [InstCombine] [NFC] Use a pattern matcher for ExtractElementInst
Reviewed By: RKSimon, rampitec

Differential Revision: https://reviews.llvm.org/D125857
2022-05-20 10:31:40 +08:00
Vitaly Buka d33c36235d [lit] Fix setup of sanitizer environment
Not all options were propageted into tests.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D122869
2022-05-19 19:24:16 -07:00
jacquesguan 0e02bf6358 [mlir][Arithmetic] fold overlapping negf.
This patch folds negf(negf(x)) to x.

Differential Revision: https://reviews.llvm.org/D125955
2022-05-20 01:49:19 +00:00
Bill Wendling 6e00a34cdb [AArch64] Add support for -fzero-call-used-regs
Support the "-fzero-call-used-regs" option on AArch64. This involves much less
specialized code than the X86 version. Most of the checks can be done with
TableGen.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D124836
2022-05-19 16:58:28 -07:00
wren romano a9a19f5965 [mlir][sparse] Adding x-macros for OverheadType
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126026
2022-05-19 16:53:15 -07:00
Sam McCall 1dfd8e99f9 [Serialization] Delta encode locations in expansion sloc entries
This is a 1.9% reduction in PCH size in my measurements.

In abbreviated records, VBR6 seems to be slightl better than VBR8 for locations
that may be delta-encoded (i.e. not the first)

Differential Revision: https://reviews.llvm.org/D125952
2022-05-20 01:05:53 +02:00
Alex Brachet c3856cb739 [bazel][libc] Fix bazel build
Differential revision: https://reviews.llvm.org/D126028
2022-05-19 22:58:50 +00:00
wren romano 774674ce9a [mlir][sparse] Factored out a "FATAL" macro for unrecoverable assertion failure
Depends On D126019

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126022
2022-05-19 15:26:20 -07:00
Bill Wendling 88043c1958 [TableGen] Add generation of argument register lists
There are cases, like with -fzero-call-used-regs,  where we need to know
which registers can be used by a certain calling convention. This change
generates a list of registers used by each calling convention defined in
*CallingConv.td.

Calling conventions that use registers conditioned on Swift have those
registers placed in a separate list. This allows us to be flexible about
whether to use the Swift registers or not.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D125421
2022-05-19 15:18:25 -07:00
Bill Wendling db0ea51c83 Revert "[TableGen] Add generation of argument register lists"
There are build bot failures.

This reverts commit 3fa1b6557d.
2022-05-19 15:16:08 -07:00
wren romano aff9c89fab [mlir][sparse] Simplifying closure
By closing over the `rank` itself rather than `this`, we save a method call on each iteration.  A minor optimization, but one that adds up.

Depends On D126016

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126019
2022-05-19 15:15:33 -07:00
wren romano fa6aed2abd [mlir][sparse] Using the name "dimSizes" more consistently
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126016
2022-05-19 15:12:44 -07:00
Bill Wendling 3fa1b6557d [TableGen] Add generation of argument register lists
There are cases, like with -fzero-call-used-regs,  where we need to know
which registers can be used by a certain calling convention. This change
generates a list of registers used by each calling convention defined in
*CallingConv.td.

Calling conventions that use registers conditioned on Swift have those
registers placed in a separate list. This allows us to be flexible about
whether to use the Swift registers or not.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D125421
2022-05-19 15:03:14 -07:00
python3kgae c6c13d4e5f [DirectX backend] When cleanup module flags only remove unused flags.
Only remove dx.valver from module flags when cleanup module flags in DXILTranslateMetadataPass.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D125842
2022-05-19 14:50:11 -07:00
Alex Brachet b1183305f8 [libc] Add strlcat
Differential Revision: https://reviews.llvm.org/D125978
2022-05-19 21:48:39 +00:00
Med Ismail Bennani 027499a824
[lldb/test] Fix PExpect.launch issue when disabling color support
This patch should fix a bug in PExpect.launch that happened when color
support is not enabled.

In that case, we need to add the `--no-use-colors` flag to lldb's launch
argument list. However, previously, each character to the string was
appended separately to the `args` list. This patch solves that by adding
the whole string to the list.

This should fix the TestIOHandlerResize failure on GreenDragon.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-05-19 14:47:04 -07:00
Craig Topper 35564fff67 Revert "[RISCV] Add test cases showing failure to remove mask on rotate amounts."
This reverts commit e2f410feea.

This exposes a pre-existing bug in type legalization that is failing
expensive checks.
2022-05-19 14:39:38 -07:00
Craig Topper dfe513ae1b Revert "[RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates."
This reverts commit 86f7d7074a.

The test cases added for this exposed an pre-existing bug that is failing
the expensive checks bot. Reverting so I can revert that patch.
2022-05-19 14:39:38 -07:00
Alexander Shaposhnikov 6990e7477d [ConstantRange] Improve the implementation of binaryOr
This diff adjusts binaryOr to take advantage of the analysis
based on KnownBits.

Differential revision: https://reviews.llvm.org/D125933

Test plan:
1/ ninja check-llvm
2/ ninja check-llvm-unit
2022-05-19 21:39:19 +00:00
Jorge Gorbe Moya 221b7a4583 [bazel] Add lib/Basic/BuiltinTargetFeatures.h to clang:basic `hdrs`.
This header is included by
clang/unittests/CodeGen/CheckTargetFeaturesTest.cpp
so it needs to be exposed here to make it visible.
2022-05-19 14:20:17 -07:00
Kiran Chandramohan 4202d69d9e [Flang][OpenMP] Upstream the lowering of the parallel do combined construct
When parallel is used in a combined construct, then use a separate
function to create the parallel operation. It handles the parallel
specific clauses and leaves the rest for handling at the inner
operations.

Reviewed By: peixin, shraiysh

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

Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Nimish Mishra <neelam.nimish@gmail.com>
2022-05-19 21:13:50 +00:00
Nicolas Capens c153c61fad Handle instrumentation of scalar single-precision (_ss) intrinsics
Instrumentation of scalar double-precision intrinsics such as
x86_sse41_round_sd was already handled by https://reviews.llvm.org/D82398,
but not their single-precision counterparts.

https://issuetracker.google.com/172238865

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D124871
2022-05-19 13:56:51 -07:00
Aart Bik 3b13f8805c [mlir][sparse] fix unsigned comparison bug in assert
Reviewed By: bixia, wrengr

Differential Revision: https://reviews.llvm.org/D126007
2022-05-19 13:32:09 -07:00
Jay Foad 9ece051847 [AMDGPU] Mark s_get_waveid_in_workgroup as not reading memory
It is already marked as having side effects, at least in MIR. It does
not interact with anything else that is modelled as a memory access
either in IR or MachineIR.

Differential Revision: https://reviews.llvm.org/D125985
2022-05-19 21:25:46 +01:00
Jay Foad 86b55edab6 [AMDGPU] Mark s_getreg as having side effects instead of reading memory
s_getreg does not interact with anything else that is modelled as a
memory access either in IR or MachineIR.

Differential Revision: https://reviews.llvm.org/D125968
2022-05-19 21:25:46 +01:00
Stella Stamenova 33b7df8c1f [mlir] Remove unused properties from the standalone example's lit configuration
Since these are unused, I've removed them from the configuration, so that it can be easier to read and follow.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D125132
2022-05-19 12:54:28 -07:00
Jennifer Yu 7aa9c39381 [Clang][[OpenMP5.1] Initial parser/sema for default(private) clause
This implements the default(private) clause as defined in OMP5.1

Differential Revision: https://reviews.llvm.org/D125912
2022-05-19 12:43:13 -07:00
Florian Hahn c90235f0ef
[LV] Drop wrap flags for reductions using VP def-use chain.
Update clearReductionWrapFlags to use the VPlan def-use chain from the
reduction phi recipe to drop reduction wrap flags.

This addresses an existing FIXME and fixes a crash when instructions in
the reduction chain are not used and have been removed before VPlan
codegeneration.

Fixes #55540.
2022-05-19 20:36:46 +01:00
Nico Weber e0b98902a2 [gn build] (manually) port 505ddb6b74 (remove Unit/lit.site.cfg.py) 2022-05-19 15:18:56 -04:00
Keith Smiley 505ddb6b74
[lld][test] Delete empty Unit test directory
This became empty when we removed the legacy macho lld. This results in
a warning when running `check-lld`. We can revert this in the future if
we want unit tests.

Differential Revision: https://reviews.llvm.org/D125436
2022-05-19 12:06:42 -07:00
Nico Weber 304a5a7a14 Revert "[ValueTracking] Added support to deduce PHI Nodes values being a power of 2"
This reverts commit d5c130f17e.
Breaks tests, see https://reviews.llvm.org/D125332#3525819
2022-05-19 15:05:30 -04:00
Jonathan Peyton f613e6d19d [OpenMP][libomp] Fix accidental removal of else for core attributes 2022-05-19 14:00:27 -05:00
David Green 80aab0312a [ARM] Cost modelling for scalar fptoi_sat
Similar to D124357, this adds some cost modelling for fptoi_sat for Arm
targets. Where VFP2 is available (and FP64/FP16 for the relevant types),
the operations are legal as the Arm instructions naturally saturate.
Otherwise they will need an extra smin/smax clamp, similar to AArch64.

Differential Revision: https://reviews.llvm.org/D125665
2022-05-19 19:53:21 +01:00
William Huang 6107cdc929 [InstCombine] NEW Baseline tests for InstCombine optimization to merge GEP instructions with constant indices
Splitted the merge constant-indexed GEP optimization into two smaller transformations: 1. Merging GEP of GEP if both are constant-indexed. 2. Swapping constant indexed GEP in a chain of (non-constant) GEP to the end, so that 1 can be applied repeatedly.
There is existing code to partially  handle transformation 1, but it only deals with limited cases

Unit tests are breaking down into two parts for the 2 transformations.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D125438
2022-05-19 18:46:18 +00:00
Kristof Beyls ac2f0a6f1d [Office Hours] add initial guidance for hosts
This includes adding guidance to announce an office hours session on the
Discord channel and/or IRC, as discussed at the office hours round table at
EuroLLVM 2022, see
https://discourse.llvm.org/t/office-hours-eurollvm-round-table-summary/62480.

Fixes #55423
2022-05-19 20:39:39 +02:00
William Huang d5c130f17e [ValueTracking] Added support to deduce PHI Nodes values being a power of 2
Add Value Tracking support to deduce induction variable being a power of 2, allowing urem optimizations

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D125332
2022-05-19 18:39:13 +00:00
Keith Smiley a1cf20f012
[llvm-dis][test] Fix error case on Windows
The `N` case in the error differs across platforms.
2022-05-19 11:30:30 -07:00
William Huang 0f37ba7b23 [ValueTracking] Baseline tests for Power-of-2 value tracking on PHI nodes
Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D124885
2022-05-19 18:30:14 +00:00
Joseph Huber eda4ef3add [Libomptarget] Add `leaf` attribute to `vprintf` declaration
Summary:
This patch adds the `leaf` attribute to the `vprintf` declaration in the
OpenMP runtime. This attribute allows us to determine that the `vprintf`
function will not call any functions within the translation unit,
allowing us to deduce `norecurse` attributes on the caller.
2022-05-19 14:22:53 -04:00
Heejin Ahn cde083e010 [WebAssembly] Fix register use-def in FixIrreducibleControlFlow
FixIrreducibleControlFlow pass adds dispatch blocks with a `br_table`
that has multiple predecessors and successors, because it serves as
something like a traffic hub for BBs. As a result of this, there can be
register uses that are not dominated by a def in every path from the
entry block. For example, suppose register %a is defined in BB1 and used
in BB2, and there is a single path from BB1 and BB2:
```
BB1 -> ... -> BB2
```
After FixIrreducibleControlFlow runs, there can be a dispatch block
between these two BBs:
```
BB1 -> ... -> Dispatch -> ... -> BB2
```
And this dispatch block has multiple predecessors, now
there is a path to BB2 that does not first visit BB1, and in that path
%a is not dominated by a def anymore.

To fix this problem, we have been adding `IMPLICIT_DEF`s to all
registers in PrepareForLiveInternals pass, and then remove unnecessary
ones in OptimizeLiveIntervals pass after computing `LiveIntervals`. But
FixIrreducibleControlFlow pass itself ends up violating register use-def
relationship, resulting in invalid code. This was OK so far because
MIR verifier apparently didn't check this in validation. But @arsenm
fixed this and it caught this bug in validation
(https://github.com/llvm/llvm-project/issues/55249).

This CL moves the `IMPLICIT_DEF` adding routine from
PrepareForLiveInternals to FixIrreducibleControlFlow. We only run it
when FixIrreducibleControlFlow changes the code. And then
PrepareForLiveInternals doesn't do anything other than setting
`TracksLiveness` property, which is a prerequisite for running
`LiveIntervals` analysis, which is required by the next pass
OptimizeLiveIntervals.

But in our backend we don't seem to do anything that invalidates this up
until OptimizeLiveIntervals, and I'm not sure why we are calling
`invalidateLiveness` in ReplacePhysRegs pass, because what that pass
does is to replace physical registers with virtual ones 1-to-1. I
deleted the `invalidateLiveness` call there and we don't need to set
that flag explicitly, which obviates all the need for
PrepareForLiveInternals.

(By the way, This 'Liveness' here is different from `LiveIntervals`
analysis. Setting this only means BBs' live-in info is correct, all uses
are dominated by defs, `kill` flag is conservatively correct, which
means if there is a `kill` flag set it should be the last use. See
2a0837aab1/llvm/include/llvm/CodeGen/MachineFunction.h (L125-L134)
for details.)

So this CL removes PrepareForLiveInternals pass altogether. Something
similar to this was attempted by D56091 long ago but that came short of
actually removing the pass, and I couldn't land it because
FixIrreducibleControlFlow violated use-def relationship, which this CL
fixes.

This doesn't change output in any meaningful way. All test changes
except `irreducible-cfg.mir` are register numbering.

Also this will likely to reduce compilation time, because we have been
adding `IMPLICIT_DEF` for all registers every time `-O2` is given, but
now we do that only when there is irreducible control flow, which is
rare.

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

Reviewed By: dschuff, kripken

Differential Revision: https://reviews.llvm.org/D125515
2022-05-19 11:13:37 -07:00
Heejin Ahn 44718c5ef2 [WebAssembly] Use CHECK-NEXT for irreducible-cfg.mir
Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D125514
2022-05-19 11:12:20 -07:00