Johannes Doerfert [Thu, 10 Jun 2021 22:13:22 +0000 (17:13 -0500)]
[Attributor] Teach AAPotentialValues about constant select conditions
There was a TODO but now we actually check if the select condition is
assumed constant and only look at the relevant operand.
Johannes Doerfert [Sat, 26 Jun 2021 00:19:19 +0000 (19:19 -0500)]
[Attributor][NFC] Clang format
Johannes Doerfert [Thu, 24 Jun 2021 17:04:46 +0000 (12:04 -0500)]
[InstCombine] Gracefully handle an alloca outside the alloca-AS
While we might eventually want to disallow allocas that do not have the
alloca-AS set, it seems undesirable to crash on them. Add a cast when
required so that we can support such allocas (at least here).
Differential Revision: https://reviews.llvm.org/D104866
Balazs Benics [Tue, 29 Jun 2021 14:35:07 +0000 (16:35 +0200)]
[analyzer] Make CheckerManager::hasPathSensitiveCheckers() complete again
It turns out that the CheckerManager::hasPathSensitiveCheckers() missed
checking for the BeginFunctionCheckers.
It seems like other callbacks are also missing:
- ObjCMessageNilCheckers
- BeginFunctionCheckers
- NewAllocatorCheckers
- PointerEscapeCheckers
- EndOfTranslationUnitCheckers
In this patch, I wanted to use a fold-expression, but until C++17
arrives we are left with the old-school method.
When I tried to write a unittest I observed an interesting behavior. I
subscribed only to the BeginFunction event, it was not fired.
However, when I also defined the PreCall with an empty handler, suddenly
both fired.
I could add this test demonstrating the issue, but I don't think it
would serve much value in a long run. I don't expect regressions for
this.
However, I think it would be great to enforce the completeness of this
list in a runtime check.
I could not come up with a solution for this though.
PS: Thank you @Szelethus for helping me debugging this.
Differential Revision: https://reviews.llvm.org/D105101
Reviewed by: vsavchenko
David Sherwood [Tue, 29 Jun 2021 14:20:11 +0000 (15:20 +0100)]
Revert "[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable"
This reverts commit
9dde51416209a5552156384b9c2b08b676818d70.
Dylan Fleming [Tue, 29 Jun 2021 13:00:49 +0000 (14:00 +0100)]
[SVE] Added CodeGen support for inserting an element into a predicate vector
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D104722
Jeremy Morse [Tue, 29 Jun 2021 12:48:49 +0000 (13:48 +0100)]
[DebugInstrRef][3/3] Follow DBG_PHI instructions through LiveDebugValues
This patch reads machine value numbers from DBG_PHI instructions (marking
where SSA PHIs used to be), and matches them up with DBG_INSTR_REF
instructions that refer to them. Essentially they are two separate parts of
a DBG_VALUE: the place to read the value (register and program position),
and where the variable is assigned that value.
Sometimes these DBG_PHIs can be duplicated, usually by tail duplication.
This corresponds to the SSA structure of the program being destroyed, and
the original PHI being split. When this happens: run LLVMs standard
SSAUpdater utility, to work out what values should appear in which blocks.
The majority of this patch is boilerplate to make use of SSAUpdater.
If there are any additional PHIs on the path between multiple DBG_PHIs and
their using DBG_INSTR_REF, their existance is validated, just in case a
value gets clobbered along the way (see dbg-phis-with-loops.mir for
several examples).
Differential Revision: https://reviews.llvm.org/D86814
Ben Shi [Tue, 29 Jun 2021 13:44:50 +0000 (21:44 +0800)]
[AVR] Fix a bug in prologue of ISR
The r1 register should be cleared in prologue of ISR as it is used
as constant zero.
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D99467
Simon Pilgrim [Tue, 29 Jun 2021 13:36:20 +0000 (14:36 +0100)]
[X86] Add cmov i33 sgt test case
Suggested on D101074 - add a 'icmp sgt i64 %0, -
2147483649' comparison that can fold to 'icmp sge i64 %0, -
2147483648' on D101074 allowing i32 immediate folding
David Sherwood [Tue, 29 Jun 2021 13:28:49 +0000 (14:28 +0100)]
[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
Nicolas Vasilache [Thu, 24 Jun 2021 13:58:57 +0000 (13:58 +0000)]
[mlir][Linalg] NFC - Drop AliasInfo::existsNonDominatingRead
The case where a non-dominating read can be found is captured by slightly generalizing `AliasInfo::wouldCreaateReadAfterWriteInterference`.
This simplification will make it easier to implement bufferization across function call.
APIs are also simplified were possible.
Differential revision: https://reviews.llvm.org/D104845
Nico Weber [Tue, 29 Jun 2021 13:21:33 +0000 (09:21 -0400)]
[lld/mac] Make symbol table order deterministic
SymtabSection::emitStabs() writes the symbol table in the order
of externalSymbols, which has the order of symtab->getSymbols(),
which is just the order symbols are added to the symbol table.
In practice, symbols in the symbol files of input .o files are
sorted, but since that's not guaranteed we sort them in
ObjFile::parseSymbols(). To make sure several symbols with the same
address keep the order they're in the input file, we have to use
stable_sort().
In practice, std::sort() on already-sorted inputs won't change the order
of just adjacent elements, and while in theory std::sort() could use a
random pivot, in practice the code should be deterministic as it was
previously too.
But now lld/test/MachO/stabs.s passes with LLVM_ENABLE_EXPENSIVE_CHECKS=ON
(the last test that was failing with that set).
Fixes a regression from D99972.
While here, remove an empty section in stabs.s and move
.subsections_via_symbols to the end where it usually is (this part no
behavior change).
Differential Revision: https://reviews.llvm.org/D105071
Tim Northover [Tue, 29 Jun 2021 13:19:01 +0000 (14:19 +0100)]
ARM: fix vacuously true assertion to actually check what it should. NFC.
Florian Hahn [Tue, 29 Jun 2021 13:11:46 +0000 (14:11 +0100)]
[SCCP] Add tests with urem/srem with 2 constant operands.
Reduced test case for PR49731.
David Sherwood [Tue, 29 Jun 2021 12:47:00 +0000 (13:47 +0100)]
Revert "[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable"
This reverts commit
dcfc2c3fac980b137415c17f2f19c06c3e2bd7fb.
Felipe de Azevedo Piovezan [Tue, 29 Jun 2021 12:57:16 +0000 (14:57 +0200)]
[mlir] Add support for LLVM's dso_local attr
This patch brings support for setting runtime preemption specifiers of
LLVM's GlobalValues. In LLVM semantics, if the `dso_local` attribute
is not explicitly requested, then it is inferred based on linkage and
visibility. We model this same behavior with a UnitAttribute: if it is
present, then we explicitly request the GlobalValue to marked as
`dso_local`, otherwise we rely on the GlobalValue itself to make this
decision.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D104983
Alex Zinenko [Tue, 29 Jun 2021 12:13:01 +0000 (14:13 +0200)]
[mlir] Remove SDBM
This data structure and algorithm collection is no longer in use.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D105102
Florian Hahn [Tue, 29 Jun 2021 10:54:52 +0000 (11:54 +0100)]
[LV] Fix crash when target instruction for sinking is dead.
This patch fixes a crash when the target instruction for sinking is
dead. In that case, no recipe is created and trying to get the recipe
for it results in a crash. To ensure all sink targets are alive, find &
use the first previous alive instruction.
Note that the case where the sink source is dead is already handled.
Found by
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35320
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D104603
Alexey Bataev [Tue, 29 Jun 2021 12:25:44 +0000 (05:25 -0700)]
[InstCombine]Add a test for reductions after shuffles, NFC.
Florian Mayer [Mon, 21 Jun 2021 18:55:31 +0000 (19:55 +0100)]
[hwasan] Display causes in order of probability.
A heap or global buffer that is far away from the faulting address is
unlikely to be the cause, especially if there is a potential
use-after-free as well, so we want to show it after the other
causes.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104781
Florian Mayer [Tue, 29 Jun 2021 10:56:19 +0000 (11:56 +0100)]
Revert "[hwasan] print exact mismatch offset for short granules."
Broke x86 LAM bot.
This reverts commit
2a60ab76a796637d49bf1c7191f5b5a0c92f81bc.
David Sherwood [Thu, 17 Jun 2021 08:48:30 +0000 (09:48 +0100)]
[LoopVectorize] Add support for scalable vectorization of invariant stores
Previously in setCostBasedWideningDecision if we encountered an
invariant store we just assumed that we could scalarize the store
and called getUniformMemOpCost to get the associated cost.
However, for scalable vectors this is not an option because it is
not currently possibly to scalarize the store. At the moment we
crash in VPReplicateRecipe::execute when trying to scalarize the
store.
Therefore, I have changed setCostBasedWideningDecision so that if
we are storing a scalable vector out to a uniform address and the
target supports scatter instructions, then we should use those
instead.
Tests have been added here:
Transforms/LoopVectorize/AArch64/sve-inv-store.ll
Differential Revision: https://reviews.llvm.org/D104624
Butygin [Sat, 26 Jun 2021 10:05:29 +0000 (13:05 +0300)]
[mlir] Add MemoryEffects::Allocate to memref::CloneOp
Without it BufferDeallocationPass process only CloneOps created during pass itself and ignore all CloneOps that were already present in IR.
For our specific usecase:
```
func @dealloc_existing_clones(%arg0: memref<?x?xf64>, %arg1: memref<?x?xf64>) -> memref<?x?xf64> {
return %arg0 : memref<?x?xf64>
}
```
Input arguments will be freed immediately after return from function and we want to prolong lifetime for the returned argument.
To achieve this we explicitly add clones to all input memrefs and expect that BufferDeallocationPass will add correct deallocs to them (unnessesary clone+dealloc pairs will be canonicalized away later).
Differential Revision: https://reviews.llvm.org/D104973
Roman Lebedev [Tue, 29 Jun 2021 10:25:32 +0000 (13:25 +0300)]
[NFC][InstCombine] foldAggregateConstructionIntoAggregateReuse(): cast to Instruction eagerly
In all of these, the value must be an instruction for us to succeed anyway,
so change it to maybe hopefully make further changes more straight-forward.
Chia-hung Duan [Tue, 29 Jun 2021 10:03:30 +0000 (18:03 +0800)]
[mlir-reduce] Add doc for usage of mlir-reduce
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D103683
David Green [Tue, 29 Jun 2021 10:03:19 +0000 (11:03 +0100)]
[ARM] Fold extract of ARM_BUILD_VECTOR
This adds a small fold for extract (ARM_BUILD_VECTOR) to fold to the
original node. This can help simplify the resulting codegen in some
cases.
Differential Revision: https://reviews.llvm.org/D104860
Valeriy Savchenko [Tue, 29 Jun 2021 09:59:41 +0000 (12:59 +0300)]
[analyzer] Fix SValTest for LocAsInt test
LLVM GN Syncbot [Tue, 29 Jun 2021 09:44:27 +0000 (09:44 +0000)]
[gn build] Port
9b02a9b40150
LLVM GN Syncbot [Tue, 29 Jun 2021 09:44:26 +0000 (09:44 +0000)]
[gn build] Port
159024ce2315
Valeriy Savchenko [Fri, 18 Jun 2021 11:16:18 +0000 (14:16 +0300)]
[analyzer] Implement getType for SVal
This commit adds a function to the top-class of SVal hierarchy to
provide type information about the value. That can be extremely
useful when this is the only piece of information that the user is
actually caring about.
Additionally, this commit introduces a testing framework for writing
unit-tests for symbolic values.
Differential Revision: https://reviews.llvm.org/D104550
Ole Strohm [Wed, 23 Jun 2021 09:52:58 +0000 (10:52 +0100)]
[OpenCL] Fix qualifiers check on binding references to temporaries
Fix the qualifiers check from PR49733.
Fixes: PR49733
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D103962
Med Ismail Bennani [Mon, 28 Jun 2021 19:27:55 +0000 (19:27 +0000)]
[lldb/Interpreter] Fix session-save-on-quit when using ^D
Previously, when `interpreter.save-session-on-quit` was enabled, lldb
would save the session transcript only when running the `quit` command.
This patch changes that so the transcripts are saved when the debugger
object is destroyed if the setting is enabled.
rdar://
72902650
Differential Revision: https://reviews.llvm.org/D105038
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Mon, 28 Jun 2021 17:41:26 +0000 (17:41 +0000)]
[lldb/Interpreter] Add setting to set session transcript save directory
This patch introduces a new interpreter setting
`interpreter.save-session-directory` so the user can specify a directory
where the session transcripts will be saved.
If not set, the session transcript are saved on a temporary file.
rdar://
72902842
Differential Revision: https://reviews.llvm.org/D105030
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Tianqing Wang [Tue, 29 Jun 2021 08:06:45 +0000 (16:06 +0800)]
[X86] Add a test to reveal a bug in CMOV conversion.
CMOV conversion first rewrites all CMOVs with memory load to branches.
Then runs a second pass to convert other CMOVs in loops if profitable.
But the first pass doesn't add new basic blocks to MachineLoopInfo,
CMOVs in these blocks are ignored in the subsequent pass.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D104692
Bruno De Fraine [Tue, 29 Jun 2021 07:46:27 +0000 (09:46 +0200)]
PR50767: clear non-distinct debuginfo for function with nodebug definition after undecorated declaration
Fix suggested by Yuanfang Chen:
Non-distinct debuginfo is attached to the function due to the undecorated declaration. Later, when seeing the function definition and `nodebug` attribute, the non-distinct debuginfo should be cleared.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D104777
Diana Picus [Fri, 11 Jun 2021 08:05:30 +0000 (08:05 +0000)]
[flang] Add runtime interface for SYSTEM_CLOCK
SYSTEM_CLOCK may take up to 3 optional parameters, all of which are
INTENT(OUT). The COUNT and COUNT_MAX parameters are integer scalars,
while COUNT_RATE may be a real or integer scalar.
This patch breaks up the interface into 3 different functions, one for
each parameter. All 3 return integers. It is up to lowering to convert
the results to the preferred type.
Differential Revision: https://reviews.llvm.org/D104851
Florian Hahn [Tue, 29 Jun 2021 07:56:50 +0000 (08:56 +0100)]
[BasicAA] Be more careful with modulo ops on VariableGEPIndex.
(V * Scale) % X may not produce the same result for any possible value
of V, e.g. if the multiplication overflows. This means we currently
incorrectly determine NoAlias in some cases.
This patch updates LinearExpression to track whether the expression
has NSW and uses that to adjust the scale used for alias checks.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D99424
Soham Dixit [Tue, 29 Jun 2021 08:18:21 +0000 (09:18 +0100)]
[DebugInfo] Bug 41152 - Improve dumping of empty location expressions
Fixes PR41152 (https://bugs.llvm.org/show_bug.cgi?id=41152).
Reviewed by: jhenderson, dblaikie, SouraVX
Differential Revision: https://reviews.llvm.org/D103502
Alexander Shaposhnikov [Tue, 29 Jun 2021 08:18:48 +0000 (01:18 -0700)]
Revert "[llvm-objcopy][MachO] Minor code cleanup"
This reverts commit
c94cf97b53566a26245c54ea0c41b0dc83daf8a0
since it appears to have broken linaro-clang-armv7-quick build bot
and needs further investigation.
David Sherwood [Mon, 28 Jun 2021 15:40:19 +0000 (16:40 +0100)]
[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
Tianqing Wang [Tue, 29 Jun 2021 07:34:30 +0000 (15:34 +0800)]
[X86] Add -mgeneral-regs-only support.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D103943
Tobias Gysi [Tue, 29 Jun 2021 06:54:39 +0000 (06:54 +0000)]
[mlir][linalg] All StructuredOp parameters are inputs or outputs.
Adapt the StructuredOp verifier to ensure all operands are either in the input or the output group. The change is possible after adding support for scalar input operands (https://reviews.llvm.org/D104220).
Differential Revision: https://reviews.llvm.org/D104783
Alexander Belyaev [Tue, 29 Jun 2021 06:55:25 +0000 (08:55 +0200)]
Revert "[mlir] Skip scalar operands when tiling to linalg.tiled_loop."
This reverts commit
69046b4a79e2670053362112aa467f89faf9e53e. It did not
really break anything, but it was decided to allow scalars and other
non-shaped operands for tiled_loop.
Siva Chandra [Tue, 29 Jun 2021 05:24:00 +0000 (22:24 -0700)]
[libc][Obvious] Fix typo in implementation of aarch64 clearExcept.
Instead of reading and updating the status word, control word was being
updated.
David Blaikie [Tue, 29 Jun 2021 05:55:55 +0000 (22:55 -0700)]
Revert "[Clang] Add option to handle behaviour of vector bool/vector pixel."
This reverts commit
c3fe847f9d90de5a6a76fd1d5f5823ab4719accc.
Tests fail in non-asserts builds because they assume named IR, by the
looks of it (testing for the "entry" label, for instance). I don't know
enough about the update_cc_test_checks.py stuff to know how to manually
fix these tests, so reverting for now.
Alexander Shaposhnikov [Tue, 29 Jun 2021 05:50:39 +0000 (22:50 -0700)]
[llvm-objcopy][MachO] Minor code cleanup
Remove unnecessary template in MachOReader.cpp. NFC.
Xiang1 Zhang [Wed, 23 Jun 2021 05:54:10 +0000 (13:54 +0800)]
[X86] Zero some outputs of Kelocker intrinsics in error case
Reviewed By: WangPengfei
Differential Revision: https://reviews.llvm.org/D104766
Ben Shi [Tue, 29 Jun 2021 03:15:00 +0000 (11:15 +0800)]
[AVR][clang] Fix wrong calling convention in functions return struct type
According to AVR ABI (https://gcc.gnu.org/wiki/avr-gcc), returned struct value
within size 1-8 bytes should be returned directly (via register r18-r25), while
larger ones should be returned via an implicit struct pointer argument.
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D99237
Kai Luo [Tue, 29 Jun 2021 03:13:55 +0000 (03:13 +0000)]
[AIX][compiler-rt] Deliver libatomic.a at top level library directory
Install libatomic.a in top level library directory so that compiler can find it in search directories.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D104908
Greg Clayton [Tue, 29 Jun 2021 02:59:24 +0000 (19:59 -0700)]
Fix failing tests after https://reviews.llvm.org/D104488.
Synthetic names no longer have the shared library name appended to the end.
Michael Liao [Tue, 29 Jun 2021 02:48:26 +0000 (22:48 -0400)]
Fix `-Wunused-variable` warning. NFC.
Michael Liao [Wed, 26 May 2021 00:21:21 +0000 (20:21 -0400)]
[MIRParser] Add machine metadata.
- Add standalone metadata parsing support so that machine metadata nodes
could be populated before and accessed during MIR is parsed.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D103282
Xun Li [Tue, 29 Jun 2021 02:28:27 +0000 (19:28 -0700)]
[Coroutines] Remove CoroElide from O0 pipeline
CoroElide pass works only when a post-split coroutine is inlined into another post-split coroutine.
In O0, there is no inlining after CoroSplit, and hence no CoroElide can happen.
It's useless to put CoroElide pass in the O0 pipeline and it will never be triggered (unless I miss anything).
Differential Revision: https://reviews.llvm.org/D105066
Leonard Grey [Tue, 29 Jun 2021 02:22:21 +0000 (22:22 -0400)]
[lld-macho] Preserve alignment for non-deduplicated cstrings
Fixes PR50637.
Downstream bug: https://crbug.com/1218958
Currently, we split __cstring along symbol boundaries with .subsections_via_symbols
when not deduplicating, and along null bytes when deduplicating. This change splits
along null bytes unconditionally, and preserves original alignment in the non-
deduplicated case.
Removing subsections-section-relocs.s because with this change, __cstring
is never reordered based on the order file.
Differential Revision: https://reviews.llvm.org/D104919
harsh-nod [Tue, 29 Jun 2021 01:40:49 +0000 (18:40 -0700)]
[mlir][vector] Order parallel indices before transposing the input in multireductions
The current code does not preserve the order of the parallel
dimensions when doing multi-reductions and thus we can end
up in scenarios where the result shape does not match the
desired shape after reduction.
This patch fixes that by ensuring that the parallel indices
are in order and then concatenates them to the reduction dimensions
so that the reduction dimensions are innermost.
Differential Revision: https://reviews.llvm.org/D104884
Greg Clayton [Mon, 28 Jun 2021 23:32:36 +0000 (16:32 -0700)]
Fix a case where multiple symbols with zero size would cause duplicate entries in gsym files.
Symbol tables can have symbols with no size in mach-o files that were failing to get combined into a single entry. This resulted in many duplicate entries for the same address and made gsym files larger.
Differential Revision: https://reviews.llvm.org/D105068
Greg Clayton [Tue, 29 Jun 2021 01:12:05 +0000 (18:12 -0700)]
Fix buildbot failure after https://reviews.llvm.org/D104488.
Greg Clayton [Thu, 17 Jun 2021 21:22:24 +0000 (14:22 -0700)]
Create synthetic symbol names on demand to improve memory consumption and startup times.
This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool.
Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index.
This patch fixes the issue by:
- not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed
- doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen
- removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool
Prior to this fix the startup times for a large application was:
12.5 seconds (cold file caches)
8.5 seconds (warm file caches)
After this fix:
9.7 seconds (cold file caches)
5.7 seconds (warm file caches)
The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name.
Differential Revision: https://reviews.llvm.org/D104488
River Riddle [Mon, 28 Jun 2021 22:46:05 +0000 (22:46 +0000)]
[vscode-mlir] Add support for restarting the server on setting/server changes
This revision adds detection for changes to either the mlir-lsp-server binary or the setting, and prompts the user to restart the server. Whether the user gets prompted or not is a configurable setting in the extension, and this setting may updated based on the user response to the prompt.
Differential Revision: https://reviews.llvm.org/D104501
Lang Hames [Mon, 28 Jun 2021 22:59:02 +0000 (08:59 +1000)]
[JITLink][ELF] Move ELF section and symbol parsing into ELFLinkGraphBuilder.
Move architecture independent ELF parsing/graph-building code from
ELFLinkGraphBuilder_x86_64 to the ELFLinkGraphBuilder base class template.
Philip Reames [Mon, 28 Jun 2021 23:00:32 +0000 (16:00 -0700)]
Precommit miscompile test from D103700
Stanislav Mekhanoshin [Mon, 28 Jun 2021 20:37:45 +0000 (13:37 -0700)]
[IR] Fix replaceUsesWithIf ponetial issue with constants
There can be a use after free in the Value::replaceUsesWithIf()
if two uses point to the same constant. Patch defers handling
of the constants past the iterator scan.
Another potential issue is that handleOperandChange updates all
the uses in a given Constant, not just the one passed to
ShouldReplace. Added a FIXME comment.
Both issues are not currently exploitable as the only use of
this call with constants avoids it.
Differential Revision: https://reviews.llvm.org/D105061
Joseph Huber [Mon, 28 Jun 2021 19:56:10 +0000 (15:56 -0400)]
[OpenMP] Run the OpenMPOpt module pass at O1
Now that the OpenMPOpt module pass include important optimizations for removing
globalization from offloading regions it should be run at a lower optimization
level.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105056
Nico Weber [Mon, 28 Jun 2021 19:29:16 +0000 (15:29 -0400)]
[lld/mac] Fix nondeterminism in output section ordering
The two different thread_local_regular sections (__thread_data and
more_thread_data) had nondeterminstic ordering for two reasons:
1. https://reviews.llvm.org/D102972 changed concatOutputSections
from MapVector to DenseMap, so when we iterate it to make
output segments, we would add the two sections to the __DATA
output segment in nondeterministic order.
2. The same change also moved the two stable_sort()s for segments
and sections to sort(). Since sections with assigned priority
(such as TLV data) have the same priority for all sections,
this is incorrect -- we must use stable_sort() so that the
initial (input-order-based) order remains.
As a side effect, we now (deterministically) put the __common
section in front of __bss (while previously we happened to
put it after it). (__common and __bss are both zerofill so
both have order INT_MAX, but common symbols are added to
inputSections before normal sections are collected.)
Makes lld/test/MachO/tlv.s and lld/test/MachO/tlv-dylib.s pass with
LLVM_ENABLE_EXPENSIVE_CHECKS=ON.
Differential Revision: https://reviews.llvm.org/D105054
Hongtao Yu [Mon, 28 Jun 2021 19:32:43 +0000 (12:32 -0700)]
[UniqueLinkageName] Use exsiting GlobalDecl object instead of reconstructing one.
C++ constructors/destructors need to go through a different constructor to construct a GlobalDecl object in order to retrieve their linkage type. This causes an assert failure in the default constructor of GlobalDecl. I'm chaning it to using the exsiting GlobalDecl object.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D102356
Muhammad Omair Javaid [Mon, 28 Jun 2021 21:14:17 +0000 (21:14 +0000)]
[LLDB] dotest.py set selected_platform on remote connection
This patch fixes a bug in dotest.py where lldb.selected_platform was
being set to host platform even after a successful connection to a
remote platform via platform url. This patch fixes this behavior and
sets selected_platform to remote_platform after a successful connection.
This patch also removes target_platform variable from run_suite.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D105060
Scott Linder [Mon, 28 Jun 2021 19:40:45 +0000 (19:40 +0000)]
[DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:
* DIExpression can currently be parsed from IR or read from bitcode
as `distinct`, but this property is silently dropped when printing
to IR. This causes accepted IR to fail to round-trip. As DIExpression
appears inline at each use in the canonical form of IR, it cannot
actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
restricted to only appearing in contexts where there is no syntax for
`distinct`, but for consistency it is treated equivalently to
DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
along with adding general support for the inverse restriction I went
ahead and described this in Metadata.def and updated the parser to be
general. Future nodes which have this restriction can share this
support.
The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.
The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.
A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:
!named = !{!0}
!0 = !DIExpression()
Instead we would only accept the equivalent inlined version:
!named = !{!DIExpression()}
This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:
!named = !{!0}
; error: 'distinct' not allowed for !DIExpression()
!0 = distinct !DIExpression()
Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.
Reviewed By: StephenTozer, t-tye
Differential Revision: https://reviews.llvm.org/D104827
Nikita Popov [Sat, 26 Jun 2021 13:42:49 +0000 (15:42 +0200)]
[AsmWriter] Properly handle uselistorder for global symbols
Currently, AsmWriter will stick uselistorder directives for global
values inside individual functions. This doesn't make a lot of sense,
and interacts badly with D104950, as use list order adjustments will
be performed while still working on a forward reference.
This patch instead always prints uselistorder directives for globals
at the module level. This isn't really compatible with the previously
used implementation approach. Rather than walking through all values
again, use the OrderMap (after stabilizing its order) to go through
all values and compute the use list shuffles for them. Classify them
per-function, or nullptr for globals.
Even independently of D104950, this seems to fix a few
verify-uselistorder failures. Conveniently, there is even a
pre-existing failing test that this fixes.
Differential Revision: https://reviews.llvm.org/D104976
Joseph Huber [Mon, 28 Jun 2021 19:34:15 +0000 (15:34 -0400)]
[OpenMP][Documentation] Add FAQ entry for CMake module
This patch adds documentation for using the CMake find module for OpenMP
target offloading provided by LLVM. It also removes the requirement for
AMD's architecture to be set as this isn't necessary for upstream LLVM.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105051
Joseph Huber [Mon, 28 Jun 2021 19:21:18 +0000 (15:21 -0400)]
[OpenMP][Documentation] Add OpenMPOpt optimization section
Add some information about the optimizations currently provided by
OpenMPOpt. Every optimization performed should eventually be listed
here.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105050
Alexander Belyaev [Mon, 28 Jun 2021 20:20:30 +0000 (22:20 +0200)]
[mlir] Skip scalar operands when tiling to linalg.tiled_loop.
We are interested only in tensors/memrefs when creating a TiledLoopOp.
Differential Revision: https://reviews.llvm.org/D105059
Sanjay Patel [Mon, 28 Jun 2021 20:37:10 +0000 (16:37 -0400)]
[InstCombine] don't try to fold a constant expression that can trap (PR50906)
We could use a bigger hammer and bail out on any constant
expression, but there's a regression test that appears to
validly do the transform (although it may not have been
intending to check that optimization).
Sanjay Patel [Mon, 28 Jun 2021 19:57:38 +0000 (15:57 -0400)]
[InstCombine][test] add test for potential miscompile with constant expression; NFC (PR50906)
Nick Desaulniers [Mon, 28 Jun 2021 20:53:55 +0000 (13:53 -0700)]
[IR] remove assert since always_inline can appear on CallBase
I added an assertion in D91816 (documenting behavior added in D93422)
that callers and callees with mismatched fn attr's related to stack
protectors should not occur unless the callee was attributed
always_inline.
This falls apart when a call, invoke, or callbr (any instruction
inheriting from CallBase) itself has an always_inline attribute. Clang
will emit such attributes on Instructions when __attribute__((flatten))
is used to recursively force inlining from a caller.
Since these assertions only had the caller and callee Functions, and not
the call site (CallBase derived classes), we would have to search the
caller for such instructions to reconstruct the call site information.
But at that point, inlining has already occurred; the call site has
already been removed from the caller.
Remove the assertions, add a unit test for always_inline call sites, and
update the LangRef.
Another curiosity is that the always_inline Attribute on Instructions is
only expanded by the inline pass, not the always_inline pass.
Thanks to @pcc on this report when building Android's RunTime (ART)
interpreter.
Reviewed By: pcc, MaskRay
Differential Revision: https://reviews.llvm.org/D104944
Nick Desaulniers [Mon, 28 Jun 2021 20:52:41 +0000 (13:52 -0700)]
[Test] rewrite inline_nossp.ll
While adding remark based tests in D104944, I noticed that the tests
that we were passing were passing for the wrong reason. They were
passing because the dynamic allocas were preventing inlining, not the
code I added in D91816.
Rewrite and simplify the test. Add remark based checks to validate we're
preventing inline substitutions for the right reasons.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D104958
Joseph Huber [Fri, 25 Jun 2021 00:42:31 +0000 (20:42 -0400)]
[OpenMP] Prevent OpenMPOpt from internalizing uncalled functions
Currently OpenMPOpt will only check if a function is a kernel before deciding not to internalize it. Any uncalled function that gets internalized will be trivially dead in the module so this is unnnecessary.
Depends on D102423
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104890
Jacques Pienaar [Mon, 28 Jun 2021 20:42:16 +0000 (13:42 -0700)]
[drr] Enable specifying range in NativeCodeCall replacement.
This enables creating a replacement rule where range of positional replacements
need not be spelled out, or are not known (e.g., enable having a rewrite that
forward all operands to a call generically).
Differential Revision: https://reviews.llvm.org/D104955
Eugene Zhulenev [Mon, 28 Jun 2021 20:15:24 +0000 (13:15 -0700)]
[mlir] Destroy MLIRContext thread pool when disable multi threading
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D105057
Nikita Popov [Mon, 28 Jun 2021 19:12:12 +0000 (21:12 +0200)]
[SanitizerCoverage] Support opaque pointers
Pass element type rather than pointer type to some functions, so
we know which type to use for the global variables.
Scott Linder [Mon, 28 Jun 2021 19:54:14 +0000 (19:54 +0000)]
[ADT] Add makeVisitor to STLExtras.h
Relands patch reverted by
61242c0addb120294211d24a97ed89837418cb36
The original patch mistakenly included unrelated tests.
Adds a utility to combine multiple Callables into a single Callable.
This is useful to make constructing a visitor for `std::visit`-like
functions more natural; functions like this will be added in future
patches.
Intended to supercede https://reviews.llvm.org/D99560 by
perfectly-forwarding the combined Callables.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D100670
Duncan P. N. Exon Smith [Fri, 25 Jun 2021 23:38:41 +0000 (16:38 -0700)]
IR: Fix use-list-order round-tripping for br
Fix the use-list-order for br instructions by setting the operands in
order of their index to match the use-list-order prediction. The case
where this matters is when there is a condition but the if-true and
if-false branches are identical.
Bug was found when reviewing failures pointed at by
https://reviews.llvm.org/D104950. Fix is similar to
3cf415c6c367ced43175ebd1dc4bd9582c7f5376.
Differential Revision: https://reviews.llvm.org/D104959
Scott Linder [Mon, 28 Jun 2021 19:51:25 +0000 (19:51 +0000)]
Revert "[ADT] Add makeVisitor to STLExtras.h"
This reverts commit
14a8aa615597ef0aa424ac9545906bf8b9865063.
Mistakenly landed this before a patch it should depend on was accepted.
Melanie Blower [Mon, 28 Jun 2021 19:47:03 +0000 (15:47 -0400)]
Revert "[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options"
This reverts commit
2dbe1c675fe94eeb7973dcc25b049d25f4ca4fa0.
More buildbot failures
Nikita Popov [Mon, 28 Jun 2021 19:24:16 +0000 (21:24 +0200)]
[Verifier] Support opaque pointers for global_ctors
Adjust the assertion to allow opaque pointers.
Scott Linder [Mon, 28 Jun 2021 18:54:41 +0000 (18:54 +0000)]
[ADT] Add makeVisitor to STLExtras.h
Adds a utility to combine multiple Callables into a single Callable.
This is useful to make constructing a visitor for `std::visit`-like
functions more natural; functions like this will be added in future
patches.
Intended to supercede https://reviews.llvm.org/D99560 by
perfectly-forwarding the combined Callables.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D100670
peter klausler [Mon, 28 Jun 2021 18:41:04 +0000 (11:41 -0700)]
[flang] Fix "non-advancing" I/O, support $ in FORMAT
Non-advancing I/O was failing; ExternalFileUnit was losing
track of what writes had been committed to the file. Fixed.
Also, support the common extension of $ and \ in a FORMAT
as being equivalent to ADVANCE=NO.
Differential Revision: https://reviews.llvm.org/D105046
Kirill Bobyrev [Mon, 28 Jun 2021 19:15:00 +0000 (21:15 +0200)]
[clang-tidy] Add -line-filter to run-clang-tidy.py
This patch allows the use of --line-filter in clang-tidy.py from
run-clang-tidy.py
Author: [bansan (Vincent LE GARREC)](https://reviews.llvm.org/p/bansan/)
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D104981
Melanie Blower [Mon, 28 Jun 2021 19:09:27 +0000 (15:09 -0400)]
[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D104729
Kadir Cetinkaya [Mon, 28 Jun 2021 16:11:22 +0000 (18:11 +0200)]
[clangd] Add a flag to disable formatting of tweak edits
Some tweaks might edit file types not supported by clang-format. This
patch gives them a way to signal that they do not require formatting.
Differential Revision: https://reviews.llvm.org/D105039
Sameer Sahasrabuddhe [Mon, 28 Jun 2021 08:13:02 +0000 (13:43 +0530)]
[Clang] [NFC] fix CHECK lines for convergent attribute tests
Jez Ng [Sat, 26 Jun 2021 21:38:25 +0000 (17:38 -0400)]
[lld-macho][nfc] Remove unnecessary dyn_cast and simplify code
Jez Ng [Mon, 28 Jun 2021 18:43:36 +0000 (14:43 -0400)]
[lld-macho][nfc] Add absolute-vs-non-absolute symbol test for ICF
Make sure we don't wrongly fold two sections that refer to
symbols with the same value if they are not both absolute /
non-absolute.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D104876
Jez Ng [Mon, 28 Jun 2021 18:43:34 +0000 (14:43 -0400)]
[lld-macho] Extend ICF to literal sections
Literal sections can be deduplicated before running ICF. That makes it
easy to compare them during ICF: we can tell if two literals are
constant-equal by comparing their offsets in their OutputSection.
LLD-ELF takes a similar approach.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D104671
peter klausler [Fri, 25 Jun 2021 17:40:08 +0000 (10:40 -0700)]
[flang] Implement user-defined derived type runtime I/O
With derived type description tables now available to the
runtime library, it is possible to implement the concept
of "child" I/O statements in the runtime and use them to
convert instances of derived type I/O data transfers into
calls to user-defined subroutines when they have been specified
for a type. (See Fortran 2018, subclauses 12.6.4.8 & 13.7.6).
- Support formatted, list-directed, and NAMELIST
transfers to internal parent units; support these, and unformatted
transfers, for external parent units.
- Support nested child defined derived type I/O.
- Parse DT'foo'(v-list) FORMAT data edit descriptors and passes
their strings &/or v-list values as arguments to the defined
formatted I/O routines.
- Fix problems with this feature encountered in semantics and
FORMAT valiation during development and end-to-end testing.
- Convert typeInfo::SpecialBinding from a struct to a class
after adding a member function.
Differential Revision: https://reviews.llvm.org/D104930
Louis Dionne [Mon, 28 Jun 2021 18:20:45 +0000 (14:20 -0400)]
[libc++] NFCI: Remove unused Lit parameter sanitizer_library
Peter Steinfeld [Fri, 25 Jun 2021 18:28:30 +0000 (11:28 -0700)]
[flang] Fix conformability for intrinsic procedures
There are situations where the arguments of intrinsics must be
conformable, which is defined in section 3.36. This means they must
have "the same shape, or one being an array and the other being scalar".
But the check we were actually making was that their ranks were the same.
This change fixes that and adds a test for the UNPACK intrinsic, where
the FIELD argument "shall be conformable with MASK".
Differential Revision: https://reviews.llvm.org/D104936
Nancy Wang [Mon, 28 Jun 2021 18:04:02 +0000 (14:04 -0400)]
[SystemZ][z/OS][libcxx]: fix libcxx test cases failed on ebcdic mode on z/OS
This patch is to fix 2 libcxx test cases, test cases assumed 'a' > 'A' which is not case in z/OS platform on ebcdic mode, modified test cases to compare between upper letters or lower letters, or digits so ordering will be true for all platform.
Differential Revision: https://reviews.llvm.org/D104748
Akira Hatanaka [Mon, 28 Jun 2021 18:02:30 +0000 (11:02 -0700)]
[ObjC][ARC] Ignore operand bundle "clang.arc.attachedcall" on a call if
the call's return type is void
Instead of trying hard to prevent global optimization passes such as
deadargelim from changing the return type to void, just ignore the
bundle if the return type is void. clang currently emits calls to
@llvm.objc.clang.arc.noop.use, which consumes the function call result,
immediately after the function call to prevent changes to the return
type, but optimization passes can delete the call to
@llvm.objc.clang.arc.noop.use if the function call doesn't return, which
enables deadargelim to change the return type.
rdar://
76671438
Differential Revision: https://reviews.llvm.org/D103062
Florian Mayer [Mon, 28 Jun 2021 10:34:30 +0000 (11:34 +0100)]
[hwasan] print exact mismatch offset for short granules.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104463
Raphael Isemann [Mon, 28 Jun 2021 16:58:42 +0000 (18:58 +0200)]
[lldb] Avoid using any shell when calling xcrun.
When we run `xcrun` we don't have any user input in our command so relying on
the user's default shell doesn't make a lot of sense. If the user has set the
system shell to a something that isn't supported yet (dash, ash) then we would
run into the problem that we don't know how to escape our command string.
This patch just avoids using any shell at all as xcrun is always at the same
path.
Reviewed By: aprantl, JDevlieghere, kastiglione
Differential Revision: https://reviews.llvm.org/D104653