Sanjay Patel [Thu, 30 Jun 2022 12:10:51 +0000 (08:10 -0400)]
[AMDGPU] add alternate tests for max-offset codegen; NFC
As discussed in D128123, the existing test shows a possible
regression when converting sub to xor. This adds tests that
avoid that pattern but still has a offset near 65535. Also,
add a test with the canonical IR for the existing test to show
if the transform is happening with the expected pattern in IR.
Aaron Ballman [Thu, 30 Jun 2022 19:46:13 +0000 (15:46 -0400)]
Test and document some C99 DRs
This captures the first 15 or so DRs in C99
Simon Pilgrim [Thu, 30 Jun 2022 19:25:41 +0000 (20:25 +0100)]
[SLP][X86] Add 32-bit vector stores to help vectorization opportunities
Building on the work on D124284, this patch tags v4i8 and v2i16 vector loads as custom, enabling SLP to try to vectorize these types ending in a partial store (using the SSE MOVD instruction) - we already do something similar for 64-bit vector types.
Differential Revision: https://reviews.llvm.org/D127604
Jonas Hahnfeld [Wed, 29 Jun 2022 20:30:56 +0000 (22:30 +0200)]
[Interpreter] Pass target features to JIT
This is required to support RISC-V where the '+d' target feature
indicates the presence of the D instruction set extension, which
changes to the Hard-float 'd' ABI.
Differential Revision: https://reviews.llvm.org/D128853
Sam McCall [Thu, 30 Jun 2022 17:50:40 +0000 (19:50 +0200)]
[pseudo] Add ForestNode descendants iterator, print ambiguous/opaque node stats.
Differential Revision: https://reviews.llvm.org/D128930
Jim Ingham [Thu, 30 Jun 2022 19:09:31 +0000 (12:09 -0700)]
Apparently you need a special makefile flag to use threads on Linux.
This is a follow-up to https://reviews.llvm.org/D128776.
Fazlay Rabbi [Thu, 30 Jun 2022 17:59:33 +0000 (10:59 -0700)]
[OpenMP] Initial parsing and sema support for 'parallel masked taskloop' construct
This patch gives basic parsing and semantic support for
"parallel masked taskloop" construct introduced in
OpenMP 5.1 (section 2.16.9)
Differential Revision: https://reviews.llvm.org/D128834
Jim Ingham [Wed, 29 Jun 2022 01:06:30 +0000 (18:06 -0700)]
Threads which hit a breakpoint but fail the condition are considered
not to be hit. But another thread might be hit at the same time and
actually stop. So we have to be sure to switch the first thread's
stop info to eStopReasonNone or we'll report a hit when the condition
failed, which is confusing.
Differential Revision: https://reviews.llvm.org/D128776
Jonas Devlieghere [Thu, 30 Jun 2022 18:35:12 +0000 (11:35 -0700)]
Revert "Deferred Concept Instantiation Implementation"
This reverts commit
2f207439521d62d9551b2884158368e8b34084e5 because it
triggers an assertion when building an LLDB test program:
Assertion failed: (InstantiatingSpecializations.empty() && "failed to
clean up an InstantiatingTemplate?"), function ~Sema, file
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/clang/lib/Sema/Sema.cpp,
line 458.
More details in https://reviews.llvm.org/D126907.
Craig Topper [Thu, 30 Jun 2022 18:28:02 +0000 (11:28 -0700)]
[RISCV] Use getVTList to simplify creation of vleff MachineSDNode. NFC
We don't need to pass the 3 VTs separately, we already have a list
available to us.
Fangrui Song [Thu, 30 Jun 2022 18:30:34 +0000 (11:30 -0700)]
[llvm-objdump] Default to --mcpu=future for PPC64
GNU objdump disassembles all unknown instructions by default. Match this user
friendly behavior with the cpu value `future`.
Differential Revision: https://reviews.llvm.org/D127824
Fangrui Song [Thu, 30 Jun 2022 18:17:55 +0000 (11:17 -0700)]
[llvm-objdump] Default to --mattr=+all for AArch64
GNU objdump disassembles all unknown instructions by default. Match this user
friendly behavior with the target feature "all" (D128029) designed for disassemblers.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D128030
Craig Topper [Thu, 30 Jun 2022 18:05:18 +0000 (11:05 -0700)]
[RISCV] Use the VT passed into selectImm instead of XLenVT. NFCI
I think the VT pased in will always be XLen.
Katherine Rasmussen [Wed, 22 Jun 2022 19:01:04 +0000 (12:01 -0700)]
[flang] Add semantics test for `get_team`
Add a semantics test for the intrinsic function `get_team`.
Differential Revision: https://reviews.llvm.org/D128370
Javed Absar [Sun, 5 Jun 2022 12:42:13 +0000 (13:42 +0100)]
[mlir][Inliner] Support recursion in Inliner
This fixes Bug https://github.com/llvm/llvm-project/issues/53492
and uses InlineHistory to track recursive inlining.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D127072
Benoit Jacob [Thu, 30 Jun 2022 15:56:15 +0000 (15:56 +0000)]
Useful error when input dim is unused by LHS/RHS.
Differential Revision: https://reviews.llvm.org/D128925
Aaron Ballman [Thu, 30 Jun 2022 17:38:42 +0000 (13:38 -0400)]
Revert "[clang] Emit SARIF Diagnostics: Create `clang::SarifDocumentWriter` interface"
This reverts commit
329fae7103d355e728cc326a0a9abef889ccc577.
This should fix failing test bots like:
https://lab.llvm.org/buildbot/#/builders/91/builds/11328
Fangrui Song [Thu, 30 Jun 2022 17:37:58 +0000 (10:37 -0700)]
[AArch64] Add target feature "all"
This is used by disassemblers: `llvm-mc -disassemble -mattr=` and `llvm-objdump --mattr=`.
The main use case is for llvm-objdump to disassemble all known instructions
(D128030).
In user-facing tools, "all" is intentionally not supported in producers:
integrated assembler (`.arch_extension all`), clang -march (`-march=armv9.3a+all`).
Due to the code structure, `llvm-mc -mattr=+all` `llc -mattr=+all` are not
rejected (they are internal tool). Add `llvm/test/CodeGen/AArch64/mattr-all.ll`
to catch behavior changes.
AArch64SysReg::SysReg::haveFeatures: check `FeatureAll` to print
`AArch64SysReg::SysReg::AltName` for some system registers (e.g. `ERRIDR_EL1, RNDR`).
AArch64.td: add `AssemblerPredicateWithAll` to additionally test `FeatureAll`.
Change all `AssemblerPredicate` (except `UseNegativeImmediates`) to `AssemblerPredicateWithAll`.
utils/TableGen/{DecoderEmitter,SubtargetFeatureInfo}.cpp: support arbitrarily
nested all_of, any_of, and not.
Note: A predicate supports all_of, any_of, and not. For a target (though
currently not for AArch64) an encoding may be disassembled differently with
different target features.
Note: AArch64MCCodeEmitter::computeAvailableFeatures is not available to
the disassembler.
Reviewed By: peter.smith, lenary
Differential Revision: https://reviews.llvm.org/D128029
Martin Sebor [Thu, 30 Jun 2022 17:22:28 +0000 (11:22 -0600)]
[InstCombine] Fix memrchr logic error that prevents folding
Correct a logic bug in the memrchr enhancement added in D123629 that
makes it ineffective in a subset of cases.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D128856
Fangrui Song [Thu, 30 Jun 2022 17:32:38 +0000 (10:32 -0700)]
[AArch64] Make FeatureFuseAdrpAdd a tune feature
Update D120104 to add FeatureFuseAdrpAdd to Processor#TuneFeatures
instead of Processor#Features, similar to FeatureFuseAES, and matching
Tune*.
This enables FeatureFuseAdrpAdd for `clang -mcpu=xxx -mtune=generic` even
if xxx does not set FeatureFuseAdrpAdd.
Reviewed By: alexander-shaposhnikov, peter.smith
Differential Revision: https://reviews.llvm.org/D128787
Vaibhav Yenamandra [Thu, 30 Jun 2022 17:23:15 +0000 (13:23 -0400)]
[clang] Emit SARIF Diagnostics: Create `clang::SarifDocumentWriter` interface
Create an interface for writing SARIF documents from within clang:
The primary intent of this change is to introduce the interface
clang::SarifDocumentWriter, which allows incrementally adding
diagnostic data to a JSON backed document. The proposed interface is
not yet connected to the compiler internals, which will be covered in
future work. As such this change will not change the input/output
interface of clang.
This change also introduces the clang::FullSourceRange type that is
modeled after clang::SourceRange + clang::FullSourceLoc, this is useful
for packaging a pair of clang::SourceLocation objects with their
corresponding SourceManagers.
Previous discussions:
RFC for this change: https://lists.llvm.org/pipermail/cfe-dev/2021-March/067907.html
https://lists.llvm.org/pipermail/cfe-dev/2021-July/068480.html
SARIF Standard (2.1.0):
https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html
Differential Revision: https://reviews.llvm.org/D109701
Matthew Voss [Thu, 30 Jun 2022 16:44:23 +0000 (09:44 -0700)]
[llvm-reduce] Change initialization order to fix bots. NFC
Fixes this error:
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/
llvm-project/llvm/tools/llvm-reduce/TestRunner.cpp:20:7:
error: field 'TM' will be initialized after field 'ToolName'
[-Werror,-Wreorder-ctor]
TM(std::move(TM)), ToolName(ToolName) {
^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Program(std::move(Program)) TM(std::move(TM))
1 error generated.
https://lab.llvm.org/buildbot/\#/builders/77/builds/19154
Daniel Thornburgh [Wed, 16 Feb 2022 00:46:54 +0000 (00:46 +0000)]
[llvm-dwarfdump] --show-sources option to show all sources
This option allows printing all sources used by an object file.
Reviewed By: dblaikie, jhenderson
Differential Revision: https://reviews.llvm.org/D87656
Kai Nacke [Thu, 30 Jun 2022 15:29:44 +0000 (11:29 -0400)]
[SystemZ] Add support for tune-cpu attribute
clang (like gcc) has the `-mtune=` command line option. This option
adds the `"tune-cpu"` attribute to a function. The intended functionality
is that the scheduling model of that cpu is used. E.g. `-mtune=z15 -march=z14`
generates only instructions supported on z14 but uses the scheduling model
of z15 for it.
This PR adds the infrastructure to support this.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D128910
Christopher Bate [Fri, 17 Jun 2022 17:40:28 +0000 (11:40 -0600)]
[mlir][VectorToGPU] Fix support for i4, col-major operand support
For the conversion to nvgpu `mma.sync` and `ldmatrix` pathways, the code
was missing support for the `i4` data type. While fixing this, another
bug was discoverd that caused the number of ldmatrix tiles calculated for
certain operand types and configurations to be incorrect. This change
fixes both issues and adds additional tests.
Differential Revision: https://reviews.llvm.org/D128074
Jonas Devlieghere [Thu, 30 Jun 2022 16:18:31 +0000 (09:18 -0700)]
[lldb] XFAIL TestObjCXXBridgedPO on macOS Ventura
TestObjCXXBridgedPO is broken on macOS Ventura (but not on macOS
Monterey). I took a look but it doesn't seem trivial. I'm XFAILing the
test until Adrian, who wrote the test, can take a look.
rdar://
96224141
jeff [Mon, 27 Jun 2022 20:17:00 +0000 (20:17 +0000)]
[AMDGPU] Check for CopyToReg PhysReg clobbers in pre-RA-sched
Differential Revision: https://reviews.llvm.org/D128681
Valentin Clement [Thu, 30 Jun 2022 16:10:53 +0000 (18:10 +0200)]
[flang] Fix "not yet implemented" message for CHARACTER MIN/MAX
The check to see if the arguments for the MIN/MAX intrinsics were of CHARACTER
type was not handling assumed length characters. In this case, the FIR type is
"!fir.ref<!fir.char<1,?>>".
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128922
Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Sam Estep [Thu, 30 Jun 2022 16:03:23 +0000 (16:03 +0000)]
[clang][dataflow] Replace TEST_F with TEST where possible
Many of our tests are currently written using `TEST_F` where the test fixture class doesn't have any `SetUp` or `TearDown` methods, and just one helper method. In those cases, this patch deletes the class and pulls its method out into a standalone function, using `TEST` instead of `TEST_F`.
There are still a few test files leftover in `clang/unittests/Analysis/FlowSensitive/` that use `TEST_F`:
- `DataflowAnalysisContextTest.cpp` because the class contains a `Context` field which is used
- `DataflowEnvironmentTest.cpp` because the class contains an `Environment` field which is used
- `SolverTest.cpp` because the class contains a `Vals` field which is used
- `TypeErasedDataflowAnalysisTest.cpp` because there are several different classes which all share the same method name
Reviewed By: ymandel, sgatev
Differential Revision: https://reviews.llvm.org/D128924
Craig Topper [Thu, 30 Jun 2022 15:52:57 +0000 (08:52 -0700)]
[RISCV] Fold (sra (add (shl X, 32), C1), 32 - C) -> (shl (sext_inreg (add X, C1), C)
Similar for a subtract with a constant left hand side.
(sra (add (shl X, 32), C1<<32), 32) is the canonical IR from InstCombine
for (sext (add (trunc X to i32), 32) to i32).
For RISCV, we should lower this as addiw which means turning it into
(sext_inreg (add X, C1)).
There is an existing DAG combine to convert back to (sext (add (trunc X
to i32), 32) to i32), but it requires isTruncateFree to return true
and for i32 to be a legal type as it used sign_extend and truncate
nodes. So that doesn't work for RISCV.
If the outer sra happens be used by a shl by constant, it will be
folded and the shift amount of the sra will be changed before we
can do our own DAG combine. This requires us to match the more
general pattern and restore the shl.
I had wanted to do this as a separate (add (shl X, 32), C1<<32) ->
(shl (add X, C1), 32) combine, but that hit an infinite loop for some
values of C1.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D128869
Craig Topper [Thu, 30 Jun 2022 15:52:43 +0000 (08:52 -0700)]
[RISCV] DAG combine (sra (shl X, 32), 32 - C) -> (shl (sext_inreg X, i32), C).
The sext_inreg can often be folded into an earlier instruction by
using a W instruction. The sext_inreg also works better with our ABI.
This is one of the steps to improving the generated code for this https://godbolt.org/z/hssn6sPco
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D128843
Craig Topper [Wed, 29 Jun 2022 23:23:41 +0000 (16:23 -0700)]
[RISCV] Pre-commit tests for D128869. NFC
Jonas Devlieghere [Thu, 30 Jun 2022 15:55:51 +0000 (08:55 -0700)]
[llvm] Fix the modules build
Fixes error: missing '#include "llvm/IR/FMF.h"'; 'FastMathFlags' must be
defined before it is used in llvm/include/llvm/IR/NoFolder.h.
Matthew Voss [Thu, 30 Jun 2022 15:53:00 +0000 (08:53 -0700)]
[llvm-reduce] Add support for LTO bitcode files
Adds support for reading and writing LTO bitcode files.
- Emit a summary if the original bitcode file had a summary
- Use split LTO units if the original bitcode file used them.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D127168
Peixin Qiao [Thu, 30 Jun 2022 15:52:44 +0000 (23:52 +0800)]
[flang] Fix one corner case in reshape intrinsic
As Fortran 2018 16.9.163, the reshape is the only intrinsic which
requires the shape argument to be rank-one integer array and the SIZE
of it to be one constant expression. The current expression lowering
converts the shape expression with slice in intrinsic into one box value
with the box element type of unknown extent. However, the genReshape
requires the box element type to be constant size. So, convert the box
value into one with box element type of sequence of 1 x constant. This
corner case is found in cam4 in SPEC 2017
https://github.com/llvm/llvm-project/issues/56140.
Reviewed By: Jean Perier
Differential Revision: https://reviews.llvm.org/D128597
David Green [Thu, 30 Jun 2022 15:45:00 +0000 (16:45 +0100)]
[ARM] Add Thumb-1 CTTZ codegen tests. NFC
Piotr Sobczak [Tue, 28 Jun 2022 18:00:03 +0000 (14:00 -0400)]
[AMDGPU] gfx11 WMMA instruction support
gfx11 introduces new WMMA (Wave Matrix Multiply-accumulate)
instructions.
Reviewed By: arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D128756
Valentin Clement [Thu, 30 Jun 2022 14:56:29 +0000 (16:56 +0200)]
[flang][NFC] Fix warning
Sam McCall [Thu, 30 Jun 2022 14:52:55 +0000 (16:52 +0200)]
[pseudo] Forest dump ascii art isn't broken by large indices
Nikolas Klauser [Thu, 30 Jun 2022 12:11:26 +0000 (14:11 +0200)]
[libc++] Remove dead code and unneeded C++03 specializations from type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128906
Nikolas Klauser [Thu, 30 Jun 2022 11:47:26 +0000 (13:47 +0200)]
[libc++] Implement P0618R0 (Deprecating <codecvt>)
Reviewed By: ldionne, #libc
Spies: cfe-commits, llvm-commits, libcxx-commits
Differential Revision: https://reviews.llvm.org/D127313
Tue Ly [Thu, 30 Jun 2022 14:44:08 +0000 (10:44 -0400)]
[libc][Obvious] Do not add __NO_ to targets with FLAG__NO suffix.
Pavel Labath [Thu, 30 Jun 2022 14:30:51 +0000 (16:30 +0200)]
[lldb] Fix libc++ string formatter for the "unstable" layout
D128285 only changed the stable (v1) layout, so the matching change in
D128694 broke the formatting of the unstable strings. This fixes that,
and ensures compatibility with all older layouts as well.
Nikita Popov [Thu, 30 Jun 2022 10:52:31 +0000 (12:52 +0200)]
[IRBuilder] Migrate all binops to folding API
Migrate all binops to use FoldXYZ rather than CreateXYZ APIs,
which are compatible with InstSimplifyFolder and fallible constant
folding.
Rather than continuing to add one method for every single operator,
add a generic FoldBinOp (plus variants for nowrap, exact and fmf
operators), which we would need anyway for CreateBinaryOp.
This change is not NFC because IRBuilder with InstSimplifyFolder
may perform more folding. However, this patch changes SCEVExpander
to not use the folder in InsertBinOp to minimize practical impact
and keep this change as close to NFC as possible.
Muhammad Omair Javaid [Wed, 29 Jun 2022 09:22:56 +0000 (13:22 +0400)]
Fix PDB/func-symbols.test for Arm/Windows
PDB/func-symbols.test was orignally written for 32bit x86, keeping in
mind cdecl and stdcall calling conventions which does name mangling for
example like adding "_" underscore before function name.
This is only x86 specific but purpose of pointers.test is NOT to test
calling convention.
I have made a minor change to make this test pass on Windows/Arm.
Chen Zheng [Mon, 27 Jun 2022 10:24:41 +0000 (06:24 -0400)]
add testcases for D128647, NFC
Muhammad Omair Javaid [Wed, 29 Jun 2022 09:34:36 +0000 (13:34 +0400)]
Fix TestCommandScript.py for Arm/Windows
TestCommandScript.py fails on Arm/Windows due following issues:
https://llvm.org/pr56288
https://llvm.org/pr56292
LLDB fails to skip prologue and also step over library function or
nodebug functions fails due to PDB/DWARF mismatch.
This patch replace function breakpoint with line breakpoint so that we
can expect LLDB to stop on desired line. Also replace dwarf with PDB
debug info for this test only.
Erich Keane [Thu, 19 May 2022 13:44:34 +0000 (06:44 -0700)]
Deferred Concept Instantiation Implementation
This is a continuation of D119544. Based on @rsmith 's feed back
showing me https://eel.is/c++draft/temp#friend-9, We should properly
handle friend functions now.
Differential Revision: https://reviews.llvm.org/D126907
Valentin Clement [Thu, 30 Jun 2022 13:45:39 +0000 (15:45 +0200)]
[flang] Convert assertion to a TODO
The original assertion is not necessarily correct since the shape
argument may involve a slice of an array (an expression) and not a whole
vector with constant length. In the presence of a slice operation, the
size must be computed (left as a TODO for now).
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128894
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
LLVM GN Syncbot [Thu, 30 Jun 2022 13:27:00 +0000 (13:27 +0000)]
[gn build] Port
a591c7ca0d9f
Nikita Popov [Thu, 30 Jun 2022 13:19:26 +0000 (15:19 +0200)]
[VNCoercion] Separate constant/non-constant mem intrinsic implementations (NFCI)
This means we no longer need to have the same API between IRBuilder
and IRBuilderFolder.
The constant case is substantially simpler, so implementing it
separately isn't an undue burden.
Xiang Li [Wed, 29 Jun 2022 21:00:28 +0000 (14:00 -0700)]
[HLSL] Change WaveActiveCountBits to wrapper of __builtin_hlsl_wave_active_count_bits
Change WaveActiveCountBits from builtin into wrapper of __builtin_hlsl_wave_active_count_bits.
For comment at
https://reviews.llvm.org/D126857#inline-1235949
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D128855
Prathit Aswar [Thu, 30 Jun 2022 13:07:49 +0000 (09:07 -0400)]
Correct -Winfinite-recursion warning on potentially-unevaluated operand
Fixing issue "incorrect -Winfinite-recursion warning on potentially-
unevaluated operand".
We add a dedicated visit function (VisitCXXTypeidExpr) for typeid,
instead of using the default (VisitStmt). In this new function we skip
over building the CFG for unevaluated operands of typeid.
Fixes #21668
Differential Revision: https://reviews.llvm.org/D128747
Nikita Popov [Thu, 30 Jun 2022 12:49:44 +0000 (14:49 +0200)]
[VNCoercion] Use ConstantFoldLoadFromConst API (NFCI)
Nowdays we have a generic constant folding API to load a type from
an offset. It should be able to do anything that VNCoercion can do.
This avoids the weird templating between IRBuilder and ConstantFolder
in one function, which is will stop working as the IRBuilderFolder
moves from CreateXYZ to FoldXYZ APIs.
Unfortunately, this doesn't eliminate this pattern from VNCoercion
entirely yet.
Aaron Jacobs [Thu, 30 Jun 2022 12:45:42 +0000 (12:45 +0000)]
[libTooling][NFC] Add a comment about comment parsing to getAssociatedRange.
It took me multiple hours of debugging plus asking an expert for help to
figure out why this function didn't do what it promised to do. It turns
out there is a flag that needs to be set. Document this, in an attempt
to save the next person the surprise.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D128774
Nikolas Klauser [Thu, 30 Jun 2022 10:57:51 +0000 (12:57 +0200)]
[libc++] Disentangle _If, _Or and _And
Reviewed By: ldionne, #libc, EricWF
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D127919
Florian Hahn [Thu, 30 Jun 2022 11:14:31 +0000 (12:14 +0100)]
[LV] Move LoopVersioning creation to LVP::execute.
At the moment LoopVersioning is only created for inner-loop
vectorization. This patch moves it to LVP::execute, which means it will
also be added for epilogue vectorization. As a consequence, the proper
noalias metadata is now also added to epilogue vector loops.
LVer will be moved to VPTransformState as follow-up.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D127966
Xiang1 Zhang [Thu, 30 Jun 2022 10:25:01 +0000 (18:25 +0800)]
[test] Add a lit test fshl-splat-undef.ll
esmeyi [Thu, 30 Jun 2022 10:55:49 +0000 (06:55 -0400)]
[NFC][XCOFF] remove an unused global variable.
Michael Platings [Tue, 28 Jun 2022 09:42:20 +0000 (10:42 +0100)]
Uglify __support/xlocale
This allows including the headers without risk of conflict with
user-defined macros e.g. max
Differential Revision: https://reviews.llvm.org/D128728
Fraser Cormack [Thu, 30 Jun 2022 10:30:12 +0000 (11:30 +0100)]
[IR] Fix typo in comment. NFC
Nicolas Vasilache [Tue, 28 Jun 2022 12:17:32 +0000 (05:17 -0700)]
[mlir][Linalg] Uniformize SplitReduction transforms and add option to use Bufferization::AllocTensor
This revision merges the 2 split_reduction transforms and adds extra control by using attributes.
SplitReduction is known to require a concrete additional buffer to store tempoaray information.
Add an option to introduce a `bufferization.alloc_tensor` instead of `linalg.init_tensor`.
This behaves better with subset-based tiling and bufferization.
Differential Revision: https://reviews.llvm.org/D128722
Sanjay Patel [Thu, 30 Jun 2022 10:14:30 +0000 (06:14 -0400)]
[InstCombine] fix overzealous assert in icmp-shr fold
The assert was added with
0399473de886595d and is correct for that
pattern, but it is off-by-1 with the enhancement in
d4f39d833332.
The transforms are still correct with the new pre-condition:
https://alive2.llvm.org/ce/z/6_6ghm
https://alive2.llvm.org/ce/z/_GTBUt
And as shown in the new test, the transform is expected with
'ult' - in that case, the icmp reduces to test if the shift
amount is 0.
Nikita Popov [Thu, 30 Jun 2022 10:16:57 +0000 (12:16 +0200)]
[ConstantFold] Support loads in ConstantFoldInstOperands()
This allows all constant folding to happen through a single
function, without requiring special handling for loads at each
call-site.
This may not be NFC because some callers currently don't do that
special handling.
LLVM GN Syncbot [Thu, 30 Jun 2022 10:11:58 +0000 (10:11 +0000)]
[gn build] Port
cfb7ffdec0eb
LLVM GN Syncbot [Thu, 30 Jun 2022 10:11:58 +0000 (10:11 +0000)]
[gn build] Port
72cd6b6c8356
Muhammad Omair Javaid [Thu, 30 Jun 2022 10:01:30 +0000 (14:01 +0400)]
[LLDB] Fix TestSTL.py Makefile to remove -gdwarf O0
This is a follow up to my previous commit where TestSTL.py got broken
due to
9c6e04359282e9051f7b2744b99266ece32db001.
Now that we force dwarf symbols by default on windows we dont need to
specifically put -gdwarf O0 in debug flags for this test.
Sven van Haastregt [Thu, 30 Jun 2022 10:01:19 +0000 (11:01 +0100)]
[OpenCL] Remove half scalar vload/vstore builtins
These are not mentioned in the OpenCL C Specification nor in the
OpenCL Extension Specification.
Differential Revision: https://reviews.llvm.org/D128434
Pavel Samolysov [Thu, 30 Jun 2022 09:54:02 +0000 (12:54 +0300)]
[Pipelines] Add a test how DCE works after ArgumentPromotion
The ArgumentPromotion pass uses Mem2Reg promotion at the end to cutting
down generated alloca instructions as well as meaningless stores and
this behavior can leave unused (dead) arguments.
The test shows that the arguments are not removed in the current
optimization pipeline.
Nikita Popov [Thu, 30 Jun 2022 09:54:47 +0000 (11:54 +0200)]
[Evaluator] Add missing LLVM_DEBUG()
Missed these in
41f0b6a78143776d673565cfa830849e3b468b8e, resulting
in unconditional debug output.
Nikita Popov [Thu, 30 Jun 2022 09:14:01 +0000 (11:14 +0200)]
[InlineCost] Simplify constant folding
Use a common ConstantFoldInstOperands-based constant folding
implementation, instead of specifying the folding function for
each function individually. Going through the generic handling
doesn't appear to have any significant compile-time impact.
As the test change shows, this is not NFC, because we now use
DataLayout-aware constant folding, which can do slightly better
in some cases (e.g. those involving GEPs).
Chen Zheng [Thu, 23 Jun 2022 08:35:16 +0000 (04:35 -0400)]
add testcase for D127202, NFC
Chen Zheng [Thu, 30 Jun 2022 09:26:27 +0000 (05:26 -0400)]
[InlineFunction] Only check pointer arguments for a call
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D128529
Muhammad Omair Javaid [Thu, 30 Jun 2022 08:25:43 +0000 (12:25 +0400)]
[LLDB] Fix TestSTL.py on Windows
TestSTL.py was broken by
9c6e04359282e9051f7b2744b99266ece32db001.
This patch fixes it with changes to its Makefile.
Phoebe Wang [Thu, 30 Jun 2022 08:40:29 +0000 (16:40 +0800)]
[X86] Support `_Float16` on SSE2 and up
This is split from D113107 to address #56204 and https://discourse.llvm.org/t/how-to-build-compiler-rt-for-new-x86-half-float-abi/63366
Reviewed By: zahiraam, rjmccall, bkramer, MaskRay
Differential Revision: https://reviews.llvm.org/D128571
Nikita Popov [Thu, 30 Jun 2022 08:44:08 +0000 (10:44 +0200)]
[Evaluator] Use ConstantFoldInstOperands()
For instructions that don't need any special handling, use
ConstantFoldInstOperands(), rather than re-implementing individual
cases.
This is probably not NFC because it can handle cases the previous
code missed (e.g. vector operations).
Nikita Popov [Thu, 30 Jun 2022 09:02:36 +0000 (11:02 +0200)]
[ConstantFold] Supports compares in ConstantFoldInstOperands()
Support compares in ConstantFoldInstOperands(), instead of
forcing the use of ConstantFoldCompareInstOperands(). Also handle
insertvalue (extractvalue was already handled).
This removes a footgun, where many uses of ConstantFoldInstOperands()
need a separate check for compares beforehand. It's particularly
insidious if called on a constant expression, because it doesn't
fail in that case, but will just not do DL-dependent folding.
Weining Lu [Thu, 30 Jun 2022 08:58:52 +0000 (16:58 +0800)]
[LoongArch] Fix wrong function names in bstrpick_w.ll. NFC
Fraser Cormack [Thu, 30 Jun 2022 08:25:35 +0000 (09:25 +0100)]
[RISCV] Add a test covering a (reverted) codegen issue
This test checks one of problematic cases outlined in D128006, leading
to the patch's reversal. I thought it best to add a test just in case
this sort of optimization is attempted again in the future in some
fashion.
Valentin Clement [Thu, 30 Jun 2022 08:36:47 +0000 (10:36 +0200)]
[flang] Fix for array upper bounds with *
Even though the array is declared with '*' upper bounds, it has an
initial value that has a statically known shape. Use the shape from
the type of the initializer when the declared size is '*'.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128889
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Valentin Clement [Thu, 30 Jun 2022 08:35:43 +0000 (10:35 +0200)]
[flang][NFC] Add FIR array test
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128888
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Amir Ayupov [Thu, 30 Jun 2022 08:15:49 +0000 (01:15 -0700)]
[BOLT] Fix getDynoStats to handle BCs with no functions
Address fuzzer crash
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D120696
Florian Hahn [Thu, 30 Jun 2022 08:08:33 +0000 (09:08 +0100)]
[VPlan] Make sure optimizeInductions removes wide ind from scalar plan.
In some cases, there may be widened users of inductions even though the
plan includes the scalar VF. In those cases, make sure we still replace
the VPWidenIntOrFpInductionRecipe with scalar steps, as otherwise we may
try to execute a VPWidenIntOrFpInductionRecipe with a scalar VF.
Alternatively the patch could also split the range if needed.
This fixes a crash exposed by D123720.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D128755
Valentin Clement [Thu, 30 Jun 2022 08:09:47 +0000 (10:09 +0200)]
[flang] Correct bug in literal CHARACTER constant names
The names of CHARACTER strings were being truncated leading to invalid
collisions and other failures. This change makes sure to use the entire
string as the seed for the unique name.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128884
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Matthias Springer [Thu, 30 Jun 2022 07:31:45 +0000 (09:31 +0200)]
[mlir][SCF][bufferize][NFC] Utilize recently added helper function
This should have been part of D128666.
Differential Revision: https://reviews.llvm.org/D128885
Chuanqi Xu [Thu, 30 Jun 2022 07:48:22 +0000 (15:48 +0800)]
[NFC] [Modules] Add test for inherit default arguments
Amir Ayupov [Mon, 13 Jun 2022 21:46:43 +0000 (14:46 -0700)]
[X86][BOLT] Use getOperandType to determine memory access size
Generate INSTRINFO_OPERAND_TYPE table in X86GenInstrInfo.inc.
This diff adds support for instructions that were previously reported as having
memory access size 0. It replaces the heuristic of looking at instruction
register width to determine memory access width by instead checking the memory
operand type using tablegen-provided tables.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D126116
Nikita Popov [Mon, 27 Jun 2022 15:14:41 +0000 (17:14 +0200)]
[SCCP] Simplify CFG in SCCP as well
Currently, we only remove dead blocks and non-feasible edges in
IPSCCP, but not in SCCP. I'm not aware of any strong reason for
that difference, so this patch updates SCCP to perform the CFG
cleanup as well.
Compile-time impact seems to be pretty minimal, in the 0.05%
geomean range on CTMark.
For the test case from https://reviews.llvm.org/D126962#3611579
the result after -sccp now looks like this:
define void @test(i1 %c) {
entry:
br i1 %c, label %unreachable, label %next
next:
unreachable
unreachable:
call void @bar()
unreachable
}
-jump-threading does nothing on this, but -simplifycfg will produce
the optimal result.
Differential Revision: https://reviews.llvm.org/D128796
Valentin Clement [Thu, 30 Jun 2022 07:03:49 +0000 (09:03 +0200)]
[flang] SELECT CASE constructs with character selectors that require a temp
Here is a character SELECT CASE construct that requires a temp to hold the
result of the TRIM intrinsic call:
```
module m
character(len=6) :: s
contains
subroutine sc
n = 0
if (lge(s,'00')) then
select case(trim(s))
case('11')
n = 1
case default
continue
case('22')
n = 2
case('33')
n = 3
case('44':'55','66':'77','88':)
n = 4
end select
end if
print*, n
end subroutine
end module m
```
This SELECT CASE construct is implemented as an IF/ELSE-IF/ELSE comparison
sequence. The temp must be retained until some comparison is successful.
At that point the temp may be freed. Generalize statement context processing
to allow multiple finalize calls to do this, such that the program always
executes exactly one freemem call.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: klausler, vdonaldson
Differential Revision: https://reviews.llvm.org/D128852
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Valentin Clement [Thu, 30 Jun 2022 06:54:16 +0000 (08:54 +0200)]
[flang] Fix error message in test
Stanislav Gatev [Wed, 29 Jun 2022 15:56:53 +0000 (15:56 +0000)]
[clang][dataflow] Handle `for` statements without conditions
Handle `for` statements without conditions.
Differential Revision: https://reviews.llvm.org/D128833
Reviewed-by: xazax.hun, gribozavr2, li.zhe.hua
Valentin Clement [Thu, 30 Jun 2022 06:36:10 +0000 (08:36 +0200)]
[flang][NFC] Revert message to not implemented yet
Carl Ritson [Thu, 30 Jun 2022 03:26:47 +0000 (12:26 +0900)]
[AMDGPU] Fix liveness for loops in si-optimize-exec-masking-pre-ra
Follow up to D127894, new liveness update code needs to handle
the case where S_ANDN2 input must be extended through loops when
V_CNDMASK_B32 has been hoisted.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D128800
Fangrui Song [Thu, 30 Jun 2022 05:10:59 +0000 (22:10 -0700)]
[flang][test] Remove RUN COMMAND/EXPECTED OUTPUT/INPUT markers from other directories
Fangrui Song [Thu, 30 Jun 2022 05:08:02 +0000 (22:08 -0700)]
[flang][test] Remove RUN LINES?/EXPECTED OUTPUT.*/INPUT markers from test/Driver
Follow-up to D128763.
Fangrui Song [Thu, 30 Jun 2022 04:55:02 +0000 (21:55 -0700)]
Use value_or instead of getValueOr. NFC
Kevin Cadieux [Thu, 30 Jun 2022 04:29:18 +0000 (21:29 -0700)]
[lldb] Fix unused variable warning in TraceHTR (NFC)
A warning was recently introduced in [D128576](https://reviews.llvm.org/D128576) due to now unused lambda `function_name_from_load_address`. This warning causes build failures when treating warnings as errors. This change expands the comment to also include the definition of this lambda, fixing the warning.
Error:
```
[3809/6000] Building CXX object tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
FAILED: tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
/usr/bin/clang++ -DHAVE_ROUND -DLLDB_CONFIGURATION_DEBUG -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/__w/1/b/llvm/Debug/tools/lldb/source/Plugins/TraceExporter/common -I/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common -I/__w/1/llvm-project/lldb/include -I/__w/1/b/llvm/Debug/tools/lldb/include -I/__w/1/b/llvm/Debug/include -I/__w/1/llvm-project/llvm/include -I/__w/1/llvm-project/llvm/../clang/include -I/__w/1/b/llvm/Debug/tools/lldb/../clang/include -I/__w/1/llvm-project/lldb/source -I/__w/1/b/llvm/Debug/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g -fno-exceptions -gsplit-dwarf -std=c++14 -MD -MT tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o -MF tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o.d -o tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o -c /__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp:136:8: error: unused variable 'function_name_from_load_address' [-Werror,-Wunused-variable]
auto function_name_from_load_address =
```
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D128874
Daniel Bertalan [Fri, 17 Jun 2022 15:21:59 +0000 (17:21 +0200)]
[lld-macho] Initial support for Linker Optimization Hints
Linker optimization hints mark a sequence of instructions used for
synthesizing an address, like ADRP+ADD. If the referenced symbol ends up
close enough, it can be replaced by a faster sequence of instructions
like ADR+NOP.
This commit adds support for 2 of the 7 defined ARM64 optimization
hints:
- LOH_ARM64_ADRP_ADD, which transforms a pair of ADRP+ADD into ADR+NOP
if the referenced address is within +/- 1 MiB
- LOH_ARM64_ADRP_ADRP, which transforms two ADRP instructions into
ADR+NOP if they reference the same page
These two kinds already cover more than 50% of all LOHs in
chromium_framework.
Differential Review: https://reviews.llvm.org/D128093
Keegan Saunders [Thu, 30 Jun 2022 03:55:05 +0000 (20:55 -0700)]
[MC] Skip lower-case integer suffixes
`mov x0, 1024u` is permitted in binutils but rejected by the integrated
assembler. Support the case. This is especially important when using the C
pre-processor with the assembler: some shared code between C and assembler may
use lower-cased suffices.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D128871
Chuanqi Xu [Thu, 30 Jun 2022 03:37:28 +0000 (11:37 +0800)]
[Coroutines] Add REQUIRES clause to skip unsupported targets