Florian Hahn [Wed, 12 Feb 2020 14:22:20 +0000 (14:22 +0000)]
Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"
This version includes a fix for a set of crashes caused by marking
values depending on a yet unknown & tracked call as overdefined.
In some cases, we would later discover that the call has a constant
result and try to mark a user of it as constant, although it was already
marked as overdefined. Most instruction handlers bail out early if the
instruction is already overdefined. But that is not necessary for
CastInsts for example. By skipping values that depend on skipped
calls, we resolve the crashes and also improve the precision in some
cases (see resolvedundefsin-tracked-fn.ll).
Note that we may not skip PHI nodes that may depend on a skipped call,
but they can be safely marked as overdefined, as we bail out early if
the PHI node is overdefined.
This reverts the revert commit
a74b31a3e9cd844c7ce2087978568e3f5ec8519.
David Green [Wed, 12 Feb 2020 12:24:26 +0000 (12:24 +0000)]
[ARM] Extra vecreduce add with accumulate tests. NFC
Anh Tuyen Tran [Wed, 12 Feb 2020 17:57:56 +0000 (17:57 +0000)]
[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files
Summary:
This refactor patch removes some header files which are not needed and also add some to meet IWYU principles.
Reviewers: rnk (Reid Kleckner), Meinersbur (Michael Kruse), dmgreen (Dave Green)
Reviewed By: dmgreen (Dave Green), rnk (Reid Kleckner), Meinersbur (Michael Kruse)
Subscribers: dmgreen (Dave Green), Whitney (Whitney Tsang), hiraditya (Aditya Kumar), zzheng (Z. Zheng), llvm-commits, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D73498
River Riddle [Wed, 12 Feb 2020 17:46:21 +0000 (09:46 -0800)]
[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>
Summary: This was a missed case when ValueRange was originally added, and allows for constructing a ValueRange from the arguments of a block.
Differential Revision: https://reviews.llvm.org/D74363
Shoaib Meenai [Wed, 12 Feb 2020 02:24:57 +0000 (18:24 -0800)]
[runtimes] Add umbrella targets for runtimes
This will create e.g. a compiler-rt target that'll build compiler-rt for
all configured targets, similar to how the runtimes umbrella target
builds all the runtimes for all configured targets.
Differential Revision: https://reviews.llvm.org/D74458
Michael Liao [Wed, 12 Feb 2020 17:43:51 +0000 (12:43 -0500)]
Fix `-Wunused-variable` warning. NFC.
Jessica Paquette [Tue, 11 Feb 2020 18:22:38 +0000 (10:22 -0800)]
[AArch64][GlobalISel] Properly implement widening for TB(N)Z
When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.
Add a general-purpose widening helpe which emits the correct SUBREG_TO_REG
instruction based off of a desired size and add a testcase.
Also remove some asserts which are technically incorrect in `emitTestBit`.
- p0 doesn't count as a scalar type, so we need to check `!Ty.isVector()`
instead
- Whenever we have a s1, the Size/Bit checks are too conservative, so just
remove them
Replace these asserts with less conservative ones where applicable.
Differential Revision: https://reviews.llvm.org/D74427
Alina Sbirlea [Thu, 16 Jan 2020 23:32:30 +0000 (15:32 -0800)]
Compute ORE, BPI, BFI in Loop passes.
Summary:
Passes ORE, BPI, BFI are not being preserved by Loop passes, hence it
is incorrect to retrieve these passes as cached.
This patch makes the loop passes in question compute a new instance.
In some of these cases, however, it may be beneficial to change the Loop pass to
a Function pass instead, similar to the change for LoopUnrollAndJam.
Reviewers: chandlerc, dmgreen, jdoerfert, reames
Subscribers: mehdi_amini, hiraditya, zzheng, steven_wu, dexonsmith, Whitney, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72891
Matt Arsenault [Fri, 8 Nov 2019 01:14:51 +0000 (17:14 -0800)]
clang: Guess at some platform FTZ/DAZ default settings
This is to avoid performance regressions when the default attribute
behavior is fixed to assume ieee.
I tested the default on x86_64 ubuntu, which seems to default to
FTZ/DAZ, but am guessing for x86 and PS4.
Sanjay Patel [Wed, 12 Feb 2020 16:33:21 +0000 (11:33 -0500)]
[VectorCombine] add tests for extract-binop; NFC
Justin Lebar [Tue, 11 Feb 2020 03:34:44 +0000 (19:34 -0800)]
Fix SFINAE in llvm::bit_cast.
Summary:
As far as I can tell, the SFINAE was broken; there is no such thing as
std::is_trivially_constructible<T>::type.
Subscribers: dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74380
Justin Lebar [Wed, 12 Feb 2020 16:05:00 +0000 (08:05 -0800)]
Fix compilation of Any.h header.
In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
rather than `std::decay_t<T>`. This seems to have broken the build
*only for clang-cl*. I don't know why.
Submitting with post-commit review because this is an obvious fix for a
build breakage and we've verified that it fixes the breakage.
Fangrui Song [Mon, 10 Feb 2020 23:58:29 +0000 (15:58 -0800)]
[ELF] Support INSERT [AFTER|BEFORE] for orphan sections
D43468+D44380 added INSERT [AFTER|BEFORE] for non-orphan sections. This patch
makes INSERT work for orphan sections as well.
`SECTIONS {...} INSERT [AFTER|BEFORE] .foo` does not set `hasSectionCommands`, so the result
will be similar to a regular link without a linker script. The differences when `hasSectionCommands` is set include:
* image base is different
* -z noseparate-code/-z noseparate-loadable-segments are unavailable
* some special symbols such as `_end _etext _edata` are not defined
The behavior is similar to GNU ld:
INSERT is not considered an external linker script.
This feature makes the section layout more flexible. It can be used to:
* Place .nv_fatbin before other readonly SHT_PROGBITS sections to mitigate relocation overflows.
* Disturb the layout to expose address sensitive application bugs.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D74375
Fangrui Song [Sun, 9 Feb 2020 06:04:06 +0000 (22:04 -0800)]
[ELF] Start a new PT_LOAD if LMA region is different
GNU ld has a counterintuitive lang_propagate_lma_regions rule.
```
// .foo's LMA region is propagated to .bar because their VMA region is the same,
// and .bar does not have an explicit output section address (addr_tree).
.foo : { *(.foo) } >RAM AT> FLASH
.bar : { *(.bar) } >RAM
// An explicit output section address disables propagation.
.foo : { *(.foo) } >RAM AT> FLASH
.bar . : { *(.bar) } >RAM
```
In both cases, lld thinks .foo's LMA region is propagated and
places .bar in the same PT_LOAD, so lld diverges from GNU ld w.r.t. the
second case (lma-align.test).
This patch changes Writer<ELFT>::createPhdrs to disable propagation
(start a new PT_LOAD). A user of the first case can make linker scripts
portable by explicitly specifying `AT>`. By contrast, there was no
workaround for the old behavior.
This change uncovers another LMA related bug in assignOffsets() where
`ctx->lmaOffset = 0;` was omitted. It caused a spurious "load address
range overlaps" error for at2.test
The new PT_LOAD rule is complex. For convenience, I listed the origins of some subexpressions:
* rL323449: `sec->memRegion == load->firstSec->memRegion`; linkerscript/at3.test
* D43284: `load->lastSec == Out::programHeaders` (don't start a new PT_LOAD after program headers); linkerscript/at4.test
* D58892: `sec != relroEnd` (start a new PT_LOAD after PT_GNU_RELRO)
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D74297
Fangrui Song [Sat, 8 Feb 2020 19:07:03 +0000 (11:07 -0800)]
[ELF] Respect output section alignment for AT> (non-null lmaRegion)
When lmaRegion is non-null, respect `sec->alignment`
This rule is analogous to `switchTo(sec)` which advances sh_addr (VMA).
This fixes the p_paddr misalignment issue as reported by
https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/1230058
Note, `sec->alignment` is the maximum of ALIGN and input section alignments. We may overalign LMA than GNU ld.
linkerscript/align-lma.s has a FIXME that demonstrates another bug:
`.bss ... >RAM` should be placed in a different PT_LOAD (GNU ld
behavior) because its lmaRegion (nullptr) is different from the previous
section's lmaRegion (ROM).
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D74286
Jordan Rupprecht [Tue, 11 Feb 2020 19:55:40 +0000 (11:55 -0800)]
[llvm-objdump] Print file format in lowercase to match GNU output.
Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. llvm-objdump prints `ELF64-x86-64` right now, even though piping that into llvm-objcopy refuses that as a valid arch to use.
As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779
Reviewers: MaskRay, jhenderson, alexshap
Reviewed By: MaskRay
Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74433
Simon Pilgrim [Wed, 12 Feb 2020 16:07:16 +0000 (16:07 +0000)]
[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression
This has a really interesting side effect in that it improves some UMAX/UMIN reduction code which had redundant XOR(SHUFFLE(XOR(X,SIGNMASK)),SIGNMASK) patterns - the getNegatibleCost recognises it as FNEG(SHUFFLE(FNEG(X))).... We have a lot of FNEG patterns bitcasted to the integer domain for XOR signbit twiddling which is similar to what we do to allow UMAX/UMIN to be lowered using SMAX/SMIN.
Differential Revision: https://reviews.llvm.org/D74231
Sven van Haastregt [Wed, 12 Feb 2020 15:57:25 +0000 (15:57 +0000)]
Add missing newlines at EOF; NFC
Haojian Wu [Wed, 12 Feb 2020 08:47:31 +0000 (09:47 +0100)]
[clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.
Reviewers: gribozavr2
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74468
Anh Tuyen Tran [Wed, 12 Feb 2020 15:51:57 +0000 (15:51 +0000)]
Title: [TSAN] Parameterize the hard-coded threshold of deflake in tsan test
Summary:
A number of testcases in TSAN are designed to deal with intermittent problems
not exist in all executions of the tested program. A script called deflake.bash
runs the executable up to 10 times to deal with the intermittent nature of the tests.
The purpose of this patch is to parameterize the hard-coded threshold above via
--cmake_variables=-DTSAN_TEST_DEFLAKE_THRESHOLD=SomeIntegerValue
When this cmake var is not set, the default value of 10 will be used.
Reviewer: dvyukov (Dmitry Vyukov), eugenis (Evgenii Stepanov), rnk (Reid Kleckner), hubert.reinterpretcast (Hubert Tong), vitalybuka (Vitaly Buka)
Reviewed By: vitalybuka (Vitaly Buka)
Subscribers: mgorny (Michal Gorny), jfb (JF Bastien), steven.zhang (qshanz), llvm-commits (Mailing List llvm-commits), Sanitizers
Tag: LLVM, Sanitizers
Differential Revision: https://reviews.llvm.org/D73707
Louis Dionne [Mon, 10 Feb 2020 17:30:43 +0000 (18:30 +0100)]
[libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock
Summary:
In D27429, we switched the Apple implementation of steady_clock::now()
from clock_gettime(CLOCK_MONOTONIC) to clock_gettime(CLOCK_UPTIME_RAW).
The purpose was to get nanosecond precision, and also to improve the
performance of the implementation.
However, it appears that CLOCK_UPTIME_RAW does not satisfy the requirements
of the Standard, since it is not strictly speaking monotonic. Indeed, the
clock does not increment while the system is asleep, which had been
mentioned in D27429 but somehow not addressed.
This patch switches to CLOCK_MONOTONIC_RAW, which is monotonic, increased
during sleep, and also has nanosecond precision.
https://llvm.org/PR44773
Reviewers: bruno, howard.hinnant, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF
Tags: #libc
Differential Revision: https://reviews.llvm.org/D74341
Danilo Carvalho Grael [Wed, 12 Feb 2020 15:36:15 +0000 (10:36 -0500)]
[AArch64][SVE] Add addsub carry long instrinsics
Summary:
Add intrinsics for the following instructions:
- adclb, adclt, sbclb, sbclt
Reviewers: kmclaughlin, c-rhodes, sdesmalen, efriedma, rengolin
Reviewed By: kmclaughlin
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74328
Melanie Blower [Tue, 11 Feb 2020 22:40:23 +0000 (14:40 -0800)]
Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""
This reverts commit
99c5bcbce89f07e68ccd89891a0300346705d013.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit
Reviewers: rjmccall, Andy Kaylor
Differential Revision: https://reviews.llvm.org/D74436
Victor Huang [Wed, 12 Feb 2020 15:22:36 +0000 (09:22 -0600)]
[PowerPC] Add options for PPC to enable/disable using non-volatile CR
An option is added for PowerPC to disable use of non-volatile CR
register fields and avoid CR spilling in the prologue.
Differential Revision: https://reviews.llvm.org/D69835
Louis Dionne [Wed, 12 Feb 2020 15:20:09 +0000 (16:20 +0100)]
[libc++] span: Guard against overflow in span::subspan
The calculation _Offset + _Count <= size() may overflow, so use
_Count <= size() - _Offset instead. Note that this is safe due to
the previous constraint that _Offset <= size().
Patch by Michael Schellenberger Costa.
Differential Revision: https://reviews.llvm.org/D71998
Anil Mahmud [Mon, 3 Feb 2020 18:34:44 +0000 (12:34 -0600)]
[PowerPC] Add support for intrinsic llvm.ppc.eieio
Add support for the intrinsic llvm.ppc.eieio to emit the instruction eieio.
Differential Revision: https://reviews.llvm.org/D69066
Anil Mahmud [Mon, 3 Feb 2020 17:03:54 +0000 (11:03 -0600)]
[PowerPC] Add support for intrinsics llvm.ppc.dcbfl and llvm.ppc.dcbflp
Added support for the intrinsic llvm.ppc.dcbfl and llvm.ppc.dcbflp.
These will be used for emitting cache control instructions dcbfl and dcbflp
which are actually mnemonics for using dcbf instruction with different
immediate arguments.
dcbfl ra, rb -> dcbf ra, rb, 1
dcbflp, ra, rb -> dcbf ra, rb, 3
Differential Revision: https://reviews.llvm.org/D68411
Matt Arsenault [Wed, 12 Feb 2020 14:56:36 +0000 (09:56 -0500)]
AMDGPU/GlobalISel: Split 96-bit load/store select tests out
These are only legal on CI+. The test would fail in a debug build, but
not a release due to the partial selection since the pre-selection
legality assert only happens in a debug build.
James Henderson [Wed, 12 Feb 2020 14:56:09 +0000 (14:56 +0000)]
[MC][AVR] Fix AVR test following
740bc366
James Henderson [Wed, 12 Feb 2020 14:37:10 +0000 (14:37 +0000)]
[DebugInfo] Add checks for v2 directory and file name table terminators
The DWARFv2-4 specification for the line table header states that the
include directories and file name tables both end with a single null
byte. Prior to this change, the parser did not detect if this byte was
missing, because it also stopped reading the tables once it reached the
prologue end, as claimed by the header_length field. This change adds a
check that the terminator has been seen at the end of each table.
Reviewed by: dblaikie, MaskRay
Differential Revision: https://reviews.llvm.org/D74413
James Henderson [Tue, 11 Feb 2020 12:17:33 +0000 (12:17 +0000)]
[DebugInfo] Add check for zero debug line opcode_base
The number of standard opcodes is defined to be opcode_base - 1, so a
value of 0 for the opcode_base caused a crash as an attempt was made to
reserve many entries in a vector. This change fixes the crash, by
issuing a warning and skipping reading of standard opcode lengths in the
event of an opcode_base of 0.
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D74309
James Henderson [Tue, 11 Feb 2020 14:11:01 +0000 (14:11 +0000)]
[DebugInfo] Print version in error message in decimal
Also remove some test duplication and add a test case that shows the
maximum version is rejected (this also shows that the value in the error
message is actually in decimal, and not just missing an 0x prefix).
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D74403
stozer [Wed, 12 Feb 2020 13:41:18 +0000 (13:41 +0000)]
Re-reapply: Recover debug intrinsics when killing duplicated/empty blocks
This reverts commit
636c93ed11a5f98b5c3ff88241460d61cb7785bb.
The original patch caused build failures on TSan buildbots. Commit
6ded69f294a9
fixes this issue by reducing the rate at which empty debug intrinsics
propagate, reducing the memory footprint and preventing a fatal spike.
Matt Arsenault [Tue, 21 Jan 2020 18:23:45 +0000 (13:23 -0500)]
AMDGPU/GlobalISel: Widen non-power-of-2 load results
Load extra bits if suitably aligned. This allows using widened
3-vector loads on SI, and fixes legalization for <9 x s32> (which LSV
apparently forms frequently on lowered kernel argument lists).
Fix incorrectly treating these as legal on SI. This should emit a
64-bit store and a 32-bit store.
I think all of the load and store rules are just about complete, but
due for a rewrite.
Saar Raz [Wed, 12 Feb 2020 14:23:55 +0000 (16:23 +0200)]
[Concepts] Add missing TPA commit to requires expression parsing
If an error had occurred when annotating a scope spec during the tentative parse
for a type-requirement, we would not revert nor commit the tentative parse, triggerring
an assertion failure.
Commit the TPA in this case and then do error recovery.
Florian Hahn [Tue, 11 Feb 2020 18:27:41 +0000 (18:27 +0000)]
Recommit "[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk)."
This includes a fix for the santizier failures.
This reverts the revert commit
42f8b915eb72364cc5e84adf58a2c2d4947e8b10.
Alex Zinenko [Wed, 12 Feb 2020 14:08:38 +0000 (15:08 +0100)]
[mlir] Linalg fusion: ignore indexed_generic producers
They are currently not supported and we should not attempt fusing them.
Pierre Oechsel [Wed, 12 Feb 2020 09:26:01 +0000 (10:26 +0100)]
[mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.
A memref_cast casting to a memref with a non identity map can't be
lowered to llvm. Take the following case:
```
func @invalid_memref_cast(%arg0: memref<?x?xf64>) {
%c1 = constant 1 : index
%c0 = constant 0 : index
%5 = memref_cast %arg0 : memref<?x?xf64> to memref<?x?xf64, #map1>
%25 = std.subview %5[%c0, %c0][%c1, %c1][] : memref<?x?xf64, #map1> to memref<?x?xf64, #map1>
return
}
```
When lowering the subview mlir was assuming `%5` to have an llvm type
(which is not the case as mlir failed to lower the memref_cast).
Differential Revision: https://reviews.llvm.org/D74466
Hans Wennborg [Wed, 12 Feb 2020 14:12:31 +0000 (15:12 +0100)]
Fix unused function warning (PR44808)
Stephan Herhut [Wed, 12 Feb 2020 13:35:32 +0000 (14:35 +0100)]
[MLIR][CUDA] Fix build file for mlir-cuda-runner
Summary:
This was broken recently when moving from dialect registration via
static initializers to explicit intialization.
Differential Revision: https://reviews.llvm.org/D74480
Saar Raz [Wed, 12 Feb 2020 13:58:51 +0000 (15:58 +0200)]
[Concepts] Do not check constraints if not all template arguments have been deduced
We previously checked the constraints of instantiated function templates even in cases where
PartialOverloading was true and not all template arguments have been deduced, which caused crashes
in clangd (bug 44714).
We now check if all arguments have been deduced before checking constraints in partial overloading
scenarios.
Ayman Musa [Wed, 12 Feb 2020 13:00:25 +0000 (15:00 +0200)]
[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine for ICmp instruction.
Sergej Jaskiewicz [Wed, 12 Feb 2020 13:07:30 +0000 (16:07 +0300)]
[libcxx] Don't assume cwd name in std::filesystem tests
Summary:
In `std::filesystem::proximate` tests we assume that the current working directory's name
is `fs.op.proximate`. This is fine when we're running the tests locally.
However, if we're running those tests on a remote machine via SSH, the directory layout may be
different. For example, currently we copy each test executable individually into
a temporary directory on the target board using SCP, so the assumption about the working directory name
doesn't necessarily hold.
This patch is the only thing that is necessary for all libc++ tests to pass when run remotely.
Reviewers: ldionne, EricWF, mclow.lists
Reviewed By: ldionne, EricWF
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D74348
Ayman Musa [Wed, 12 Feb 2020 13:04:49 +0000 (15:04 +0200)]
Revert "[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand."
This reverts commit
cf155150f992270c88e586ffc61973d2552b72e8.
Ayman Musa [Wed, 12 Feb 2020 12:33:31 +0000 (14:33 +0200)]
[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand.
Lei Zhang [Fri, 7 Feb 2020 16:30:19 +0000 (11:30 -0500)]
[mlir][spirv] Introduce spv.func
Thus far we have been using builtin func op to model SPIR-V functions.
It was because builtin func op used to have special treatment in
various parts of the core codebase (e.g., pass pipelines, etc.) and
it's easy to bootstrap the development of the SPIR-V dialect. But
nowadays with general op concepts and region support we don't have
such limitations and it's time to tighten the SPIR-V dialect for
completeness.
This commits introduces a spv.func op to properly model SPIR-V
functions. Compared to builtin func op, it can provide the following
benefits:
* We can control the full op so we can integrate SPIR-V information
bits (e.g., function control) in a more integrated way and define
our own assembly form and enforcing better verification.
* We can have a better dialect and library boundary. At the current
moment only functions are modelled with an external op. With this
change, all ops modelling SPIR-V concpets will be spv.* ops and
registered to the SPIR-V dialect.
* We don't need to special-case func op anymore when creating
ConversionTarget declaring SPIR-V dialect as legal. This is quite
important given we'll see more and more conversions in the future.
In the process, bumps a few FuncOp methods to the FunctionLike trait.
Differential Revision: https://reviews.llvm.org/D74226
stozer [Wed, 12 Feb 2020 11:48:20 +0000 (11:48 +0000)]
Reapply "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"
This reverts commit
6ded69f294a9a62a68b0a07aa987c8165a4b31e7.
Mehdi Amini [Wed, 12 Feb 2020 10:06:50 +0000 (10:06 +0000)]
Fix MLIR build when the NVPTX target isn't configured
Differential Revision: https://reviews.llvm.org/D74472
Ehud Katz [Wed, 12 Feb 2020 12:13:14 +0000 (14:13 +0200)]
[unittests] Fix TargetLibraryInfoTest.ValidProto
Ayman Musa [Tue, 28 Jan 2020 13:17:15 +0000 (15:17 +0200)]
[AggressiveInstCombine] Add support for select instruction.
Differential Revision: https://reviews.llvm.org/D72837
Simon Pilgrim [Wed, 12 Feb 2020 11:42:25 +0000 (11:42 +0000)]
[TargetLowering] Add NegatibleCost enum for isNegatibleForFree return codes
The isNegatibleForFree/getNegatedExpression methods currently rely on a raw char value to indicate whether a negation is beneficial or not.
This patch replaces the char return value with an NegatibleCost enum to more clearly demonstrate what is implied.
It also renames isNegatibleForFree to getNegatibleCost to more accurately reflect whats going on.
Differential Revision: https://reviews.llvm.org/D74221
Balázs Kéri [Wed, 12 Feb 2020 10:26:38 +0000 (11:26 +0100)]
[analyzer]StreamChecker refactoring (NFC).
Reviewers: Szelethus
Reviewed By: Szelethus
Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73359
Pavel Labath [Wed, 12 Feb 2020 11:47:43 +0000 (12:47 +0100)]
[lldb/DWARF] Use DWARFDebugInfoEntry * in ElaboratingDIEIterator
This is simpler, faster, and sufficient to uniquely idenify a DIE.
stozer [Wed, 12 Feb 2020 11:47:01 +0000 (11:47 +0000)]
Revert "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"
This reverts commit
fe6f6cd6b8e647c5b4ac82f4fcd56c057c2ef8ce.
Found test failure on several buildbots.
Ayman Musa [Wed, 12 Feb 2020 11:40:40 +0000 (13:40 +0200)]
[NFC][AggressiveInstCombine] Remove redundant std::max.
Differential Revision: https://reviews.llvm.org/D74476
Martin Storsjö [Wed, 12 Feb 2020 09:22:26 +0000 (11:22 +0200)]
[LLDB] Fix GCC warnings about extra semicolons. NFC.
stozer [Mon, 27 Jan 2020 16:05:34 +0000 (16:05 +0000)]
[DebugInfo] Prevent explosion of debug intrinsics during jump threading
This patch is a fix following the revert of 72ce759
(https://reviews.llvm.org/rG72ce759928e6dfee6a9efa310b966c19722352ba)
and fixes the failure that it caused.
The above patch failed on the Thread Sanitizer buildbot with an out of
memory error. After an investigation, the cause was identified as an
explosion in debug intrinsics while running the Jump Threading pass on
ModuleMap.ll. The above patched prevented debug intrinsics from being
dropped when their Basic Block was deleted due to being "empty". In this
case, one of the functions in ModuleMap.ll had (after many optimization
passes) a very large number of debug intrinsics representing a set of
repeatedly inlined variables. Previously the vast majority of these were
silently dropped during Jump Threading when their blocks were deleted,
but as of the above patch they survived for longer, causing a large
increase in the number of debug intrinsics. These intrinsics were then
repeatedly cloned by the Jump Threading pass as edges were threaded,
multiplying the intrinsic count further. The memory consumed by this
process spiralled out of control, crashing the buildbot that uses TSan
(which has an estimated 5-10x memory overhead compared to non-sanitized
builds).
This patch adds RemoveRedundantDbgInstrs to the Jump Threading pass, in
order to reduce the number of debug intrinsics down to a manageable
amount in cases where many intrinsics for the same variable end up
bunched together contiguously, as in this case.
Differential Revision: https://reviews.llvm.org/D73054
Ehud Katz [Wed, 12 Feb 2020 11:14:09 +0000 (13:14 +0200)]
[ConstantFolding] Fold calls to FP remainder function
With the fixed implementation of the "remainder" operation in
rG9d0956ebd471, we can now add support to folding calls to it.
Differential Revision: https://reviews.llvm.org/D69777
Jay Foad [Wed, 12 Feb 2020 11:15:56 +0000 (11:15 +0000)]
[AMDGPU] Add one more pass to LLVMInitializeAMDGPUTarget
James Henderson [Tue, 11 Feb 2020 13:33:29 +0000 (13:33 +0000)]
[DebugInfo][test][NFC] Remove case numbers
This reduces the noise caused by adding cases earlier in the sequence.
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D74402
Djordje Todorovic [Wed, 12 Feb 2020 10:54:29 +0000 (11:54 +0100)]
Revert "[DebugInfo] Enable the debug entry values feature by default"
This reverts commit rG9f6ff07f8a39.
Found a test failure on clang-with-thin-lto-ubuntu buildbot.
Liad Mordekoviz [Tue, 11 Feb 2020 11:10:57 +0000 (11:10 +0000)]
[llvm-objdump] Add column headers for relocation printing
This allows us better readability and compatibility with what GNU
objdump prints.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43941
Reviewed by: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D72992
David Green [Tue, 11 Feb 2020 12:17:03 +0000 (12:17 +0000)]
[ARM] MVE vector reduce add tests. NFC
Kadir Cetinkaya [Wed, 12 Feb 2020 10:34:40 +0000 (11:34 +0100)]
[llvm-objcopy] Fix pipeline syntax
Raphael Isemann [Mon, 10 Feb 2020 07:13:09 +0000 (08:13 +0100)]
[lldb] Pass a valid SourceLocation to Sema::RequireCompleteType in ASTResultSynthesizer
Sema::RequireCompleteTypeImpl is supposed to have an assert that checks that the
SourceLocation that is passed in is always valid. It's currently commented out, but
as soon as this assert goes active, nearly every LLDB expression will start crashing as
we always pass in an invalid SourceLocation from the ASTResultSynthesizer.
This patch just passes in the valid SourceLocation of the expression (which is
the SourceLocation where the complete type is required) to prevent that from happening.
jasonliu [Tue, 11 Feb 2020 09:52:56 +0000 (09:52 +0000)]
[clang] Add -fignore-exceptions
Summary:
This is trying to implement the functionality proposed in:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053417.html
An exception can throw, but no cleanup is going to happen.
A module compiled with exceptions on, can catch the exception throws
from module compiled with -fignore-exceptions.
The use cases for enabling this option are:
1. Performance analysis of EH instrumentation overhead
2. The ability to QA non EH functionality when EH functionality is not available.
3. User of EH enabled headers knows the calls won't throw in their program and
wants the performance gain from ignoring EH construct.
The implementation tried to accomplish that by removing any landing pad code
that might get generated.
Reviewed by: aaron.ballman
Differential Revision: https://reviews.llvm.org/D72644
Florian Hahn [Wed, 12 Feb 2020 09:41:19 +0000 (09:41 +0000)]
Revert "[SCCP] Remove forcedconstant, go to overdefined instead"
This causes a crash for the reproducer below
enum { a };
enum b { c, d };
e;
static _Bool g(struct f *h, enum b i) {
i &&j();
return a;
}
static k(char h, enum b i) {
_Bool l = g(e, i);
l;
}
m(h) {
k(h, c);
g(h, d);
}
This reverts commit
aadb635e04854220064b77cc10d0e6772f5492fd.
Clement Courbet [Mon, 10 Feb 2020 10:27:53 +0000 (11:27 +0100)]
[CodeGen] Fix the computation of the alignment of split stores.
Summary:
Right now the alignment of the lower half of a store is computed as
align/2, which fails for unaligned stores (align = 1), and is overly
pessimitic for, e.g. a 8 byte store aligned to 4 bytes.
Fixes PR44851
Fixes PR44877
Reviewers: gchatelet, spatel, lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74311
Roman Lebedev [Wed, 12 Feb 2020 09:27:38 +0000 (12:27 +0300)]
[NFC?][SCEV][LoopVectorize] Add datalayout to the X86/float-induction-x86.ll test
Summary:
Currently, `SCEVExpander::isHighCostExpansionHelper()` has the following logic:
```
if (auto *UDivExpr = dyn_cast<SCEVUDivExpr>(S)) {
// If the divisor is a power of two and the SCEV type fits in a native
// integer (and the LHS not expensive), consider the division cheap
// irrespective of whether it occurs in the user code since it can be
// lowered into a right shift.
if (auto *SC = dyn_cast<SCEVConstant>(UDivExpr->getRHS()))
if (SC->getAPInt().isPowerOf2()) {
if (isHighCostExpansionHelper(UDivExpr->getLHS(), L, At,
BudgetRemaining, TTI, Processed))
return true;
const DataLayout &DL =
L->getHeader()->getParent()->getParent()->getDataLayout();
unsigned Width = cast<IntegerType>(UDivExpr->getType())->getBitWidth();
return DL.isIllegalInteger(Width);
}
```
Since this test does not have a datalayout specified,
`SCEVExpander::isHighCostExpansionHelper()` says that
`[[TMP2:%.*]] = lshr exact i64 [[TMP1]], 5` is high-cost, and didn't perform it.
But future patches will change that logic to solely rely on cost-model,
without any such datalayout checks, so i think it is best to show
that that change is ephemeral, and can already happen without costmodel changes.
Reviewers: reames, fhahn, sanjoy, craig.topper, RKSimon
Reviewed By: RKSimon
Subscribers: javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73717
Djordje Todorovic [Mon, 10 Feb 2020 10:06:44 +0000 (11:06 +0100)]
[DebugInfo] Enable the debug entry values feature by default
This patch enables the debug entry values feature.
- Remove the (CC1) experimental -femit-debug-entry-values option
- Enable it for x86, arm and aarch64 targets
- Resolve the test failures
- Leave the llc experimental option for targets that do not
support the CallSiteInfo yet
Differential Revision: https://reviews.llvm.org/D73534
Mehdi Amini [Wed, 12 Feb 2020 09:03:40 +0000 (09:03 +0000)]
Remove static registration for dialects, and the "alwayslink" hack for passes
In the previous state, we were relying on forcing the linker to include
all libraries in the final binary and the global initializer to self-register
every piece of the system. This change help moving away from this model, and
allow users to compose pieces more freely. The current change is only "fixing"
the dialect registration and avoiding relying on "whole link" for the passes.
The translation is still relying on the global registry, and some refactoring
is needed to make this all more convenient.
Differential Revision: https://reviews.llvm.org/D74461
Clement Courbet [Wed, 12 Feb 2020 08:05:27 +0000 (09:05 +0100)]
[CodeGenPrepare] Add more store splitting tests for PR44877.
Raphael Isemann [Wed, 12 Feb 2020 08:35:19 +0000 (09:35 +0100)]
[lldb][NFC] Remove GetConstTypeName and GetConstQualifiedTypeName from CompilerType
Beside these two functions just being wrappers around GetTypeName they are also
just a leftover from migrating the CompilerType interface to ConstString.
Raphael Isemann [Wed, 12 Feb 2020 08:22:59 +0000 (09:22 +0100)]
[lldb][NFC] Move common_completions mapping out of CommandCompletions header.
Marius Brehler [Wed, 12 Feb 2020 08:41:40 +0000 (09:41 +0100)]
[mlir] Revise naming of MLIROptMain and MLIRMlirOptLib
* Rename CMake target MLIROptMain to MLIROptLib:
The target provides the main library
* Rename CMake target MLIRMlirOptLib to MLIRMlirOptMain:
The target provides the main() entry function
At the moment, the Bazel configuration of TenorFlow maps the target
MlirOptLib to "lib/Support/MlirOptMain.cpp" and MlirOptMain to
"tools/mlir-opt/mlir-opt.cpp". This is the other way around in the CMake
configuration. As discussed in the context of the pull request
https://github.com/tensorflow/tensorflow/pull/36301, it seems useful to
revise the naming in the MLIR repo.
Differential Revision: https://reviews.llvm.org/D73778
Ehud Katz [Wed, 12 Feb 2020 08:42:55 +0000 (10:42 +0200)]
[APFloat] Fix FP remainder operation
Reimplement IEEEFloat::remainder() function.
Fix PR3359.
Differential Revision: https://reviews.llvm.org/D69776
Raphael Isemann [Wed, 12 Feb 2020 08:10:19 +0000 (09:10 +0100)]
[lldb] Move implementation of GetDisplayName to TypeSystem class
CompilerType doesn't implement logic.
Georgii Rymar [Tue, 11 Feb 2020 11:13:16 +0000 (14:13 +0300)]
[yaml2obj][test] - Simplify the test: yaml2obj/ELF/call-graph-profile-section.yaml
Now with the new functionality that allows creating "defines", it is
possible to reduce this test (I tried to find another ones, but seems others
were already fixed previously).
Differential revision: https://reviews.llvm.org/D74392
Nicolai Hähnle [Tue, 11 Feb 2020 13:40:00 +0000 (14:40 +0100)]
AMDGPU: llvm.amdgcn.writelane is a source of divergence
Summary:
Consider:
%r = call i32 @llvm.amdgcn.writelane(i32 0, i32 1, i32 2)
This produces a value that is 0 on lane 1, and 2 everywhere else; i.e.,
it is divergent.
Reported-by: Marek Olsak <Marek.Olsak@amd.com>
Reviewers: arsenm, foad, mareko
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74400
Nicolai Hähnle [Fri, 7 Feb 2020 21:08:36 +0000 (22:08 +0100)]
SelectionDAG: Fix bug in ClusterNeighboringLoads
Summary:
The method attempts to find loads that can be legally clustered by
looking for loads consuming the same chain glue token.
However, the old code looks at _all_ users of values produced by the
chain node -- including uses of the loaded/returned value of volatile
loads or atomics. This could lead to circular dependencies which then
failed during scheduling.
With this change, we filter out users by getResNo, i.e. by which
SDValue value they use, to ensure that we only look at users of the
chain glue token.
This appears to be a rather old bug, which is perhaps surprising.
However, the test case is actually quite fragile (i.e., it is hidden
by fairly small changes), and the test _must_ use volatile loads for
the bug to manifest.
Reviewers: arsenm, bogner, craig.topper, foad
Subscribers: MatzeB, jvesely, wdng, hiraditya, javed.absar, jfb, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74253
Raphael Isemann [Wed, 12 Feb 2020 07:56:03 +0000 (08:56 +0100)]
[lldb][NFC] Move all completer subclasses into source file
They are all implementation details so let's keep them out of the interface.
Also makes this code more readable by keeping these small classes
not spread over header and source file.
Alexander Belyaev [Wed, 12 Feb 2020 08:04:15 +0000 (09:04 +0100)]
[MLIR] Support memrefs with complex element types.
Differential Revision: https://reviews.llvm.org/D74307
Kazushi (Jam) Marukawa [Wed, 12 Feb 2020 08:01:30 +0000 (09:01 +0100)]
[VE] Bit operator isel
Summary: Isel and tests for bswap,brev,ctpop,ctlz,ctty,rotl,rotr
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D74304
Raphael Isemann [Wed, 12 Feb 2020 06:57:00 +0000 (07:57 +0100)]
[lldb][NFC] Remove eCustomCompletion mode
It's not used by anyone. Also if something implements its own
completion it could just not call the method instead of having
a parameter that makes the function a no-op.
Craig Topper [Wed, 12 Feb 2020 07:27:26 +0000 (23:27 -0800)]
[X86] Add test case for SoftPromoteHalf of STRICT_FP_EXTEND/STRICT_FP_ROUND.
Tests that should have been with
0daf9b8e41327b1511b2bbc272184ff4fdb8de79
Craig Topper [Wed, 12 Feb 2020 07:16:32 +0000 (23:16 -0800)]
[X86] Remove unnecessary hasSideEffects = 0, mayLoad = 1 from an instruction with a pattern. NFC
Craig Topper [Wed, 12 Feb 2020 07:13:28 +0000 (23:13 -0800)]
[X86] Correct the predicate on some patterns for 128 and 256 EVEX versions of VCVTPS2PH.
These should require AVX512VL not AVX512F. The legacy VEX patterns
will match first unless AVX512VL is enabled so this doesn't cause
a functional issue.
Igor Kudrin [Mon, 8 Jul 2019 14:55:36 +0000 (21:55 +0700)]
[DebugInfo] Add support for DWARF64 into DWARFDebugAddr.
Differential Revision: https://reviews.llvm.org/D74198
Igor Kudrin [Thu, 6 Feb 2020 07:14:12 +0000 (14:14 +0700)]
[DebugInfo] Simplify DWARFDebugAddr.
The patch removes unnecessary members of DWARFDebugAddr and further
simplifies the implementation by separating parsing methods of tables
in the DWARFv5 and pre-standard formats.
Differential Revision: https://reviews.llvm.org/D74197
Igor Kudrin [Thu, 6 Feb 2020 09:30:30 +0000 (16:30 +0700)]
[DebugInfo] Refine error messages in DWARFDebugAddr.
As a preparation for the subsequent patches, this updates the wordings
of some error messages in DWARFDebugAddr.
Differential Revision: https://reviews.llvm.org/D74196
Igor Kudrin [Tue, 11 Feb 2020 08:55:12 +0000 (15:55 +0700)]
[DebugInfo] Use "an address table" in diagnostic messages of DWARFDebugAddr.
This replaces a collocation "a .debug_addr table" with "an address table"
because the latter sounds more accurate.
Differential Revision: https://reviews.llvm.org/D74407
Igor Kudrin [Thu, 6 Feb 2020 13:34:10 +0000 (20:34 +0700)]
[DebugInfo] Do not dump header field for pre-DWARFv5 address tables.
As there is no header in pre-DWARFv5 address tables, and we fill
the class data members with some artificial values, we should not
dump them as that might be misleading.
Differential Revision: https://reviews.llvm.org/D74195
Igor Kudrin [Tue, 11 Feb 2020 12:43:20 +0000 (19:43 +0700)]
[DebugInfo] Fix reading addresses in DWARFDebugAddr.
As addresses in the address tables may have relocations, thus,
the relocations should be resolved to read the correct address.
That is especially important for targets that use RELA relocations
because in that case addends are stored in relocation sections.
Differential Revision: https://reviews.llvm.org/D74404
Craig Topper [Wed, 12 Feb 2020 04:24:51 +0000 (20:24 -0800)]
[X86][LegalizeTypes] Add SoftPromoteHalf support STRICT_FP_EXTEND and STRICT_FP_ROUND
This adds a strict version of FP16_TO_FP and FP_TO_FP16 and uses
them to implement soft promotion for the half type. This is
enough to provide basic support for __fp16 with strictfp.
Add the necessary X86 support to use VCVTPS2PH/VCVTPH2PS when F16C
is enabled.
Raphael Isemann [Wed, 12 Feb 2020 06:13:48 +0000 (07:13 +0100)]
[lldb] Remove skipIfFreeBSD from TestCompletion
This was skipped because of an pexpect issue (http://llvm.org/pr22784),
but this test is no longer using pexpect and is running fine on FreeBSD.
Fangrui Song [Wed, 12 Feb 2020 04:45:05 +0000 (20:45 -0800)]
[CMake] Delete llvm_add_go_executable and a reference to TARGET llvm-go
llvm-go was deleted by
102814b4d36ad004a2e37cd2a1e84bd2c3593d29.
Yuanfang Chen [Wed, 12 Feb 2020 04:39:34 +0000 (20:39 -0800)]
Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""
This reverts commit rGcd5b308b828e, rGcd5b308b828e, rG8cedf0e2994c.
There are issues to be investigated for polly bots and bots turning on
EXPENSIVE_CHECKS.
Davide Italiano [Wed, 12 Feb 2020 04:30:12 +0000 (20:30 -0800)]
[TestConstVariable] Clean-up XFAIL lists.
These versions of `clang` are ancient history.
Matt Arsenault [Tue, 11 Feb 2020 20:13:42 +0000 (15:13 -0500)]
AMDGPU: Use conditions directly in division expansion
This was creating a select on true/false values, and then comparing
that later. This produced more work for later combines, which can be
avoided by just using the boolean values. This was copied from the
original DAG expansion, which also has the same problem. This doesn't
have a observable change using SelectionDAG, but since GlobalISel is
missing these optimizations, the final code was noticeably longer.
Johannes Doerfert [Wed, 12 Feb 2020 04:06:32 +0000 (22:06 -0600)]
[OpenMP][Offloading] Added support for multiple streams so that multiple kernels can be executed concurrently
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D74145