River Riddle [Wed, 20 Apr 2022 05:46:34 +0000 (22:46 -0700)]
[mlir][PDLL] Add support for generating PDL patterns from PDLL at build time
This essentially sets up mlir-pdll to function in a similar manner to mlir-tblgen. Aside
from the boilerplate of configuring CMake and setting up a basic initial test, two new
options are added to mlir-pdll to mirror options provided by tblgen:
* -d
This option generates a dependency file (i.e. a set of build time dependencies) while
processing the input file.
* --write-if-changed
This option only writes to the output file if the data would have changed, which for
the build system prevents unnecesarry rebuilds if the file was touched but not actually
changed.
Differential Revision: https://reviews.llvm.org/D124075
River Riddle [Wed, 20 Apr 2022 03:34:21 +0000 (20:34 -0700)]
[mlir][PDLL] Don't use the result of `Constraint::getDefName()` when uniquing
In the case of anonymous defs this may return the name of the base def class,
which can lead to two different defs with the same name (which hits an assert).
This commit adds a new `getUniqueDefName` method that returns a unique name
for the constraint.
Differential Revision: https://reviews.llvm.org/D124074
Jason Molenda [Wed, 27 Apr 2022 01:30:18 +0000 (18:30 -0700)]
Don't push null ExecutionContext on CommandInterp exectx stack
The driver can push a null ExecutionContext on to this stack,
and later calls to SBCommandInterpreter::HandleCommand which
don't specify an ExecutionContext can pull an entry from the
stack, resulting in settings that aren't applied.
Differential Revision: https://reviews.llvm.org/D111209
rdar://
81489207
Eric Schweitz [Tue, 26 Apr 2022 23:49:01 +0000 (16:49 -0700)]
Upstream test for wide character literals.
Reviewed By: vdonaldson
Differential Revision: https://reviews.llvm.org/D124488
Alexander Shaposhnikov [Wed, 27 Apr 2022 00:21:33 +0000 (00:21 +0000)]
[Support] Factor out isCrash from throwIfCrash
This diff factors out the check "isCrash" from the static method "throwIfCrash".
This is a helper function that can be useful in debugging / analysis, in particular,
I'm planning to use it in the future patches for lld-fuzzer.
Test plan:
1/ ninja check-all
2/ export LLD_IN_TEST=5 ninja check-lld
Differential revision: https://reviews.llvm.org/D124414
Stanislav Mekhanoshin [Wed, 27 Apr 2022 00:45:41 +0000 (17:45 -0700)]
[AMDGPU] Remove now unused variable HasLdsModifier. NFC.
Yaxun (Sam) Liu [Tue, 26 Apr 2022 17:06:53 +0000 (13:06 -0400)]
[CUDA][HIP] Fix linkage of __clang_gpu_used_external
Different TU's may have this globl var. appending linkage can
only be used with lld recognized special variables.
Change it to internal linkage.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D124466
Stanislav Mekhanoshin [Tue, 26 Apr 2022 22:00:42 +0000 (15:00 -0700)]
[AMDGPU] Add both mayLoad and mayStore to MUBUF LDS opcodes
Differential Revision: https://reviews.llvm.org/D124483
Stanislav Mekhanoshin [Tue, 26 Apr 2022 21:58:42 +0000 (14:58 -0700)]
[AMDGPU] Remove vdata from buffer to lds load
Differential Revision: https://reviews.llvm.org/D124485
Dominic Chen [Wed, 27 Apr 2022 00:14:39 +0000 (17:14 -0700)]
Fix [libc] Minor test signedness fixes
Add namespace specifier
Differential Revision: https://reviews.llvm.org/D124468
Dominic Chen [Tue, 26 Apr 2022 17:25:05 +0000 (10:25 -0700)]
[libc] Minor test signedness fixes
Resolve compiler warnings about signed conversion
Differential Revision: https://reviews.llvm.org/D124468
Jeffrey Tan [Tue, 26 Apr 2022 21:29:10 +0000 (14:29 -0700)]
Fix missing import for test
The last fix missed an import in one test file causing skipIfWindows attribute
can't be recognized.
I feel embarrassed to miss it. I have run all tests on Mac to make sure them
passing in this patch.
Differential Revision: https://reviews.llvm.org/D124479
Warren Ristow [Tue, 26 Apr 2022 23:29:33 +0000 (16:29 -0700)]
[NFC] Fix argument types in doxygen comment
The argument types for _mm_extract_epi16 and _mm_insert_epi16 were
incorrectly identified as '__m256i' instead of '__m128i'. Introduced
by
df08b3493869540bad5d4b040dae814e078b411d, and fixed here.
David Tenty [Fri, 22 Apr 2022 18:37:17 +0000 (14:37 -0400)]
[AIX][XCOFF] error on emit symbol visibility for XCOFF object file
This is a follow on to the revert of D84265 to add an error if we'd need
to write a non-zero visibility type in the xcoff object file. We can't
currently do that because we lack the auxilary header to interpret the
bits in XCOFF32. This is important because visibility is being enabled
in the assembly writing path, and without this error the visibility
could be silently ignored.
Differential Revision: https://reviews.llvm.org/D124392
Martin Sebor [Tue, 26 Apr 2022 22:26:09 +0000 (16:26 -0600)]
[SimplifyLibCalls] avoid slicing 64-bit integers in an ILP32 build (PR #54739)
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123472
Paul Kirth [Tue, 26 Apr 2022 23:17:26 +0000 (23:17 +0000)]
[BOLT][NFC] Fix warning for unqualified call to std::move
Fixes warning from RetpolineInsertion.cpp:171:44:
warning: unqualified call to std::move [-Wunqualified-std-cast-call]
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D124482
Aart Bik [Tue, 26 Apr 2022 20:30:57 +0000 (13:30 -0700)]
[mlir][sparse] support pattern-only matrices from Matrix Market
We simply set nonzero entries to the value "1" in this case.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D124475
Martin Sebor [Tue, 26 Apr 2022 22:12:57 +0000 (16:12 -0600)]
[InstCombine] Fold strnlen of constant strings.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123817
Nico Weber [Tue, 26 Apr 2022 22:00:37 +0000 (18:00 -0400)]
try to fix check-llvm on windows after
0a27622a1d62
Eric Schweitz [Tue, 26 Apr 2022 20:44:34 +0000 (13:44 -0700)]
[NFC] More synching of sources for upstreaming.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D124476
Warren Ristow [Tue, 26 Apr 2022 21:33:14 +0000 (14:33 -0700)]
[NFC] Cleanup miscellaneous header items
- Explain the use of the _MM_SHUFFLE and _MM_SHUFFLE2 macros
- Update some doxygen parameter descriptions to match the implementations
- Add "see also" doxygen tags to some intrinsics
- Minor clang-format changes
Reviewers: RKSimon
Differential Revision: https://reviews.llvm.org/D124469
Ricky Zhou [Tue, 26 Apr 2022 21:26:54 +0000 (17:26 -0400)]
[InstCombine] Update predicate when canonicalizing comparisons in canonicalizeClampLike.
canonicalizeClampLike canonicalizes the ule/ugt comparisons to ult/uge,
respectively. However, it does not update the variable holding the
comparison predicate type after doing this. Later code fails to handle
the non-canonical predicate type (specifically, the swap of
ThresholdLowIncl and ThresholdHighExcl when Pred0 has been canonicalized
from ugt to uge). This leads to the miscompile reported in PR53252. Fix
this by updating the comparison predicate after canonicalizing.
Fixes #53252
Differential Revision: https://reviews.llvm.org/D119690
Michael Kruse [Tue, 26 Apr 2022 18:35:13 +0000 (13:35 -0500)]
[OpenMPIRBuilder] Remove ContinuationBB argument from Body callback.
The callback is expected to create a branch to the ContinuationBB (sometimes called FiniBB in some lambdas) argument when finishing. This creates problems:
1. The InsertPoint used for CodeGenIP does not need to be the end of a block. If it is not, a naive callback will insert a branch instruction into the middle of the block.
2. The BasicBlock the CodeGenIP is pointing to may or may not have a terminator. There is an conflict where to branch to if the block already has a terminator.
3. Some API functions work only with block having a terminator. Some workarounds have been used to insert a temporary terminator that is removed again.
4. Some callbacks are sensitive to whether the BasicBlock has a terminator or not. This creates a callback ordering problem where different callback may have different behaviour depending on whether a previous callback created a terminator or not. The problem also exists for FinalizeCallbackTy where some callbacks do create branch to another "continue" block, but unlike BodyGenCallbackTy does not receive the target as argument. This is not addressed in this patch.
With this patch, the callback receives an CodeGenIP into a BasicBlock where to insert instructions. If it has to insert control flow, it can split the block at that position as needed but otherwise no separate ContinuationBB is needed. In particular, a callback can be empty without breaking the emitted IR. If the caller needs the control flow to branch to a specific target, it can insert the branch instruction itself and pass an InsertPoint before the terminator to the callback.
Certain frontends such as Clang may expect the current IRBuilder position to be at the end of a basic block. In this case its callbacks must split the block at CodeGenIP before setting the IRBuilder position such that the instructions after CodeGenIP are moved to another basic block and before returning create a new branch instruction to the split block.
Some utility functions such as `splitBB` are supporting correct splitting of BasicBlocks, independent of whether they have a terminator or not, returning/setting the InsertPoint of an IRBuilder to the end of split predecessor block, and optionally omitting creating a branch to the split successor block to be added later.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D118409
Ricky Zhou [Tue, 26 Apr 2022 21:21:27 +0000 (17:21 -0400)]
[InstCombine] Add tests reproducing PR53252 (NFC)
This are baseline tests for D119690 ( #53252 )
Differential Revision: https://reviews.llvm.org/D119689
Martin Storsjö [Tue, 26 Apr 2022 21:19:14 +0000 (00:19 +0300)]
Revert "[compiler-rt] Use C_STANDARD instead of custom logic for adding -std=c11"
This reverts commit
2f251925db060f83894a4cf5448259b7a1255552.
This was reported to break the Builtins-powerpc64le-linux::qdiv_test.c
test on ppc64le buildbots, e.g. these:
https://lab.llvm.org/buildbot/#/builders/105/builds/24538
https://lab.llvm.org/buildbot/#/builders/121/builds/18755
Stanislav Mekhanoshin [Tue, 26 Apr 2022 19:34:27 +0000 (12:34 -0700)]
[AMDGPU] Properly mark MUBUF and FLAT LDS DMA instructions. NFC.
Add these bits to the MUBUF and FLAT LDS DMA instructions:
- LGKM_CNT - these operate on LDS;
- VALU - SPG 3.9.8: This instruction acts as both a MUBUF and
VALU instruction;
Codegen currently does not produce any of this, so the change is NFC.
Differential Revision: https://reviews.llvm.org/D124472
Vasileios Porpodas [Tue, 26 Apr 2022 18:32:24 +0000 (11:32 -0700)]
Recommit "[SLP][TTI] Refactoring of `getShuffleCost` `Args` to work like `getArithmeticInstrCost`"
This reverts commit
6a9bbd9f20dcd700e28738788bb63a160c6c088c.
Code review: https://reviews.llvm.org/D124202
Paul Robinson [Tue, 26 Apr 2022 20:36:22 +0000 (13:36 -0700)]
[PS5] Add debug option testing for the PS5 target
The functionality was added in 7726ad0, catching up on the tests now.
This test mostly runs clang and checks one thing each time, which isn't
very efficient. I added some -DAG suffixes and combined some checks so
adding PS5 checking didn't actually increase the number of clang runs.
Jeffrey Tan [Tue, 26 Apr 2022 19:13:49 +0000 (12:13 -0700)]
Disable symbol on-demand feature for Windows
Symbol on-demand feature is never tested on Windows so it is not a surprise
that we are getting Buildbot failure from Windows:
https://lab.llvm.org/buildbot/#/builders/83/builds/18228
This patch disables symbol on-demand feature on Windows. I will find a Windows
machine to test and re-enable symbol on-demand feature as follow-up.
Differential Revision: https://reviews.llvm.org/D124471
Kirill Stoimenov [Tue, 26 Apr 2022 20:24:06 +0000 (20:24 +0000)]
Revert "[demangler] Simplify OutputBuffer initialization"
Reverting due to a bot failure:
https://lab.llvm.org/buildbot/#/builders/5/builds/22738
This reverts commit
5b3ca24a35e91bf9c19af856e7f92c69b17f989e.
Martin Sebor [Tue, 26 Apr 2022 19:15:03 +0000 (13:15 -0600)]
[InstCombine] Fold memrchr calls with a constant character.
Reviewed By: nikic
Differential Revision: //reviews.llvm.org/D123629
Martin Sebor [Tue, 26 Apr 2022 17:52:15 +0000 (11:52 -0600)]
[InstCombine] Fold memrchr calls with constant size, bail on excessive.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123626
Differential Revision: https://reviews.llvm.org/D123628
Martin Sebor [Tue, 26 Apr 2022 17:48:43 +0000 (11:48 -0600)]
[InstCombine] Fold strnlen with a bound of zero and one.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123816
Martin Sebor [Tue, 26 Apr 2022 17:35:59 +0000 (11:35 -0600)]
[InstCombine] add a strnlen handler stub.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123815
Andrew Savonichev [Tue, 26 Apr 2022 19:22:38 +0000 (22:22 +0300)]
[NVPTX] Temporary disable dwarf-file-dir.ll on Windows
The test was added in D121299 and it fails on Windows:
error: CHECK-NODIR: expected string
not found in input
; CHECK-NODIR: .file {{[0-9]+}} "/tmp/dbginfo/a/a.cpp"
^
<stdin>:1:1: note: scanning from here
//
^
<stdin>:25:2: note: possible intended match here
.file 1 "/tmp/dbginfo/a\\a.cpp"
Andrew Savonichev [Tue, 26 Apr 2022 19:05:32 +0000 (22:05 +0300)]
[NFC] Fix order of initialization in MCTargetOptions
This patch fixes a compiler warning after D121299:
field 'MCUseDwarfDirectory' will be initialized after field
'MCIncrementalLinkerCompatible'
Artur Pilipenko [Tue, 26 Apr 2022 18:58:08 +0000 (11:58 -0700)]
[EarlyCSE] Add tests demonstrating missed opportunitites
Add tests demonstrating missed opportunitites around
invariant.start intrinsic.
NFC.
Andrew Savonichev [Tue, 26 Apr 2022 15:45:09 +0000 (18:45 +0300)]
[NVPTX] Disable DWARF .file directory for PTX
Default behavior for .file directory was changed in D105856, but
ptxas (CUDA 11.5 release) refuses to parse it:
$ llc -march=nvptx64 llvm/test/DebugInfo/NVPTX/debug-file-loc.ll
$ ptxas debug-file-loc.s
ptxas debug-file-loc.s, line 42; fatal : Parsing error near
'"foo.h"': syntax error
Added a new field to MCAsmInfo to control default value of
UseDwarfDirectory. This value is used if -dwarf-directory command line
option is not specified.
Differential Revision: https://reviews.llvm.org/D121299
Sanjay Patel [Tue, 26 Apr 2022 18:22:16 +0000 (14:22 -0400)]
[InstCombine] try to fold icmp with mismatched extended operands
If a value is known to be non-negative and zexted,
that's the same thing as sexted.
So for the purpose of looking past the casts with
an icmp, treat it as if it was a sext:
https://alive2.llvm.org/ce/z/_BDsGV
This is necessary, but not enough to solve the
motivating problem:
https://github.com/llvm/llvm-project/issues/55013
Differential Revision: https://reviews.llvm.org/D124419
Vasileios Porpodas [Tue, 26 Apr 2022 18:24:48 +0000 (11:24 -0700)]
Revert "[SLP][TTI] Refactoring of `getShuffleCost` `Args` to work like `getArithmeticInstrCost`"
This reverts commit
55ce296d6f217fd0defed2592ff7b74b79b2c1f0.
Sanjay Patel [Tue, 26 Apr 2022 17:59:32 +0000 (13:59 -0400)]
[InstCombine] fold freeze of partial undef/poison vector constants
We can always replace the undef elements in a vector constant
with regular constants to get rid of the freeze:
https://alive2.llvm.org/ce/z/nfRb4F
The select diffs show that we might do better by adjusting the
logic for a frozen select condition. We may also want to refine
the vector constant replacement to consider forming a splat.
Differential Revision: https://reviews.llvm.org/D123962
Craig Topper [Tue, 26 Apr 2022 18:02:34 +0000 (11:02 -0700)]
[RISCV] Add more out of range immediate tests to rv64zbp-invalid.s. NFC
This tests the Zbp instructions that change immediate range between
riscv32 and riscv64. We were only testing them for riscv32 before.
Vasileios Porpodas [Thu, 21 Apr 2022 17:39:08 +0000 (10:39 -0700)]
[SLP][TTI] Refactoring of `getShuffleCost` `Args` to work like `getArithmeticInstrCost`
Before this patch `Args` was used to pass a broadcat's arguments by SLP.
This patch changes this. `Args` is now used for passing the operands of
the shuffle.
Differential Revision: https://reviews.llvm.org/D124202
Augie Fackler [Thu, 24 Feb 2022 15:40:20 +0000 (10:40 -0500)]
Attributes: add a new `allocptr` attribute
This continues the push away from hard-coded knowledge about functions
towards attributes. We'll use this to annotate free(), realloc() and
cousins and obviate the hard-coded list of free functions.
Differential Revision: https://reviews.llvm.org/D123083
Craig Topper [Tue, 26 Apr 2022 17:42:58 +0000 (10:42 -0700)]
[RISCV] Add out of range immediate tests for shifts and rotates on rv64.
We were only testing the shared instruction mnemonics in rv32 tests.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D124460
Peter Klausler [Mon, 25 Apr 2022 23:00:01 +0000 (16:00 -0700)]
[flang] Fix crash from PDT component init in module file
Semantics now needs to preserve the parse trees from module files,
in case they contain parameterized derived type definitions with
component initializers that may require re-analysis during PDT
instantiation. Save them in the SemanticsContext.
Differential Revision: https://reviews.llvm.org/D124467
Jay Foad [Tue, 26 Apr 2022 16:01:02 +0000 (17:01 +0100)]
[AMDGPU] Precommit a test case for D124450
LLVM GN Syncbot [Tue, 26 Apr 2022 17:42:25 +0000 (17:42 +0000)]
[gn build] Port
7b81192d462b
Jeffrey Tan [Wed, 20 Apr 2022 14:30:53 +0000 (07:30 -0700)]
Introduce new symbol on-demand for debug info
This diff introduces a new symbol on-demand which skips
loading a module's debug info unless explicitly asked on
demand. This provides significant performance improvement
for application with dynamic linking mode which has large
number of modules.
The feature can be turned on with:
"settings set symbols.load-on-demand true"
The feature works by creating a new SymbolFileOnDemand class for
each module which wraps the actual SymbolFIle subclass as member
variable. By default, most virtual methods on SymbolFileOnDemand are
skipped so that it looks like there is no debug info for that module.
But once the module's debug info is explicitly requested to
be enabled (in the conditions mentioned below) SymbolFileOnDemand
will allow all methods to pass through and forward to the actual SymbolFile
which would hydrate module's debug info on-demand.
In an internal benchmark, we are seeing more than 95% improvement
for a 3000 modules application.
Currently we are providing several ways to on demand hydrate
a module's debug info:
* Source line breakpoint: matching in supported files
* Stack trace: resolving symbol context for an address
* Symbolic breakpoint: symbol table match guided promotion
* Global variable: symbol table match guided promotion
In all above situations the module's debug info will be on-demand
parsed and indexed.
Some follow-ups for this feature:
* Add a command that allows users to load debug info explicitly while using a
new or existing command when this feature is enabled
* Add settings for "never load any of these executables in Symbols On Demand"
that takes a list of globs
* Add settings for "always load the the debug info for executables in Symbols
On Demand" that takes a list of globs
* Add a new column in "image list" that shows up by default when Symbols On
Demand is enable to show the status for each shlib like "not enabled for
this", "debug info off" and "debug info on" (with a single character to
short string, not the ones I just typed)
Differential Revision: https://reviews.llvm.org/D121631
Vasileios Porpodas [Tue, 26 Apr 2022 14:33:42 +0000 (07:33 -0700)]
[AArch64][NFC] Deleted llvm/test/Analysis/CostModel/AArch64/splat-load.ll test
This test is no longer necessary as it is a subset of:
llvm/test/Analysis/CostModel/AArch64/shuffle-load.ll
Differential Revision: https://reviews.llvm.org/D124456
Matt Arsenault [Sat, 16 Apr 2022 23:42:23 +0000 (19:42 -0400)]
llvm-reduce: Simplify virtual register cloning
Just clone all the virtual registers instead of looking for def
operands. This preserves the register values used, simplifying the
rest of the code. This avoids needing to expose the register map to
target code.
Matt Arsenault [Sat, 16 Apr 2022 21:17:41 +0000 (17:17 -0400)]
llvm-reduce: Preserve frame index values when cloning function
Previously the specific values used for fixed frame indexes was in
reverse order in the cloned function from the original, and a map was
used to adjust all frame indexes to the potentially new values. Insert
the fixed objects in reverse to avoid this. This simplifies other
code, since now we don't need to track down all frame indexes. This
will allow targets that store frame indexes in MachineFunctionInfo to
simply copy the values.
Note this isn't directly observable in the test since the resulting
MIR print/parse can shuffle the IDs around (in particular the final
serialization implicitly strips out dead objects).
Yi Zhang [Tue, 19 Apr 2022 00:50:30 +0000 (20:50 -0400)]
Support non identity layout map for reshape ops in MemRefToLLVM lowering
This change borrows the ideas from `computeExpanded/CollapsedLayoutMap`
and computes the dynamic strides at runtime for the memref descriptors.
Differential Revision: https://reviews.llvm.org/D124001
Peter Klausler [Tue, 26 Apr 2022 00:36:05 +0000 (17:36 -0700)]
[flang] Get ppc64le build bot back up
A recent change assumed that the native C++ "long double" maps to
a Fortran data type; but this turns out to not be true for ppc64le,
which uses "double-double" for "long double".
This is a quick patch to get the ppc64le flang build bot back up.
A better fix that either uses HostTypeExists<> or replaces "long double"
with "ieee128_t" (or some other solution) is expected to follow soon.
Differential Revision: https://reviews.llvm.org/D124423
Tanya Lattner [Tue, 26 Apr 2022 16:29:44 +0000 (09:29 -0700)]
Consistently use the same apostrophe in these docs.
Shao-Ce SUN [Tue, 26 Apr 2022 15:36:42 +0000 (23:36 +0800)]
[NFC][RISCV][CodeGen] Use ArrayRef in TargetLowering functions
Based on D123467.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D123653
Mark de Wever [Sat, 23 Apr 2022 16:19:58 +0000 (18:19 +0200)]
[NFC][libc++] Fixes some tests on Linux.
The tests are adapted to the output produced on Linux.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D124331
Nikita Popov [Tue, 26 Apr 2022 15:36:39 +0000 (17:36 +0200)]
[InstCombine] Add extra use tests for GEP of GEP fold (NFC)
Jay Foad [Tue, 26 Apr 2022 15:29:06 +0000 (16:29 +0100)]
[TableGen] Dump RC.AllocationPriority with -register-info-debug
Chris Bieneman [Tue, 26 Apr 2022 14:58:16 +0000 (09:58 -0500)]
[SPIRV][NFC] Remove unused variable
This removes an unused local variable that was causing a warning to be
emitted.
Jonas Paulsson [Thu, 24 Mar 2022 11:41:34 +0000 (12:41 +0100)]
[SystemZ] Fix C++ ABI for passing args of structs containing zero width bitfield.
A struct like { float a; int :0; } should per the SystemZ ABI be passed in a
GPR, but to match a bug in GCC it has been passed in an FPR (see 759449c).
GCC has now corrected the C++ ABI for this case, and this patch for clang
follows suit.
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D122388
Nikita Popov [Tue, 26 Apr 2022 15:04:25 +0000 (17:04 +0200)]
[InstCombine] Add tests for GEP of GEP with opaque pointers (NFC)
Test cases with element type mismatch, some of which can still
be combined.
Chris Bieneman [Tue, 26 Apr 2022 14:46:50 +0000 (09:46 -0500)]
[SPIRV][NFC] Fix warnings for switch cases
Switch statements that cover all cases should not have a `default`
case. When a switch covers all cases and includes a `default` case,
clang emits a diagnostic. Omitting the `default` case allows the
compiler to instead emit a diagnostic on unhandled enum values.
This change removes default cases from all the places that they
shouldn't be, and adds a missing enum case for one switch statement
that wasn't covering all values.
Chris Bieneman [Tue, 26 Apr 2022 14:46:07 +0000 (09:46 -0500)]
[SPIRV][NFC] Fix warning on class/struct mismatch
Clang issues a warning on class/struct mismatch because the MSVC ABI
varries for classes and structs.
Joseph Huber [Tue, 26 Apr 2022 14:49:31 +0000 (10:49 -0400)]
[OpenMP] Fix incorrect path taken when searching for LLD for offloading
Summary:
A previous patch updated the path searching in the linker wrapper. I
made an error and caused `lld`, which is necessary to link AMDGPU
images, to not be found on some systems. This patch fixes this by
correctly searching that linker-wrapper's binary path first again.
Jeremy Morse [Tue, 26 Apr 2022 10:08:05 +0000 (11:08 +0100)]
Reapply D124184, [DebugInfo][InstrRef] Add a size operand to DBG_PHI
This was reverted twice, in
987cd7c3ed75b and
13815e8cbf8d4. The latter
stemed from not accounting for rare register classes in a pre-allocated
array, and the former from an array not being completely initialized,
leading to asan complaining.
Igor Kudrin [Tue, 26 Apr 2022 14:44:24 +0000 (18:44 +0400)]
[LoopPeel][NFCI] Simplify the code to calculate peel count for PGO
This reorganizes the code as a preparation for D123865:
* Use more descriptive names for variables
* Simplify a condition by use an already calculated value
for `MaxPeelCount`
* Remove a duplicate log entry
* Report basic values for loop costs
Differential Revision: https://reviews.llvm.org/D124388
Igor Kudrin [Tue, 26 Apr 2022 14:43:56 +0000 (18:43 +0400)]
[LoopPeel][NFC] Exit early if there is no room for peeling
Differential Revision: https://reviews.llvm.org/D123864
Yaxun (Sam) Liu [Mon, 25 Apr 2022 15:34:08 +0000 (11:34 -0400)]
[HIP] Fix diag msg about sanitizer
Fix the misleading diag msg as the option is ignored for a particular
offload arch only.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D124396
Igor Chebykin [Tue, 26 Apr 2022 14:23:17 +0000 (17:23 +0300)]
[NVPTX][tests] add "XFAIL: nvptx" for some tests
Some tests failed for NVPTX target, but it seems that NVPTX will be
fixed and the tests will pass. So, just mark the tests as XFAIL
Differential Revision: https://reviews.llvm.org/D124125
Igor Chebykin [Tue, 26 Apr 2022 14:15:50 +0000 (17:15 +0300)]
[NVPTX][tests] Do not run the tests which are not supported by nvptx
Some generic tests are not supported by the nvptx now. Moreover, they
are no plans to fix the tested features in nvptx. So, suggest to mark
them as UNSUPPORTED
Differential Revision: https://reviews.llvm.org/D123928
Krystian Kuzniarek [Thu, 7 Apr 2022 11:11:02 +0000 (13:11 +0200)]
[clang-format][docs] Fix incorrect 'clang-format 9' option marker
Introduced by
23a5090c6, this style option marker indicated
'clang-format 9', though its respective option was available in
an earlier release.
Differential Revision: https://reviews.llvm.org/D123299
Paul Robinson [Tue, 26 Apr 2022 14:14:27 +0000 (07:14 -0700)]
[PS5] Correctly test for analyzer defaults
Commit 5c90eca added some analyzer option checking, but a typo meant
it was redundantly checking PS4 and not adding checking for PS5.
With the test corrected, it identified the necessary driver updates,
added in this commit.
Ilya Biryukov [Tue, 26 Apr 2022 13:38:28 +0000 (13:38 +0000)]
[Index] [clangd] Support for concept declarations and requires expressions
Add support for concepts and requires expression in the clang index.
Genarate USRs for concepts.
Also change how `RecursiveASTVisitor` handles return type requirement in
requires expressions. The new code unpacks the synthetic template parameter
list used for storing the actual expression. This simplifies
implementation of the indexing. No code seems to depend on the original
traversal anyway and the synthesized template parameter list is easily
accessible from inside the requires expression if needed.
Add tests in the clangd codebase.
Fixes https://github.com/clangd/clangd/issues/1103.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D124441
Erich Keane [Tue, 26 Apr 2022 12:50:33 +0000 (05:50 -0700)]
Fix test from 5ff992 to work with win 32 bit, fix a typo.
See the discussion on D123319. Default calling convention on Windows32
bit is to have 'this-call' for member functions, so add a wildcard to
take care of that.
Also, one of the FileCheck 'match' flags was incorrect, so fix that too.
Florian Hahn [Tue, 26 Apr 2022 12:16:02 +0000 (13:16 +0100)]
[ConstraintElimination] Check if const. is small enough before using it
Check if the value of a ConstantInt is small enough to be used for
solving before calling getSExtValue.
Fixes #55085
Liqiang Tao [Tue, 26 Apr 2022 12:16:37 +0000 (20:16 +0800)]
[llvm][Inline] Remove PriorityInlineOrder in SCC inliner
Since the size of most of SCC's is 1, the PriorityInlineOrder would not change the inline
order in SCC inliner.
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D123608
Alex Zinenko [Tue, 26 Apr 2022 11:57:03 +0000 (13:57 +0200)]
[mlir] Fix -Wunused-private-field in the Transform dialect
Classes derived from TransformState::Extension may need access to the
parent state.
Florian Hahn [Tue, 26 Apr 2022 11:41:41 +0000 (12:41 +0100)]
[IPSCCP] Support unfeasible default dests for switch.
At the moment, unfeasible default destinations are not handled properly
in removeNonFeasibleEdges. So far, only unfeasible cases are removed,
but later code expects unreachable blocks to have no predecessors.
This is causing the crash reported in PR49573.
If the default destination is unfeasible it won't be executed. Create
a new unreachable block on demand and use that as default
destination.
Note that at the moment this only is relevant for cases where
resolvedUndefsIn marks the first case as executable. Regular switch
handling has a FIXME/TODO to support determining whether the default
case is feasible or not.
Fixes #48917.
Differential Revision: https://reviews.llvm.org/D113497
Nathan Sidwell [Mon, 28 Feb 2022 18:13:44 +0000 (10:13 -0800)]
[demangler] Simplify OutputBuffer initialization
Every non-testcase use of OutputBuffer contains code to allocate an
initial buffer (using either 128 or 1024 as initial guesses). There's
now no need to do that, given recent changes to the buffer extension
heuristics -- it allocates a 1k(ish) buffer on first need.
Just pass in a buffer (if any) to the constructor. Thus the
OutputBuffer's ownership of the buffer starts at its own lifetime
start. We can reduce the lifetime of this object in several cases.
That new constructor takes a 'size_t *' for the size argument, as all
uses with a non-null buffer are passing through a malloc'd buffer from
their own caller in this manner.
The buffer reset member function is never used, and is deleted.
The original buffer initialization code would return a failure code if
that first malloc failed. Existing code either ignored that, called
std::terminate with a FIXME, or returned an error code.
But that's not foolproof anyway, as a subsequent buffer extension
failure ends up calling std::terminate. I am working on addressing
that unfortunate failure mode in a manner more consistent with the C++
ABI design.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D122604
Alex Zinenko [Tue, 26 Apr 2022 11:04:41 +0000 (13:04 +0200)]
[mlir] Add a title to the Transform Dialect doc
Alexey Lapshin [Tue, 26 Apr 2022 09:45:28 +0000 (12:45 +0300)]
[llvm-objcopy][NFC] rename variable.
Martin Storsjö [Thu, 24 Mar 2022 11:17:28 +0000 (13:17 +0200)]
[compiler-rt] Use C_STANDARD instead of custom logic for adding -std=c11
Apply this in add_compiler_rt_runtime instead of manually adding it
to the individual projects. This applies the option on more
parts of compiler-rt than before, but should ideally not make any
difference assuming the other runtimes that lacked the option
also were C11 compatible.
Not marking this as required, to match the existing behaviour (where
`-std=c11` was added only if supported by the compiler).
This was suggested during the review of D110005.
Differential Revision: https://reviews.llvm.org/D124343
LLVM GN Syncbot [Tue, 26 Apr 2022 09:06:40 +0000 (09:06 +0000)]
[gn build] Port
854c33946fd4
Dmitry Makogon [Fri, 15 Apr 2022 07:59:40 +0000 (14:59 +0700)]
[RS4GC] Prune inputs of BDV if they are BDV themselves
Don't check whether an input of BDV can be pruned if the input
is the BDV itself. BDV is present in the states map, so in case
the input is the BDV itself, we'd return false. So explicitly check this case.
Differential Revision: https://reviews.llvm.org/D123846
Alexey Lapshin [Fri, 22 Apr 2022 09:58:13 +0000 (12:58 +0300)]
[llvm-gsymutil][NFC] refactor AddressRange&AddresRanges structures.
llvm-gsymutil has an implementation of AddressRange and AddressRanges
classes. That implementation might be reused in other parts of llvm.
This patch moves AddressRange and AddressRanges classes into llvm/ADT.
Differential Revision: https://reviews.llvm.org/D124350
Haojian Wu [Tue, 26 Apr 2022 08:35:53 +0000 (10:35 +0200)]
[pseudo] NFC, fix some code-style naming violations.
Jun Zhang [Sat, 9 Apr 2022 02:42:25 +0000 (10:42 +0800)]
[Clang] Use std::move in GlobalModuleIndex::readIndex. NFC
BitstreamCursors are heavy-weight objects that should not be passed by value.
Differential Revision: https://reviews.llvm.org/D123436
Xiang1 Zhang [Fri, 22 Apr 2022 06:59:53 +0000 (14:59 +0800)]
[X86] Add use condition for combineSetCCMOVMSK
Reviewed by RKSimon, LuoYuanke
Differential Revision: https://reviews.llvm.org/D123652
Haojian Wu [Mon, 25 Apr 2022 13:42:35 +0000 (15:42 +0200)]
[clang] Fix a constant evaluator crash on a NULL-type expr.
Differential Revision: https://reviews.llvm.org/D124384
Christudasan Devadasan [Tue, 26 Apr 2022 06:45:08 +0000 (12:15 +0530)]
[AMDGPU] Vector register spill test cleanup (NFC)
The vector register spills have no dependency with
SILowerSGPRSpills pass anymore. The entire handling
has been moved to PrologEpilogInserter with D55301.
Siva Chandra [Tue, 26 Apr 2022 07:25:12 +0000 (00:25 -0700)]
[libc] Add stdio entrypoints to aarch64 fullbuild.
Siva Chandra [Tue, 26 Apr 2022 07:09:35 +0000 (00:09 -0700)]
[libc][Obvious] Add deps of fopencookie_test only if it is enabled.
Luo, Yuanke [Sun, 24 Apr 2022 08:31:43 +0000 (16:31 +0800)]
[X86][AMX] Report error when shapes are not pre-defined.
Instead of report fatal error, this patch emit error message and exit
when shapes are not pre-defined. This would cause the compiling fail but
not crash.
Differential Revision: https://reviews.llvm.org/D124342
Nikolas Klauser [Sat, 23 Apr 2022 08:07:24 +0000 (10:07 +0200)]
[libc++] Remove <functional> includes
Reviewed By: var-const, #libc, ldionne
Spies: #libc_vendors, ldionne, libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D124123
Balazs Benics [Tue, 26 Apr 2022 06:49:05 +0000 (08:49 +0200)]
[analyzer] Fix ValistChecker false-positive involving symbolic pointers
In the following example:
int va_list_get_int(va_list *va) {
return va_arg(*va, int); // FP
}
The `*va` expression will be something like `Element{SymRegion{va}, 0, va_list}`.
We use `ElementRegions` for representing the result of the dereference.
In this case, the `IsSymbolic` was set to `false` in the
`getVAListAsRegion()`.
Hence, before checking if the memregion is a SymRegion, we should take
the base of that region.
Analogously to the previous example, one can craft other cases:
struct MyVaList {
va_list l;
};
int va_list_get_int(struct MyVaList va) {
return va_arg(va.l, int); // FP
}
But it would also work if the `va_list` would be in the base or derived
part of a class. `ObjCIvarRegions` are likely also susceptible.
I'm not explicitly demonstrating these cases.
PS: Check the `MemRegion::getBaseRegion()` definition.
Fixes #55009
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D124239
Serge Pavlov [Sun, 10 Oct 2021 15:46:58 +0000 (22:46 +0700)]
Intrinsic for checking floating point class
This change introduces a new intrinsic, `llvm.is.fpclass`, which checks
if the provided floating-point number belongs to any of the the specified
value classes. The intrinsic implements the checks made by C standard
library functions `isnan`, `isinf`, `isfinite`, `isnormal`, `issubnormal`,
`issignaling` and corresponding IEEE-754 operations.
The primary motivation for this intrinsic is the support of strict FP
mode. In this mode using compare instructions or other FP operations is
not possible, because if the value is a signaling NaN, floating-point
exception `Invalid` is raised, but the aforementioned functions must
never raise exceptions.
Currently there are two solutions for this problem, both are
implemented partially. One of them is using integer operations to
implement the check. It was implemented in https://reviews.llvm.org/D95948
for `isnan`. It solves the problem of exceptions, but offers one
solution for all targets, although some can do the check in more
efficient way.
The other, implemented in https://reviews.llvm.org/D96568, introduced a
hook 'clang::TargetCodeGenInfo::testFPKind', which injects a target
specific code into IR to implement `isnan` and some other functions. It is
convenient for targets that have dedicated instruction to determine FP data
class. However using target-specific intrinsic complicates analysis and can
prevent some optimizations.
A special intrinsic for value class checks allows representing data class
tests with enough flexibility. During IR transformations it represents the
check in target-independent way and saves it from undesired transformations.
In the instruction selector it allows efficient lowering depending on the
used target and mode.
This implementation is an extended variant of `llvm.isnan` introduced
in https://reviews.llvm.org/D104854. It is limited to minimal intrinsic
support. Target-specific treatment will be implemented in separate
patches.
Differential Revision: https://reviews.llvm.org/D112025
Tanya Lattner [Tue, 26 Apr 2022 05:32:56 +0000 (22:32 -0700)]
Provide the complete response and reporting Code of Conduct documentation. Remove the word draft from all documents, add information about the CoC committee expectations and add a place for transparency reports.
This patch provides the response and reporting guides for Code of Conduct reports. It also removes the word draft from all the documents,
adds information about the CoC committee, and a place to put transparency reports. A post will also be made on Discourse to provide more details about the history of the code of conduct, this patch, and next steps. Please see that post for full details. I will put a link below once I have it.
Reviewed By: aaron.ballman, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D122937
Walter Erquinigo [Wed, 20 Apr 2022 04:57:31 +0000 (21:57 -0700)]
[NFC][trace] simplify the instruction dumper
TraceInstructionDumper::DumpInstructions was becoming too big, so I'm
refactoring it into smaller functions. I also made some static methods proper
instance methods to simplify calls. Other minor improvements are also done.
Differential Revision: https://reviews.llvm.org/D124064
Lian Wang [Thu, 21 Apr 2022 03:17:31 +0000 (03:17 +0000)]
[RISCV][SelectionDAG] Support VP_ADD/VP_MUL/VP_SUB mask operations
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D124144