platform/upstream/llvm.git
4 years agoGlobalISel: Fix typo in assert message
Matt Arsenault [Sat, 11 Apr 2020 19:32:04 +0000 (15:32 -0400)]
GlobalISel: Fix typo in assert message

4 years agoAMDGPU/GlobalISel: Fix legalizing <3 x s16> vselects
Matt Arsenault [Sat, 11 Apr 2020 19:59:51 +0000 (15:59 -0400)]
AMDGPU/GlobalISel: Fix legalizing <3 x s16> vselects

4 years ago[CodeGen] Allow partial tail duplication in Machine Block Placement.
Hongtao Yu [Sat, 11 Apr 2020 19:20:12 +0000 (12:20 -0700)]
[CodeGen] Allow partial tail duplication in Machine Block Placement.

Summary: A count profile may affect tail duplication's heuristic causing a block to be duplicated in only a part of its predecessors. This is not allowed in the Machine Block Placement pass where an assert will go off. I'm removing the assert and making the optimization bail out when such case happens.

Reviewers: wenlei, davidxl, Carrot

Reviewed By: Carrot

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoUse more LLVM_ENABLE_ABI_BREAKING_CHECKS in Error.h
Aaron Puchert [Sat, 11 Apr 2020 19:14:01 +0000 (21:14 +0200)]
Use more LLVM_ENABLE_ABI_BREAKING_CHECKS in Error.h

Summary:
If we don't read the flag, we don't need to set it. Then we also don't
need to filter it out to get the pointer.

This should have a (small) positive impact on code size and performance.

Reviewed By: lhames

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

4 years ago[mlir][docs] Refactor the layout of the docs folder
River Riddle [Sat, 11 Apr 2020 18:38:05 +0000 (11:38 -0700)]
[mlir][docs] Refactor the layout of the docs folder

Summary:
This revision performs a few refactorings on the main docs folder. Namely it:
* Adds a new Rationale/ folder to contain various rationale documents
* Moves several "getting started" documents to the Tutorials/ folder
* Cleans up the titles of various documents

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

4 years ago[libc++][test] Silence "unused variable" warning
Casey Carter [Sat, 11 Apr 2020 18:38:53 +0000 (11:38 -0700)]
[libc++][test] Silence "unused variable" warning

4 years ago[MC] Default MCAsmInfo::UseIntegratedAssembler to true
Fangrui Song [Sat, 11 Apr 2020 17:06:18 +0000 (10:06 -0700)]
[MC] Default MCAsmInfo::UseIntegratedAssembler to true

4 years ago[MC] Add UseIntegratedAssembler = false. NFC
Fangrui Song [Sat, 11 Apr 2020 17:01:36 +0000 (10:01 -0700)]
[MC] Add UseIntegratedAssembler = false. NFC

4 years agoSimplify string joins. NFCI.
Benjamin Kramer [Sat, 11 Apr 2020 15:18:54 +0000 (17:18 +0200)]
Simplify string joins. NFCI.

4 years ago[clangd] Remove redundant code in test. NFC
Sam McCall [Sat, 11 Apr 2020 15:14:31 +0000 (17:14 +0200)]
[clangd] Remove redundant code in test. NFC

4 years ago[mlir][docs] Explain the EDSC acronym. NFC
Jonathan Roelofs [Fri, 10 Apr 2020 22:40:31 +0000 (16:40 -0600)]
[mlir][docs] Explain the EDSC acronym. NFC

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

4 years ago[mlir][toy] Fix comment typo. NFC
Jonathan Roelofs [Fri, 10 Apr 2020 14:18:34 +0000 (08:18 -0600)]
[mlir][toy] Fix comment typo. NFC

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

4 years ago[mlir][toy][docs] Fix reference to generated ToyCombine.inc. NFC
Jonathan Roelofs [Wed, 8 Apr 2020 20:55:36 +0000 (14:55 -0600)]
[mlir][toy][docs] Fix reference to generated ToyCombine.inc. NFC

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

4 years ago[mlir][toy][docs] Reword for better sentence flow. NFC
Jonathan Roelofs [Thu, 9 Apr 2020 17:53:56 +0000 (11:53 -0600)]
[mlir][toy][docs] Reword for better sentence flow. NFC

4 years agoAMDGPU/GlobalISel: Work around forming illegal zextload after legalize
Matt Arsenault [Sun, 5 Apr 2020 21:48:55 +0000 (17:48 -0400)]
AMDGPU/GlobalISel: Work around forming illegal zextload after legalize

Selection would fail after the post legalize combiner put an illegal
zextload back together.

The base combiner has parameter to only allow legal operations, but
they appear to not be used. I also don't see a nice way to remove a
single entry from all_combines, so just hack around this.

4 years ago[scudo][standalone] Work with -Werror=class-memaccess
Kostya Kortchinsky [Fri, 10 Apr 2020 20:41:12 +0000 (13:41 -0700)]
[scudo][standalone] Work with -Werror=class-memaccess

Summary:
Fuchsia's gcc uses this, which in turn prevents us to compile successfully
due to a few `memset`'ing some non-trivial classes in some `init`.

Change those `memset` to members initialization.

Reviewers: pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[MLIR] Handle in-place folding properly in greedy pattern rewrite driver
Uday Bondhugula [Sun, 5 Apr 2020 04:35:52 +0000 (10:05 +0530)]
[MLIR] Handle in-place folding properly in greedy pattern rewrite driver

OperatioFolder::tryToFold performs both true folding and in a few
instances in-place updates through op rewrites. In the latter case, we
should still be applying the supplied pattern rewrites in the same
iteration; however this wasn't the case since tryToFold returned
success() for both true folding and in-place updates, and the patterns
for the in-place updated ops were being applied only in the next
iteration of the driver's outer loop. This fix would make it converge
faster.

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

4 years ago[VectorUtils] rename scaleShuffleMask to narrowShuffleMaskElts; NFC
Sanjay Patel [Sat, 11 Apr 2020 14:05:49 +0000 (10:05 -0400)]
[VectorUtils] rename scaleShuffleMask to narrowShuffleMaskElts; NFC

As proposed in D77881, we'll have the related widening operation,
so this name becomes too vague.

While here, change the function signature to take an 'int' rather
than 'size_t' for the scaling factor, add an assert for overflow of
32-bits, and improve the documentation comments.

4 years agoTargetLoweringObjectFileImpl.h - replace MCExpr.h and Module.h includes with forward...
Simon Pilgrim [Sat, 11 Apr 2020 13:13:18 +0000 (14:13 +0100)]
TargetLoweringObjectFileImpl.h - replace MCExpr.h and Module.h includes with forward declarations. NFC.

Also remove unused llvm::Mangler forward declaration.

4 years ago[FormatVariadic] Put back return type in an attempt to make GCC happy
Benjamin Kramer [Sat, 11 Apr 2020 13:11:44 +0000 (15:11 +0200)]
[FormatVariadic] Put back return type in an attempt to make GCC happy

4 years ago[argpromote] Use formatv to simplify code. NFCI.
Benjamin Kramer [Sat, 11 Apr 2020 12:48:53 +0000 (14:48 +0200)]
[argpromote] Use formatv to simplify code. NFCI.

4 years ago[FormatVariadic] Reduce allocations
Benjamin Kramer [Sat, 11 Apr 2020 12:40:01 +0000 (14:40 +0200)]
[FormatVariadic] Reduce allocations

- Move Adapters array to the stack, we know the size precisely
- Parse format string on demand into a SmallVector. In theory this could
  lead to parsing it multiple times, but I couldn't find a single instance
  of that in LLVM.
- Make more of the implementation details private.

4 years ago[PowerPC] Handle f16 as a storage type only
Nemanja Ivanovic [Sat, 11 Apr 2020 12:34:10 +0000 (07:34 -0500)]
[PowerPC] Handle f16 as a storage type only

The PPC back end currently crashes (fails to select) with f16 input. This patch
expands it on subtargets prior to ISA 3.0 (Power9) and uses the HW conversions
on Power9.

Fixes https://bugs.llvm.org/show_bug.cgi?id=39865

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

4 years ago[VPlan] Drop redundant private: at beginning of class defs (NFC).
Florian Hahn [Sat, 11 Apr 2020 11:59:50 +0000 (12:59 +0100)]
[VPlan] Drop redundant private: at beginning of class defs (NFC).

Default visibility for classes is private, so the private: at the top of
various class definitions is redundant.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[TSAN] Fix infinite loop on targets where char is unsigned
Nemanja Ivanovic [Sat, 11 Apr 2020 12:08:05 +0000 (07:08 -0500)]
[TSAN] Fix infinite loop on targets where char is unsigned

For targets where char is unsigned (like PowerPC), something like
char c = fgetc(...) will never produce a char that will compare
equal to EOF so this loop does not terminate.
Change the type to int (which appears to be the POSIX return type
for fgetc).
This allows the test case to terminate normally on PPC.

4 years agoCodeGen/EdgeBundles - move Twine.h include down into EdgeBundles.cpp. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:20:20 +0000 (12:20 +0100)]
CodeGen/EdgeBundles - move Twine.h include down into EdgeBundles.cpp. NFC.

EdgeBundles.h has no use for it.

4 years agoLocal.h - remove unnecessary Twine.h include. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:18:18 +0000 (12:18 +0100)]
Local.h - remove unnecessary Twine.h include. NFC.

4 years agoPhiValues.h - remove unused llvm::Use forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:16:19 +0000 (12:16 +0100)]
PhiValues.h - remove unused llvm::Use forward declaration. NFC.

4 years agoObjCARCAnalysisUtils.h - remove unused llvm::raw_ostream forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:15:22 +0000 (12:15 +0100)]
ObjCARCAnalysisUtils.h - remove unused llvm::raw_ostream forward declaration. NFC.

4 years agoSyntheticCountsUtils.h - remove unused llvm::CallGraph/Function forward declarations...
Simon Pilgrim [Sat, 11 Apr 2020 11:14:23 +0000 (12:14 +0100)]
SyntheticCountsUtils.h - remove unused llvm::CallGraph/Function forward declarations. NFC.

4 years agoOptimizationRemarkEmitter.h - remove unused llvm::DebugLoc/Loop/Pass/Twine forward...
Simon Pilgrim [Sat, 11 Apr 2020 11:13:31 +0000 (12:13 +0100)]
OptimizationRemarkEmitter.h - remove unused llvm::DebugLoc/Loop/Pass/Twine forward declarations. NFC.

4 years agoPasses.h - remove unused llvm::LoopPass/Pass/PassInfo forward declarations. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:12:36 +0000 (12:12 +0100)]
Passes.h - remove unused llvm::LoopPass/Pass/PassInfo forward declarations. NFC.

4 years ago[OpenMP] Introduce stream pool to make sure the correctness of device synchr...
Shilei Tian [Sat, 11 Apr 2020 11:08:56 +0000 (07:08 -0400)]
[OpenMP] Introduce stream pool to make sure the correctness of device synchr...
...onization

Summary: In previous patch, in order to optimize performance, we only synchronize once
for each target region. The syncrhonization is via stream synchronization.
However, in the extreme situation, the performce might be bad. Consider the
following case: There is a task that requires transferring huge amount of data
(call many times of data transferring function). It is scheduled to the first
stream. And then we have 255 very light tasks scheduled to the remaining 255
streams (by default we have 256 streams). They can be finished before we do
synchronization at the end of the first task. Next, we get another very huge
task. It will be scheduled again to the first stream. Now the first task
finishes its kernel launch and call stream synchronization. Right now, the
stream already contains two kernels, and the synchronization will wait until the
two kernels finish instead of just the first one for the first task.

In this patch, we introduce stream pool. After each synchronization, the stream
will be returned back to the pool to make sure that for each synchronization,
only expected operations are waited.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: gregrodgers, yaxunl, lildmh, guansong, openmp-commits

Tags: #openmp

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

4 years agoPredicateInfo.h - remove unused llvm::Instruction/MemoryAccess/LLVMContext forward...
Simon Pilgrim [Sat, 11 Apr 2020 10:24:18 +0000 (11:24 +0100)]
PredicateInfo.h - remove unused llvm::Instruction/MemoryAccess/LLVMContext forward declarations. NFC.

4 years agoIntrinsicLowering.h - remove unused llvm::Module forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:22:24 +0000 (11:22 +0100)]
IntrinsicLowering.h - remove unused llvm::Module forward declaration. NFC.

4 years agoExecutionDomainFix.h - remove unused llvm::MachineBasicBlock forward declaration...
Simon Pilgrim [Sat, 11 Apr 2020 10:21:40 +0000 (11:21 +0100)]
ExecutionDomainFix.h - remove unused llvm::MachineBasicBlock forward declaration. NFC.

4 years agoCallingConvLower.h - remove unused llvm::TargetMachine forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:20:00 +0000 (11:20 +0100)]
CallingConvLower.h - remove unused llvm::TargetMachine forward declaration. NFC.

4 years agoAnalysis.h - remove unused SDNode/SDValue/SelectionDAG forward declarations. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:18:29 +0000 (11:18 +0100)]
Analysis.h - remove unused SDNode/SDValue/SelectionDAG forward declarations. NFC.

4 years agotsan: add newline in test file
Dmitry Vyukov [Sat, 11 Apr 2020 09:13:39 +0000 (11:13 +0200)]
tsan: add newline in test file

Buildbots say:

[126/127] Running lint check for sanitizer sources...
FAILED: projects/compiler-rt/lib/CMakeFiles/SanitizerLintCheck
cd /home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/stage1/projects/compiler-rt/lib && env LLVM_CHECKOUT=/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/llvm SILENT=1 TMPDIR= PYTHON_EXECUTABLE=/usr/bin/python COMPILER_RT=/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt /home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt/test/tsan/fiber_cleanup.cpp:71:  Could not find a newline character at the end of the file.  [whitespace/ending_newline] [5]
ninja: build stopped: subcommand failed.

Somehow this check is not part of 'ninja check-tsan'.

4 years ago[PDB] Remove defunct PDBFileBuilder::commitFpm declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 17:23:29 +0000 (18:23 +0100)]
[PDB] Remove defunct PDBFileBuilder::commitFpm declaration. NFC.

4 years agotsan: fix leak of ThreadSignalContext memory mapping when destroying fibers
Dmitry Vyukov [Sat, 11 Apr 2020 07:52:13 +0000 (09:52 +0200)]
tsan: fix leak of ThreadSignalContext memory mapping when destroying fibers

When creating and destroying fibers in tsan a thread state is created and destroyed. Currently, a memory mapping is leaked with each fiber (in __tsan_destroy_fiber). This causes applications with many short running fibers to crash or hang because of linux vm.max_map_count.

The root of this is that ThreadState holds a pointer to ThreadSignalContext for handling signals. The initialization and destruction of it is tied to platform specific events in tsan_interceptors_posix and missed when destroying a fiber (specifically, SigCtx is used to lazily create the ThreadSignalContext in tsan_interceptors_posix). This patch cleans up the memory by makinh the ThreadState create and destroy the ThreadSignalContext.

The relevant code causing the leak with fibers is the fiber destruction:

void FiberDestroy(ThreadState *thr, uptr pc, ThreadState *fiber) {
  FiberSwitchImpl(thr, fiber);
  ThreadFinish(fiber);
  FiberSwitchImpl(fiber, thr);
  internal_free(fiber);
}

Author: Florian
Reviewed-in: https://reviews.llvm.org/D76073

4 years agotsan: disable ASLR in Go test on NetBSD
Dmitry Vyukov [Sat, 11 Apr 2020 07:46:45 +0000 (09:46 +0200)]
tsan: disable ASLR in Go test on NetBSD

Tsan does not support ASLR on NetBSD.
Disable ASLR in the Go test and extend
the error message to be more actionable.

Reported-by: Keith Randall (khr)
4 years ago[mlir][NFC] Refactor ClassID into a TypeID class.
River Riddle [Sat, 11 Apr 2020 06:46:52 +0000 (23:46 -0700)]
[mlir][NFC] Refactor ClassID into a TypeID class.

Summary: ClassID is a bit janky right now as it involves passing a magic pointer around. This revision hides the internal implementation mechanism within a new class TypeID. This class is a value-typed wrapper around the original ClassID implementation.

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

4 years agoChange FastISel::CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer...
Craig Topper [Sat, 11 Apr 2020 06:42:09 +0000 (23:42 -0700)]
Change FastISel::CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer. NFCI.

This is the same as what was done to the CallLoweringInfo in
TargetLowering.h in r309159.

This is just a step on the way to replacing this with CallBase.

4 years ago[mlir][Pass] Add a new `Pass::getArgument` hook
River Riddle [Sat, 11 Apr 2020 05:48:58 +0000 (22:48 -0700)]
[mlir][Pass] Add a new `Pass::getArgument` hook

Summary: This hook allows for passes to specify the command line argument without the need for registration. More concretely this will allow for generating pass crash reproducers without needing to have the passes registered. This should remove the need for production tools to register passes, leaving that solely to development tools like mlir-opt.

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

4 years ago[NFC][test] Refine tests for branch align
Shengchen Kan [Sat, 11 Apr 2020 04:32:35 +0000 (12:32 +0800)]
[NFC][test] Refine tests for branch align

Remove some redundant blank and triple description. And rename some
files.

4 years ago[X86][MC] Make -x86-pad-max-prefix-size compatible with --mc-relax-all
Shengchen Kan [Fri, 10 Apr 2020 10:37:24 +0000 (18:37 +0800)]
[X86][MC] Make -x86-pad-max-prefix-size compatible with --mc-relax-all

Summary: We allow non-relaxable instructions emitted into relaxable Fragment when we prefix padding branch. So we need to check if the instruction need relaxation before relaxing it.  Without this patch, it currently triggers a `report_fatal_error` in `llvm::MCAsmBackend::relaxInstruction` when we prefix padding branch along with `--mc-relax-all`.

Reviewers: LuoYuanke, reames, MaskRay

Reviewed By: MaskRay

Subscribers: MaskRay, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Temporarily disable failing tests on Windows
Julian Lettner [Sat, 11 Apr 2020 03:03:44 +0000 (20:03 -0700)]
[lit] Temporarily disable failing tests on Windows

4 years ago[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.
Craig Topper [Sat, 11 Apr 2020 01:29:02 +0000 (18:29 -0700)]
[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.

I only left it at the interface to ParseConstraints since that
needs updates to other callers in different files. I'll do that
as a follow up.

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

4 years ago[PowerPC] Another folow-up fix for 6c4b40def776
Nemanja Ivanovic [Sat, 11 Apr 2020 02:05:41 +0000 (21:05 -0500)]
[PowerPC] Another folow-up fix for 6c4b40def776

There was another issue introduced by this commit that the OP
initially missed. Namely, for functions that are free to use
R2 as a callee-saved register, we emit a TOC expression based
on the address of the GEP label without emitting the GEP label.
Since we only emit such expressions for the large code model, this
issue only surfaced there.

I have confirmed that with this fix, the kernel build is successful
with target "all".

4 years ago[X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault
Scott Constable [Sat, 11 Apr 2020 00:32:39 +0000 (17:32 -0700)]
[X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault

`MBB.back()` could segfault if `MBB.empty()`. Fixed by checking for `MBB.empty()` in the loop.

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

4 years agoConvert the ThreadPlanCommands test to use a scripted plan
Jim Ingham [Sat, 11 Apr 2020 01:11:10 +0000 (18:11 -0700)]
Convert the ThreadPlanCommands test to use a scripted plan
that pushes a step over plan.  Relax the listing checker
so it will look past any entries after the ones listed in
the input patterns.  Then for the internal plans just check
for the StepOver plan that our scripted plan pushes, and look past
any others.

This should make the test more robust on systems that don't use the
step-in then push a step-out plan to step over a function.

4 years agoThread Plans pushed by a scripted plan should be private plans.
Jim Ingham [Fri, 10 Apr 2020 22:37:05 +0000 (15:37 -0700)]
Thread Plans pushed by a scripted plan should be private plans.

If a plan is not private, "thread plan discard" can discard it.  It would
not be hard to write reliable scripted plan if its subplans could get
removed out from under it.

4 years agoRevert "[TLI] Per-function fveclib for math library used for vectorization"
Mehdi Amini [Sat, 11 Apr 2020 01:00:58 +0000 (01:00 +0000)]
Revert "[TLI] Per-function fveclib for math library used for vectorization"

This reverts commit 60c642e74be6af86906d9f3d982728be7bd4329f.

This patch is making the TLI "closed" for a predefined set of VecLib
while at the moment it is extensible for anyone to customize when using
LLVM as a library.
Reverting while we figure out a way to re-land it without losing the
generality of the current API.

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

4 years ago[libc] Add fully-qualified target names.
Siva Chandra Reddy [Wed, 4 Mar 2020 23:45:51 +0000 (15:45 -0800)]
[libc] Add fully-qualified target names.

Only targets setup by the special LLVM libc rules now have fully
qualified names. The naming style is similar to fully qualified names in
Python.

Reviewers: abrachet, PaulkaToast, phosek

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

4 years agoGlobalISel: Fix incorrect lowering G_FCOPYSIGN
Matt Arsenault [Sat, 11 Apr 2020 00:44:45 +0000 (20:44 -0400)]
GlobalISel: Fix incorrect lowering G_FCOPYSIGN

In the basic case, this was reading the sign from the wrong operand.

4 years ago[GVN] Fix VNCoercion for Scalable Vector.
Huihui Zhang [Sat, 11 Apr 2020 00:48:56 +0000 (17:48 -0700)]
[GVN] Fix VNCoercion for Scalable Vector.

Summary:
For VNCoercion, skip scalable vector when analysis rely on fixed size,
otherwise call TypeSize::getFixedSize() explicitly.

Add unit tests to check funtionality of GVN load elimination for scalable type.

Reviewers: sdesmalen, efriedma, spatel, fhahn, reames, apazos, ctetreau

Reviewed By: efriedma

Subscribers: bjope, hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[lit] Fix tests on Windows
Julian Lettner [Sat, 11 Apr 2020 00:12:54 +0000 (17:12 -0700)]
[lit] Fix tests on Windows

max-time.py:
  Windows does not have a native `sleep` command, use `time.sleep()` in
  Python instead.

max-failures.py:
  The max-failure test reused the shtest-shell test inputs instead of
  defining its own "test domain".  However, the output of this
  shtest-shell "test domain" is slightly different on Windows, which now
  bites us since we made the max-failures test stricter.  Let's define
  our own "max failures" test domain.

4 years agollvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries
David Blaikie [Sat, 11 Apr 2020 00:26:11 +0000 (17:26 -0700)]
llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries

This probably isn't ideal - the error was being printed specifically
inline with the dumping that was more legible - but then the error
wasn't reported to stderr and didn't produce a non-zero exit code.

Probably the error message could be improved by adding more context now
that it isn't printed in-situ of the DIE dumping as much.

4 years agoExclude bitcast and ext/trunc signbit optimization on ppc_fp128
Eric Christopher [Sat, 11 Apr 2020 00:06:17 +0000 (17:06 -0700)]
Exclude bitcast and ext/trunc signbit optimization on ppc_fp128

Revision a1c05fe <https://reviews.llvm.org/rGa1c05fe20f3def1f1be9f50d2adefc6b6f1578ad>
removed bitcast from the list of problematic transformations, however:

  %97 = fptrunc ppc_fp128 %2 to double            // we need to check ppc_fp128 here to prevent the transformation
  %98 = bitcast double %97 to i64                 // a1c05fe checks ppc_fp128 at here
  %99 = icmp slt i64 %98, 0
  %100 = zext i1 %99 to i8
  store i8 %100, i8* %7, align 1

so this patch does that. I'm also disabling it in the presence of extend just in case.

I verified separately that the hash of -std::infinity and std::infinity don't match now.

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

4 years ago[ELF][test] Reorganize format-binary.test
Fangrui Song [Fri, 10 Apr 2020 23:27:49 +0000 (16:27 -0700)]
[ELF][test] Reorganize format-binary.test

Also drop dependency on the output directory name (lit implementation detail).

4 years ago[BasicAA] Fix aliasGEP/DecomposeGEPExpression for scalable type.
Huihui Zhang [Fri, 10 Apr 2020 23:24:18 +0000 (16:24 -0700)]
[BasicAA] Fix aliasGEP/DecomposeGEPExpression for scalable type.

Summary:
Don't attempt to analyze the decomposed GEP for scalable type.
GEP index scale is not compile-time constant for scalable type.
Be conservative, return MayAlias.

Explicitly call TypeSize::getFixedSize() to assert on places where
scalable type doesn't make sense.

Add unit tests to check functionality of -basicaa for scalable type.

This patch is needed for D76944.

Reviewers: sdesmalen, efriedma, spatel, bjope, ctetreau

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Test] Rewrite ReproducerInstrumentationTest
Jonas Devlieghere [Fri, 10 Apr 2020 22:42:28 +0000 (15:42 -0700)]
[lldb/Test] Rewrite ReproducerInstrumentationTest

The instrumentation unit tests' current implementation uses global
variables to track constructor calls for the instrumented classes during
replay. This is suboptimal because it indirectly relies on how the
reproducer instrumentation is implemented. I found out when adding
support for passive replay and the test broke because we made an extra
(temporary) copy of the instrumented objects.

Additionally, the old approach wasn't very self-explanatory. It took me
a bit of time to understand why we were expecting the number of objects
in the test.

This patch rewrites the test and uses the index-to-object-mapping to
verify the objects created during replay. You can now specify the
expected objects, in order, and whether they should be valid or not. I
find that it makes the tests much easier to understand. More
importantly, this approach is resilient to implementation detail changes
in the instrumentation.

4 years ago[WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.
Sam Clegg [Fri, 10 Apr 2020 20:07:19 +0000 (13:07 -0700)]
[WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.

Pretty much all other platforms pass CPU string as arg0 of
initializeSubtargetDependencies.

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

4 years agoMake basic_string::operator=() tail call properly
Martijn Vels [Fri, 10 Apr 2020 22:36:31 +0000 (18:36 -0400)]
Make basic_string::operator=() tail call properly

Summary: We discovered that the compiler may chose not to inline the operator=, which leads to an expensive extra stack frame. This change makes __assign_no_alias always tail called.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

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

4 years agoAdd -debugify-and-strip-all to add debug info before a pass and remove it after
Daniel Sanders [Wed, 8 Apr 2020 20:48:40 +0000 (13:48 -0700)]
Add -debugify-and-strip-all to add debug info before a pass and remove it after

Summary:
This allows us to test each backend pass under the presence
of debug info using pre-existing tests. The tests should not
fail as a result of this so long as it's true that debug info
does not affect CodeGen.

In practice, a few tests are sensitive to this:
* Tests that check the pass structure (e.g. O0-pipeline.ll)
* Tests that check --debug output. Specifically instruction
  dumps containing MMO's (e.g. prelegalizercombiner-extends.ll)
* Tests that contain debugify metadata as mir-strip-debug will
  remove it (e.g. fastisel-debugvalue-undef.ll)
* Tests with partial debug info (e.g.
  patchable-function-entry-empty.mir had debug info but no
  !llvm.dbg.cu)
* Tests that check optimization remarks overly strictly (e.g.
  prologue-epilogue-remarks.mir)
* Tests that would inject the pass in an unsafe region (e.g.
  seqpairspill.mir would inject between register alloc and
  virt reg rewriter)
In all cases, the checks can either be updated or
--debugify-and-strip-all-safe=0 can be used to avoid being
affected by something like llvm-lit -Dllc='llc --debugify-and-strip-all-safe'

I tested this without the lost debug locations verifier to
confirm that AArch64 behaviour is unaffected (with the fixes
in this patch) and with it to confirm it finds the problems
without the additional RUN lines we had before.

Depends on D77886, D77887, D77747

Reviewers: aprantl, vsk, bogner

Subscribers: qcolombet, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[lit] Increase sleep time in timeout test
Julian Lettner [Fri, 10 Apr 2020 23:22:00 +0000 (16:22 -0700)]
[lit] Increase sleep time in timeout test

Fixup for cbe42a9d5fa.  Increase values for testing the overall lit
timeout (--max-time) which wasn't enough for the test to complete on
very slow build bots.

4 years ago[ORC] Add an OrcV2 C API function for configuring TargetMachines.
Lang Hames [Fri, 10 Apr 2020 21:07:51 +0000 (14:07 -0700)]
[ORC] Add an OrcV2 C API function for configuring TargetMachines.

4 years agoDisable test on windows
Matt Arsenault [Fri, 10 Apr 2020 22:47:48 +0000 (18:47 -0400)]
Disable test on windows

4 years ago[llvm][NFC] Inliner.cpp: ensure InlineHistory ID is always initialized;
Mircea Trofin [Fri, 10 Apr 2020 15:16:49 +0000 (08:16 -0700)]
[llvm][NFC] Inliner.cpp: ensure InlineHistory ID is always initialized;

Summary:
The inline history is associated with a call site. There are two locations
we fetch inline history. In one, we fetch it together with the call
site. In the other, we initialize it under certain conditions, use it
later under same conditions (different if check), and otherwise is
uninitialized. Although currently there is no uninitialized use, the
code is more challenging to maintain correctly, than if the value were
always initialized.

Changed to the upfront initialization pattern already present in this
file.

Reviewers: davidxl, dblaikie

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mir-strip-debug] Optionally preserve debug info that wasn't from debugify/mir-debugify
Daniel Sanders [Thu, 9 Apr 2020 17:36:50 +0000 (10:36 -0700)]
[mir-strip-debug] Optionally preserve debug info that wasn't from debugify/mir-debugify

Summary:
A few tests start out with debug info and expect it to reach
the output. For these tests we shouldn't strip the debug info

Reviewers: aprantl, vsk, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Add SKIPPED test result category
Julian Lettner [Fri, 8 Mar 2019 04:48:24 +0000 (20:48 -0800)]
[lit] Add SKIPPED test result category

Track and print the number of skipped tests.  Skipped tests are tests
that should have been executed but weren't due to:
  * user interrupt [Ctrl+C]
  * --max-time (overall lit timeout)
  * --max-failures

This is part of a larger effort to ensure that all discovered tests are
properly accounted for.

Add test for overall lit timeout feature (`--max-time` option) to
observe skipped tests.  Extend test for `--max-failures` option.

Reviewed By: jdenny

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 21:23:20 +0000 (14:23 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: stoklund, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Pass] Allow duplicate pass registration.
River Riddle [Fri, 10 Apr 2020 21:49:44 +0000 (14:49 -0700)]
[mlir][Pass] Allow duplicate pass registration.

Summary: With users registering their own dependencies, duplicate pass registration becomes more and more common. This revision relaxes that pass registration be unique. This is safe to assume given that we key on the passID, which is guaranteed to be unique per pass class.

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

4 years ago[libc++] NFC: Clean up a lot of old Lit features
Louis Dionne [Fri, 10 Apr 2020 20:14:10 +0000 (16:14 -0400)]
[libc++] NFC: Clean up a lot of old Lit features

The libc++ test suite has a lot of old Lit features used to XFAIL tests
and mark them as UNSUPPORTED. Many of them are to workaround problems on
old compilers or old platforms. As time goes by, it is good to go and
clean those up to simplify the configuration of the test suite, and also
to reflect the testing reality. It's not useful to have markup that gives
the impression that e.g. clang-3.3 is supported, when we don't really
test on it anymore (and hence several new tests probably don't have the
necessary markup on them).

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 20:59:26 +0000 (13:59 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: dexonsmith, sdesmalen, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][ODS] Add support for optional operands and results with a new Optional directive.
River Riddle [Fri, 10 Apr 2020 21:11:45 +0000 (14:11 -0700)]
[mlir][ODS] Add support for optional operands and results with a new Optional directive.

Summary: This revision adds support for specifying operands or results as "optional". This is a special case of variadic where the number of elements is either 0 or 1. Operands and results of this kind will have accessors generated using Value instead of the range types, making it more natural to interface with.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 20:49:05 +0000 (13:49 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: dexonsmith, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoMake TargetPassConfig and llc add pre/post passes the same way. NFC
Daniel Sanders [Wed, 8 Apr 2020 20:43:46 +0000 (13:43 -0700)]
Make TargetPassConfig and llc add pre/post passes the same way. NFC

Summary:
At the moment, any changes we make to the passes that can be
injected before/after others (e.g. -verify-machineinstrs and
-print-after-all) have to be duplicated in both
TargetPassConfig (for normal execution, -start-before/
-stop-before/etc) and llc (for -run-pass). Unify this pass
injection into addMachinePrePass/addMachinePostPass that both
TargetPassConfig and llc can use.

Reviewers: vsk, aprantl, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 19:55:36 +0000 (12:55 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: rriddle, efriedma, sdesmalen

Reviewed By: sdesmalen

Subscribers: frgossen, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, llvm-commits

Tags: #llvm

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

4 years ago[ORC] Use CodeGenOpt::Default as the default level in JITTargetMachineBuilder.
Lang Hames [Fri, 10 Apr 2020 20:24:41 +0000 (13:24 -0700)]
[ORC] Use CodeGenOpt::Default as the default level in JITTargetMachineBuilder.

This matches EngineBuilder/MCJIT's default.

4 years ago[libc++] NFC: Fix typo in Lit feature (C++14 with a capital C)
Louis Dionne [Fri, 10 Apr 2020 20:11:22 +0000 (16:11 -0400)]
[libc++] NFC: Fix typo in Lit feature (C++14 with a capital C)

4 years ago[mlir] Emit errors if global constructors are found within lib/
River Riddle [Fri, 10 Apr 2020 19:57:18 +0000 (12:57 -0700)]
[mlir] Emit errors if global constructors are found within lib/

Summary: This avoids adding any additional global constructors, like cl::opt. There is a temporary exception on IR/, which has a few cl::opts that require a bit of plumbing to remove.

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

4 years ago[x86] add test for FP->int->FP casts; NFC (PR36617)
Sanjay Patel [Fri, 10 Apr 2020 19:56:10 +0000 (15:56 -0400)]
[x86] add test for FP->int->FP casts; NFC (PR36617)

Also, add a common prefix for SSE to reduce redundant CHECK lines.

4 years ago[mlir][drr] Allow specifying string in location
Jacques Pienaar [Fri, 10 Apr 2020 00:18:34 +0000 (17:18 -0700)]
[mlir][drr] Allow specifying string in location

Summary:
The string in the location is used to provide metadata for the fused location
or create a NamedLoc. This allows tagging individual locations to convey
additional rewrite information.

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

4 years ago[CallSite removal][X86] Remove uses of CallSite from X86WinEHState.cpp
Craig Topper [Fri, 10 Apr 2020 07:50:49 +0000 (00:50 -0700)]
[CallSite removal][X86] Remove uses of CallSite from X86WinEHState.cpp

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

4 years ago[gn build] Port ea11f4726f2
LLVM GN Syncbot [Fri, 10 Apr 2020 18:26:30 +0000 (18:26 +0000)]
[gn build] Port ea11f4726f2

4 years agoSplit LiveRangeCalc in LiveRangeCalc/LiveIntervalCalc. NFC
Marcello Maggioni [Mon, 23 Mar 2020 02:08:29 +0000 (19:08 -0700)]
Split LiveRangeCalc in LiveRangeCalc/LiveIntervalCalc. NFC

Summary:
Refactor LiveRangeCalc such that it is now split into two classes

The objective is to split all the "register specific" logic away
from LiveRangeCalc.
The two new classes created are:

- LiveRangeCalc - is meant as a generic class to compute and modify
  live ranges in a generic way. This class should deal only with
  SlotIndices and VNInfo objects.

- LiveIntervalCals - is meant to be equivalent to the old LiveRangeCalc.
  It computes the liveness virtual registers tracked by a LiveInterval
  object.

With this refactoring LiveRangeCalc can be used to implement tracking of
liveness of LiveRanges that represent other things than just registers.

Subscribers: MatzeB, qcolombet, mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Linalg] Create a tool to generate named Linalg ops from a Tensor Comprehension...
Nicolas Vasilache [Fri, 10 Apr 2020 17:54:08 +0000 (13:54 -0400)]
[mlir][Linalg] Create a tool to generate named Linalg ops from a Tensor Comprehensions-like specification.

Summary:

This revision adds a tool that generates the ODS and C++ implementation for "named" Linalg ops according to the [RFC discussion](https://llvm.discourse.group/t/rfc-declarative-named-ops-in-the-linalg-dialect/745).

While the mechanisms and language aspects are by no means set in stone, this revision allows connecting the pieces end-to-end from a mathematical-like specification.

Some implementation details and short-term decisions taken for the purpose of bootstrapping and that are not set in stone include:

    1. using a "[Tensor Comprehension](https://arxiv.org/abs/1802.04730)-inspired" syntax
    2. implicit and eager discovery of dims and symbols when parsing
    3. using EDSC ops to specify the computation (e.g. std_addf, std_mul_f, ...)

A followup revision will connect this tool to tablegen mechanisms and allow the emission of named Linalg ops that automatically lower to various loop forms and run end to end.

For the following "Tensor Comprehension-inspired" string:

```
    def batch_matmul(A: f32(Batch, M, K), B: f32(K, N)) -> (C: f32(Batch, M, N)) {
      C(b, m, n) = std_addf<k>(std_mulf(A(b, m, k), B(k, n)));
    }
```

With -gen-ods-decl=1, this emits (modulo formatting):

```
      def batch_matmulOp : LinalgNamedStructured_Op<"batch_matmul", [
        NInputs<2>,
        NOutputs<1>,
        NamedStructuredOpTraits]> {
          let arguments = (ins Variadic<LinalgOperand>:$views);
          let results = (outs Variadic<AnyRankedTensor>:$output_tensors);
          let extraClassDeclaration = [{
            llvm::Optional<SmallVector<StringRef, 8>> referenceIterators();
            llvm::Optional<SmallVector<AffineMap, 8>> referenceIndexingMaps();
            void regionBuilder(ArrayRef<BlockArgument> args);
          }];
          let hasFolder = 1;
      }
```

With -gen-ods-impl, this emits (modulo formatting):

```
      llvm::Optional<SmallVector<StringRef, 8>> batch_matmul::referenceIterators() {
          return SmallVector<StringRef, 8>{ getParallelIteratorTypeName(),
                                            getParallelIteratorTypeName(),
                                            getParallelIteratorTypeName(),
                                            getReductionIteratorTypeName() };
      }
      llvm::Optional<SmallVector<AffineMap, 8>> batch_matmul::referenceIndexingMaps()
      {
        MLIRContext *context = getContext();
        AffineExpr d0, d1, d2, d3;
        bindDims(context, d0, d1, d2, d3);
        return SmallVector<AffineMap, 8>{
            AffineMap::get(4, 0, {d0, d1, d3}),
            AffineMap::get(4, 0, {d3, d2}),
            AffineMap::get(4, 0, {d0, d1, d2}) };
      }
      void batch_matmul::regionBuilder(ArrayRef<BlockArgument> args) {
        using namespace edsc;
        using namespace intrinsics;
        ValueHandle _0(args[0]), _1(args[1]), _2(args[2]);

        ValueHandle _4 = std_mulf(_0, _1);
        ValueHandle _5 = std_addf(_2, _4);
        (linalg_yield(ValueRange{ _5 }));
      }
```

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

4 years ago[Pipeliner] Fix the bug in pragma that disables the pipeliner.
Sumanth Gundapaneni [Fri, 10 Apr 2020 17:50:43 +0000 (12:50 -0500)]
[Pipeliner] Fix the bug in pragma that disables the pipeliner.

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

4 years agoImplement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for...
Matt Morehouse [Fri, 10 Apr 2020 17:42:41 +0000 (10:42 -0700)]
Implement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for clang

Summary:
This commit adds two command-line options to clang.
These options let the user decide which functions will receive SanitizerCoverage instrumentation.
This is most useful in the libFuzzer use case, where it enables targeted coverage-guided fuzzing.

Patch by Yannis Juglaret of DGA-MI, Rennes, France

libFuzzer tests its target against an evolving corpus, and relies on SanitizerCoverage instrumentation to collect the code coverage information that drives corpus evolution. Currently, libFuzzer collects such information for all functions of the target under test, and adds to the corpus every mutated sample that finds a new code coverage path in any function of the target. We propose instead to let the user specify which functions' code coverage information is relevant for building the upcoming fuzzing campaign's corpus. To this end, we add two new command line options for clang, enabling targeted coverage-guided fuzzing with libFuzzer. We see targeted coverage guided fuzzing as a simple way to leverage libFuzzer for big targets with thousands of functions or multiple dependencies. We publish this patch as work from DGA-MI of Rennes, France, with proper authorization from the hierarchy.

Targeted coverage-guided fuzzing can accelerate bug finding for two reasons. First, the compiler will avoid costly instrumentation for non-relevant functions, accelerating fuzzer execution for each call to any of these functions. Second, the built fuzzer will produce and use a more accurate corpus, because it will not keep the samples that find new coverage paths in non-relevant functions.

The two new command line options are `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist`. They accept files in the same format as the existing `-fsanitize-blacklist` option <https://clang.llvm.org/docs/SanitizerSpecialCaseList.html#format>. The new options influence SanitizerCoverage so that it will only instrument a subset of the functions in the target. We explain these options in detail in `clang/docs/SanitizerCoverage.rst`.

Consider now the woff2 fuzzing example from the libFuzzer tutorial <https://github.com/google/fuzzer-test-suite/blob/master/tutorial/libFuzzerTutorial.md>. We are aware that we cannot conclude much from this example because mutating compressed data is generally a bad idea, but let us use it anyway as an illustration for its simplicity. Let us use an empty blacklist together with one of the three following whitelists:

```
  # (a)
  src:*
  fun:*

  # (b)
  src:SRC/*
  fun:*

  # (c)
  src:SRC/src/woff2_dec.cc
  fun:*
```

Running the built fuzzers shows how many instrumentation points the compiler adds, the fuzzer will output //XXX PCs//. Whitelist (a) is the instrument-everything whitelist, it produces 11912 instrumentation points. Whitelist (b) focuses coverage to instrument woff2 source code only, ignoring the dependency code for brotli (de)compression; it produces 3984 instrumented instrumentation points. Whitelist (c) focuses coverage to only instrument functions in the main file that deals with WOFF2 to TTF conversion, resulting in 1056 instrumentation points.

For experimentation purposes, we ran each fuzzer approximately 100 times, single process, with the initial corpus provided in the tutorial. We let the fuzzer run until it either found the heap buffer overflow or went out of memory. On this simple example, whitelists (b) and (c) found the heap buffer overflow more reliably and 5x faster than whitelist (a). The average execution times when finding the heap buffer overflow were as follows: (a) 904 s, (b) 156 s, and (c) 176 s.

We explain these results by the fact that WOFF2 to TTF conversion calls the brotli decompression algorithm's functions, which are mostly irrelevant for finding bugs in WOFF2 font reconstruction but nevertheless instrumented and used by whitelist (a) to guide fuzzing. This results in longer execution time for these functions and a partially irrelevant corpus. Contrary to whitelist (a), whitelists (b) and (c) will execute brotli-related functions without instrumentation overhead, and ignore new code paths found in them. This results in faster bug finding for WOFF2 font reconstruction.

The results for whitelist (b) are similar to the ones for whitelist (c). Indeed, WOFF2 to TTF conversion calls functions that are mostly located in SRC/src/woff2_dec.cc. The 2892 extra instrumentation points allowed by whitelist (b) do not tamper with bug finding, even though they are mostly irrelevant, simply because most of these functions do not get called. We get a slightly faster average time for bug finding with whitelist (b), which might indicate that some of the extra instrumentation points are actually relevant, or might just be random noise.

Reviewers: kcc, morehouse, vitalybuka

Reviewed By: morehouse, vitalybuka

Subscribers: pratyai, vitalybuka, eternalsakura, xwlin222, dende, srhines, kubamracek, #sanitizers, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

4 years ago[MC][RISCV] Make .reloc support arbitrary relocation types
Fangrui Song [Sun, 29 Mar 2020 17:01:01 +0000 (10:01 -0700)]
[MC][RISCV] Make .reloc support arbitrary relocation types

Similar to D76746 (ARM), D76754 (AArch64) and llvmorg-11-init-6967-g152d14da64c (x86)

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

4 years agoAMDGPU: Teach toolchain to link rocm device libs
Matt Arsenault [Wed, 15 Aug 2018 15:25:25 +0000 (18:25 +0300)]
AMDGPU: Teach toolchain to link rocm device libs

Currently the library is separately linked, but this isn't correct to
implement fast math flags correctly. Each module should get the
version of the library appropriate for its combination of fast math
and related flags, with the attributes propagated into its functions
and internalized.

HIP already maintains the list of libraries, but this is not used for
OpenCL. Unfortunately, HIP uses a separate --hip-device-lib argument,
despite both languages using the same bitcode library. Eventually
these two searches need to be merged.

An additional problem is there are 3 different locations the libraries
are installed, depending on which build is used. This also needs to be
consolidated (or at least the search logic needs to deal with this
unnecessary complexity).

4 years agoAttempt to fix a compile error reported with older compilers and libstdc++
Adrian Prantl [Fri, 10 Apr 2020 17:34:08 +0000 (10:34 -0700)]
Attempt to fix a compile error reported with older compilers and libstdc++

4 years ago[CallSite removal][X86] Remove unneeded use of CallSite. NFC
Craig Topper [Fri, 10 Apr 2020 17:23:47 +0000 (10:23 -0700)]
[CallSite removal][X86] Remove unneeded use of CallSite. NFC

We already have a CallInst, we can just get the calling convention from it.

4 years ago[lldb] Make some asserts in TestFixIts more expressive
Raphael Isemann [Fri, 10 Apr 2020 17:16:33 +0000 (19:16 +0200)]
[lldb] Make some asserts in TestFixIts more expressive

4 years agoFix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS...
David Blaikie [Fri, 10 Apr 2020 17:11:29 +0000 (10:11 -0700)]
Fix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS build

These were accidental SCARY iterator uses that weren't guaranteed and in
libc++'s debug checking mode were actually distinct types. Use decltype
to make it easier to keep these things up to date.

4 years ago[FPEnv][AArch64] Platform-specific builtin constrained FP enablement
Kevin P. Neal [Fri, 10 Apr 2020 16:35:42 +0000 (11:35 -0500)]
[FPEnv][AArch64] Platform-specific builtin constrained FP enablement

When constrained floating point is enabled the AArch64-specific builtins don't use constrained intrinsics in some cases. Fix that.

Neon is part of this patch, so ARM is affected as well.

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

4 years ago[PowerPC][NFC] Add test for 5b18b6e9a84d985c0a907009fb71de7c1943bc88
Nemanja Ivanovic [Fri, 10 Apr 2020 16:35:42 +0000 (11:35 -0500)]
[PowerPC][NFC] Add test for 5b18b6e9a84d985c0a907009fb71de7c1943bc88

When the above commit was added to fix a kernel build break, no tests were
added. Just adding some testing to ensure similar regressions do not recur.

4 years agoTargetOptions.h - remove unused llvm::Module forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 16:34:49 +0000 (17:34 +0100)]
TargetOptions.h - remove unused llvm::Module forward declaration. NFC.