platform/upstream/llvm.git
4 years ago[mlir] Toy tutorial: avoid erasing and then re-creating loop terminators
Alex Zinenko [Tue, 2 Jun 2020 10:49:45 +0000 (12:49 +0200)]
[mlir] Toy tutorial: avoid erasing and then re-creating loop terminators

The lower-to-affine-loops pass in chapters 5-7 of the Toy tutorial has
been creating affine loops, erasing their terminator and creating it
anew using a PatternRewriter instance to work around the fact that
implicit terminators were created without notifying the rewriter. Now
that has been fixed in 3ccf4a5bd109, remove the code erasing and
re-creating the terminators and rely on the default ones.

4 years agoAdd missing MemoryBuffer.h include
Simon Pilgrim [Tue, 2 Jun 2020 10:24:42 +0000 (11:24 +0100)]
Add missing MemoryBuffer.h include

4 years ago[mlir] post-commit review fixes
Alex Zinenko [Tue, 2 Jun 2020 10:06:56 +0000 (12:06 +0200)]
[mlir] post-commit review fixes

This fixes several post-commit nits from D79688 and D80135, namely
typos, debug output and control flow inversion.

4 years agoTextAPIReader.h - reduce MemoryBuffer.h include to forward declaration. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 09:52:39 +0000 (10:52 +0100)]
TextAPIReader.h - reduce MemoryBuffer.h include to forward declaration. NFC.

4 years agoTextAPIWriter.h - reduce MemoryBuffer.h include to forward declarations. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 09:51:50 +0000 (10:51 +0100)]
TextAPIWriter.h - reduce MemoryBuffer.h include to forward declarations. NFC.

4 years ago[Sema] Fix -Wunused-variable in CreateBuiltinMatrixSubscriptExpr (NFC).
Florian Hahn [Tue, 2 Jun 2020 09:45:30 +0000 (10:45 +0100)]
[Sema] Fix -Wunused-variable in CreateBuiltinMatrixSubscriptExpr (NFC).

4 years ago[LV] Make sure the MaxVF is a power-of-2 by rounding down.
Florian Hahn [Tue, 2 Jun 2020 09:33:10 +0000 (10:33 +0100)]
[LV] Make sure the MaxVF is a power-of-2 by rounding down.

LV currently only supports power of 2 vectorization factors, which has
been made explicit with the assertion added in
840450549c9199150cbdee29acef756c19660ca1.

However, if the widest type is not a power-of-2 the computed MaxVF won't
be a power-of-2 either. This patch updates computeFeasibleMaxVF to
ensure the returned value is a power-of-2 by rounding down to the
nearest power-of-2.

Fixes PR46139.

Reviewers: Ayal, gilr, rengolin

Reviewed By: Ayal

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

4 years ago[mlir] Introduce CallOp converter for buffer placement
Ehsan Toosi [Tue, 26 May 2020 13:03:45 +0000 (15:03 +0200)]
[mlir] Introduce CallOp converter for buffer placement

Add BufferAssignmentCallOpConverter as a pattern rewriter for Buffer
Placement. It matches the signature of the caller operation with the callee
after rewriting the callee with FunctionAndBlockSignatureConverter.

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

4 years ago[EarlyCSE] Common gc.relocate calls.
Denis Antrushin [Fri, 22 May 2020 14:03:02 +0000 (17:03 +0300)]
[EarlyCSE] Common gc.relocate calls.

gc.relocate intrinsic is special in that its second and third operands
are not real values, but indices into relocate's parent statepoint list
of GC pointers.
To be CSE'd, they need special handling in `isEqual()` and `getHashCode()`.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D80445

4 years ago[LLDB] Mark TestCreateDuringInstructionStep as flaky on Linux
Muhammad Omair Javaid [Tue, 2 Jun 2020 09:08:10 +0000 (14:08 +0500)]
[LLDB] Mark TestCreateDuringInstructionStep as flaky on Linux

This patch marks TestCreateDuringInstructionStep.py as flakey for Linux.
This is failing randomly on arm/aarch64. I will monitor buildbot and
skip it if it fails again.

4 years ago[VectorCombine][X86] Add loaded insert tests from D80885
Simon Pilgrim [Tue, 2 Jun 2020 09:03:41 +0000 (10:03 +0100)]
[VectorCombine][X86] Add loaded insert tests from D80885

4 years ago[AST] Fix a null initializer crash for InitListExpr
Haojian Wu [Fri, 29 May 2020 21:27:05 +0000 (23:27 +0200)]
[AST] Fix a null initializer crash for InitListExpr

Summary:
The Initializer of a InitListExpr can be reset to null, which leads to
nullptr-acces crashes.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mips] Support 64-bit relative relocations
Simon Atanasyan [Fri, 24 Apr 2020 12:41:13 +0000 (15:41 +0300)]
[mips] Support 64-bit relative relocations

MIPS 64-bit ABI does not provide special PC-relative relocation like
R_MIPS_PC32 in 32-bit case. But we can use a "chain of relocation"
defined by N64 ABIs. In that case one relocation record might contain up
to three relocations which applied sequentially. Width of a final relocation
mask applied to the result of relocation depends on the last relocation
in the chain. In case of 64-bit PC-relative relocation we need the following
chain: `R_MIPS_PC32 | R_MIPS_64`. The first relocation calculates an
offset, but does not truncate the result. The second relocation just
apply calculated result as a 64-bit value.

The 64-bit PC-relative relocation might be useful in generation of
`.eh_frame` sections to escape passing `-Wl,-z,notext` flags to linker.

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

4 years agoRun syntax tree tests in many language modes
Dmitri Gribenko [Tue, 2 Jun 2020 08:30:01 +0000 (10:30 +0200)]
Run syntax tree tests in many language modes

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: gribozavr2, mgorny, cfe-commits

Tags: #clang

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

4 years ago[VE] Support I32/F32 registers in assembler parser
Kazushi (Jam) Marukawa [Tue, 2 Jun 2020 08:22:30 +0000 (10:22 +0200)]
[VE] Support I32/F32 registers in assembler parser

Summary:
Support I32/F32 registers in assembler parser and add regression tests of LD/ST
instructions.

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

4 years ago[llvm-exegesis] Fix D80610.
Clement Courbet [Tue, 2 Jun 2020 07:36:11 +0000 (09:36 +0200)]
[llvm-exegesis] Fix D80610.

Summary:
Using a .data() member on a StringRef was discarding the StringRef
size, breaking llvm-exegesis on machines with counter sums (e.g.
Zen2).

Reviewers: oontvoo

Subscribers: mstojanovic, llvm-commits

Tags: #llvm

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

4 years ago[NFC][ARM][AArch64] Test runs
Sam Parker [Tue, 2 Jun 2020 08:04:20 +0000 (09:04 +0100)]
[NFC][ARM][AArch64] Test runs

Add code size tests runs for memory ops for both architectures.

4 years ago[OpenMP][OMPT] Fix and add event callbacks for detached tasks
Joachim Protze [Mon, 1 Jun 2020 12:49:45 +0000 (14:49 +0200)]
[OpenMP][OMPT] Fix and add event callbacks for detached tasks

The OpenMP spec has the task-fulfill event for a call to omp_fulfill_event.
If the task did not yet finish execution, ompt_task_early_fulfill is used,
otherwise ompt_task_late_fulfill.
If a task does not complete, when the execution finishes (i.e., the task goes
in detached mode), ompt_task_detach instead of ompt_task_complete must be
used, when the next task is scheduled.

A test for both cases is included, which only work with clang-11+

Reviewed By: hbae

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

4 years agoOptions for Basic Block Sections, enabled in D68063 and D73674.
Sriraman Tallam [Tue, 2 Jun 2020 06:17:29 +0000 (23:17 -0700)]
Options for Basic Block Sections, enabled in D68063 and D73674.

This patch adds clang options:
-fbasic-block-sections={all,<filename>,labels,none} and
-funique-basic-block-section-names.
LLVM Support for basic block sections is already enabled.

+ -fbasic-block-sections={all, <file>, labels, none} : Enables/Disables basic
block sections for all or a subset of basic blocks. "labels" only enables
basic block symbols.
+ -funique-basic-block-section-names: Enables unique section names for
basic block sections, disabled by default.

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

4 years ago[StatepointLowering] Handle UNDEF gc values.
Denis Antrushin [Thu, 28 May 2020 12:26:56 +0000 (15:26 +0300)]
[StatepointLowering] Handle UNDEF gc values.

Do not spill UNDEF GC values. Instead, replace corresponding
gc.relocate intrinsic with an (arbitrary, but recognizable) constant.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D80714

4 years ago[GlobalISel] Combine scalar unmerge(trunc)
Dominik Montada [Thu, 7 May 2020 10:27:57 +0000 (12:27 +0200)]
[GlobalISel] Combine scalar unmerge(trunc)

Summary:
Combine unmerge(trunc) to enable other merge combines.
Without this combine, the scalar unmerge(trunc(merge))
pattern cannot be combined and easily lead to
hard-to-legalize merge/unmerge artifacts.

Reviewed By: arsenm

Tags: #llvm

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

4 years ago[NFC] Move vector unmerge(trunc) combine to function
Dominik Montada [Tue, 2 Jun 2020 06:49:37 +0000 (08:49 +0200)]
[NFC] Move vector unmerge(trunc) combine to function

In preparation of D79567, move arsenm's vector unmerge(trunc)
combine to a new function `tryFoldUnmergeCast`

4 years ago[ObjectYAML][DWARF] Let `dumpPubSection` return `DWARFYAML::PubSection`.
Xing GUO [Tue, 2 Jun 2020 06:38:15 +0000 (14:38 +0800)]
[ObjectYAML][DWARF] Let `dumpPubSection` return `DWARFYAML::PubSection`.

Summary: This patch addresses comments in [D80722](https://reviews.llvm.org/D80722#inline-742353)

Reviewers: grimar, jhenderson

Reviewed By: grimar, jhenderson

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[mlir][SCFToGPU] Remove conversions from scf.for to gpu.launch.
MaheshRavishankar [Tue, 2 Jun 2020 05:42:33 +0000 (22:42 -0700)]
[mlir][SCFToGPU] Remove conversions from scf.for to gpu.launch.

Keeping in the affine.for to gpu.launch conversions, which should
probably be the affine.parallel to gpu.launch conversion as well.

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

4 years ago[ELF] --wrap: don't error `undefined reference to __real_foo` (--no-allow-shlib-undef...
Fangrui Song [Tue, 2 Jun 2020 05:57:43 +0000 (22:57 -0700)]
[ELF] --wrap: don't error `undefined reference to __real_foo` (--no-allow-shlib-undefined) if foo is a wrapped definition

This is a regression after D51283.

Also, export `foo` if `__real_foo` is referenced by a shared object.

4 years ago[BrachProbablityInfo] Proportional distribution of reachable probabilities
Yevgeny Rouban [Tue, 2 Jun 2020 04:28:12 +0000 (11:28 +0700)]
[BrachProbablityInfo] Proportional distribution of reachable probabilities

When fixing probability of unreachable edges in
BranchProbabilityInfo::calcMetadataWeights() proportionally distribute
remainder probability over the reachable edges. The old implementation
distributes the remainder probability evenly.
See examples in the fixed tests.

Reviewers: yamauchi, ebrevnov
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80611

4 years agoFix violations of [basic.class.scope]p2.
Richard Smith [Tue, 2 Jun 2020 04:10:27 +0000 (21:10 -0700)]
Fix violations of [basic.class.scope]p2.

These cases all follow the same pattern:

struct A {
  friend class X;
  //...
  class X {};
};

But 'friend class X;' injects 'X' into the surrounding namespace scope,
rather than introducing a class member. So the second 'class X {}' is a
completely different type, which changes the meaning of the earlier name
'X' from '::X' to 'A::X'.

Additionally, the friend declaration is pointless -- members of a class
don't need to be befriended to be able to access private members.

4 years ago[X86] Fix a few recursivelyDeleteUnusedNodes calls that were trying to delete nodes...
Craig Topper [Tue, 2 Jun 2020 04:53:19 +0000 (21:53 -0700)]
[X86] Fix a few recursivelyDeleteUnusedNodes calls that were trying to delete nodes before their user was really gone.

We looked through a truncate to get to the load. So we should be
deleting the truncate first.

There is a check that the node is really unused before deleting
so this didn't cause a functional issue.

4 years ago[BrachProbablityInfo] Rename loop variables. NFC
Yevgeny Rouban [Tue, 2 Jun 2020 03:55:27 +0000 (10:55 +0700)]
[BrachProbablityInfo] Rename loop variables. NFC

4 years ago[asan] fix a comment typo
Kostya Serebryany [Tue, 2 Jun 2020 00:40:23 +0000 (17:40 -0700)]
[asan] fix a comment typo

4 years agoadd debug code to chase down a rare crash in asan/lsan https://github.com/google...
Kostya Serebryany [Tue, 2 Jun 2020 00:33:49 +0000 (17:33 -0700)]
add debug code to chase down a rare crash in asan/lsan https://github.com/google/sanitizers/issues/1193

Summary: add debug code to chase down a rare crash in asan/lsan https://github.com/google/sanitizers/issues/1193

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoFix how cc1 command line options are mapped into FP options.
John McCall [Tue, 2 Jun 2020 01:02:02 +0000 (21:02 -0400)]
Fix how cc1 command line options are mapped into FP options.

Canonicalize on storing FP options in LangOptions instead of
redundantly in CodeGenOptions.  Incorporate -ffast-math directly
into the values of those LangOptions rather than considering it
separately when building FPOptions.  Build IR attributes from
those options rather than a mix of sources.

We should really simplify the driver/cc1 interaction here and have
the driver pass down options that cc1 directly honors.  That can
happen in a follow-up, though.

Patch by Michele Scandale!
https://reviews.llvm.org/D80315

4 years ago[COFF] Free some memory used for chunks
Reid Kleckner [Tue, 2 Jun 2020 01:46:51 +0000 (18:46 -0700)]
[COFF] Free some memory used for chunks

First, do not reserve numSections in the Chunks array. In cases where
there are many non-prevailing sections, this will overallocate memory
which will not be used.

Second, free the memory for sparseChunks after initializeSymbols. After
that, it is never used.

This saves 50MB of 627MB for my use case without affecting performance.

4 years agoFix UB in EmulateInstructionARM64.cpp
Adrian Prantl [Mon, 1 Jun 2020 21:23:04 +0000 (14:23 -0700)]
Fix UB in EmulateInstructionARM64.cpp

This fixes an unhandled signed integer overflow in AddWithCarry() by
using the llvm::checkedAdd() function. Thats to Vedant Kumar for the
suggestion!

<rdar://problem/60926115>

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

4 years ago[os_log][test] Remove -O1 from a test, NFC
Vedant Kumar [Mon, 1 Jun 2020 23:54:16 +0000 (16:54 -0700)]
[os_log][test] Remove -O1 from a test, NFC

4 years ago[docs] Sketch outline for HowToUpdateDebugInfo.rst
Vedant Kumar [Sat, 16 May 2020 00:13:18 +0000 (17:13 -0700)]
[docs] Sketch outline for HowToUpdateDebugInfo.rst

Summary:
Sketch the outline for a new document that explains how to update debug
info in various kinds of code transformations.

Some of the guidelines that belong in HowToUpdateDebugInfo.rst were in
SourceLevelDebugging.rst already under the debugify section. It seems
like the distinction between the two docs ought to be that the former is
more prescriptive, while the latter is more descriptive.

To that end I've consolidated the "how to update debug info" guidelines
which were in SourceLevelDebugging.rst into the new doc, along with the
information about using "debugify" to test transformations. Since we've
added a mir-debugify pass, I've described that as well.

Reviewers: aprantl, jmorse, chrisjackson, dsanders

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[AArch64][GlobalISel] Split G_GLOBAL_VALUE into ADRP + G_ADD_LOW and optimize.
Amara Emerson [Fri, 29 May 2020 19:35:36 +0000 (12:35 -0700)]
[AArch64][GlobalISel] Split G_GLOBAL_VALUE into ADRP + G_ADD_LOW and optimize.

The concept of G_GLOBAL_VALUE is nice and simple, but always using it as the
representation for global var addressing until selection time creates some
problems in optimizing accesses in certain code/relocation models.

The problem comes from trying to optimize adrp -> add -> load/store sequences
in the most common "small" code model. These accesses can be optimized into an
adrp -> load with the add offset being folded into the load's immediate field.
If we try to keep all global var references as a single generic instruction
then by the time we get to the complex operand trying to match these, we end up
generating an adrp at the point of use. The real issue here is that we don't
have any form of CSE during selection, so the code size will bloat from many
redundant adrp's.

This patch custom legalizes small code mode non-GOT G_GLOBALs into target ADRP
and a new "target specific generic opcode" G_ADD_LOW. We also teach the
localizer to localize these instructions via the custom hook that was added
recently. Finally, the complex pattern for indexed loads/stores is extended to
try to fold these G_ADD_LOW instructions into the load immediate.

On -O0 CTMark, we see a 0.8% geomean code size improvement. We should also see
some minor performance improvements too.

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

4 years ago[AArch64] Fix CollectLOH creating an AdrpAdd LOH when there's a live used reg
Amara Emerson [Fri, 29 May 2020 19:30:20 +0000 (12:30 -0700)]
[AArch64] Fix CollectLOH creating an AdrpAdd LOH when there's a live used reg
between the two instructions.

If there's a pattern like:
$xA = ADRP foo @PAGE
[some killing use of reg Xb]
$Xb = ADDXri $Xa, 0, @PAGEOFF

CollectLOH would create an AdrpAdd LOH that resulted in the linker optimizing
this sequence into:
$xB = ADR foo
[some killing use of reg $Xb]
... and therefore clobbers the live $Xb register that was used by the
instruction in between.

This was discovered by a GlobalISel patch D78465 which broke up global variable
accesses into two pseudos, which in some cases could be moved apart.

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

4 years ago[LiveDebugValues] Remove early-exit when testing regmasks, NFC
Vedant Kumar [Sat, 30 May 2020 05:47:08 +0000 (22:47 -0700)]
[LiveDebugValues] Remove early-exit when testing regmasks, NFC

In transferRegisterDef, if the instruction has a regmask attached, we'll
check if any currently used register is clobbered by the regmask.

The early exit in this scan isn't necessary, costs a set lookup, and is
almost never taken [1]. Delete it.

[1]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp.html#L1136

4 years agoAMDGPU: Change internal tracking of wave size
Matt Arsenault [Mon, 1 Jun 2020 17:16:58 +0000 (13:16 -0400)]
AMDGPU: Change internal tracking of wave size

Store the log2 wave size instead of forcing division and log2
operations when querying either.

4 years agoUpdated synopsis of <atomic> to match what is implemented
Olivier Giroux [Mon, 1 Jun 2020 21:30:13 +0000 (14:30 -0700)]
Updated synopsis of <atomic> to match what is implemented

4 years agoClean up clang/test/CodeGenObjC/os_log.m
Akira Hatanaka [Sat, 30 May 2020 01:08:09 +0000 (18:08 -0700)]
Clean up clang/test/CodeGenObjC/os_log.m

Don't run optimization passes at -O2 and remove unneeded #ifdef and test
cases.

4 years ago[analyzer][MallocChecker] Fix the incorrect retrieval of the from argument in realloc()
Kirstóf Umann [Mon, 1 Jun 2020 20:03:05 +0000 (22:03 +0200)]
[analyzer][MallocChecker] Fix the incorrect retrieval of the from argument in realloc()

In the added testfile, the from argument was recognized as
&Element{SymRegion{reg_$0<long * global_a>},-1 S64b,long}
instead of
reg_$0<long * global_a>.

4 years ago[libc++] Add assertions on OOB accesses in std::array when the debug mode is enabled
Louis Dionne [Mon, 1 Jun 2020 20:35:42 +0000 (16:35 -0400)]
[libc++] Add assertions on OOB accesses in std::array when the debug mode is enabled

Like we do for empty std::array, make sure we have assertions in place
for obvious out-of-bounds issues in std::array when the debug mode is
enabled (which isn't by default).

4 years ago[PowerPC] Add clang option -m[no-]pcrel
Lei Huang [Thu, 28 May 2020 20:30:47 +0000 (15:30 -0500)]
[PowerPC] Add clang option -m[no-]pcrel

Summary:
Add user-facing front end option to turn off pc-relative memops.
This will be compatible with gcc.

Reviewers: stefanp, nemanjai, hfinkel, power-llvm-team, #powerpc, NeHuang, saghir

Reviewed By: stefanp, NeHuang, saghir

Subscribers: saghir, wuzish, shchenz, cfe-commits, kbarton, echristo

Tags: #clang, #powerpc

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

4 years ago[libc++] NFC: Minor refactoring in std::array
Louis Dionne [Mon, 1 Jun 2020 20:28:44 +0000 (16:28 -0400)]
[libc++] NFC: Minor refactoring in std::array

4 years ago[OpenMP] Replace Clang's OpenMP RTL Definitions with OMPKinds.def
Joseph Huber [Mon, 1 Jun 2020 20:23:10 +0000 (16:23 -0400)]
[OpenMP] Replace Clang's OpenMP RTL Definitions with OMPKinds.def

Summary: This changes Clang's generation of OpenMP runtime functions to use the types and functions defined in OpenMPKinds and OpenMPConstants. New OpenMP runtime function information should now be added to OMPKinds.def. This patch also changed the definitions of __kmpc_push_num_teams and __kmpc_copyprivate to match those found in the runtime.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: jfb, AndreyChurbanov, openmp-commits, fghanim, hiraditya, sstefan1, cfe-commits, llvm-commits

Tags: #openmp, #clang, #llvm

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

4 years ago[PDB] Share code to relocate .debug$[SF] sections, NFC
Reid Kleckner [Mon, 1 Jun 2020 20:12:06 +0000 (13:12 -0700)]
[PDB] Share code to relocate .debug$[SF] sections, NFC

Sink relocateDebugChunk near the only call site.

4 years agoFor --relativenames, ignore directory 0, which is the comp_dir.
Sterling Augustine [Mon, 18 May 2020 22:54:55 +0000 (15:54 -0700)]
For --relativenames, ignore directory 0, which is the comp_dir.

Update for upstream comments. Improve test by writing all the debug
info by hand.

Reviewers: dblaikie, jhenderson

Subscribers: hiraditya, MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Test] Add test for man page and lldb --help output
Jonas Devlieghere [Mon, 1 Jun 2020 20:04:32 +0000 (13:04 -0700)]
[lldb/Test] Add test for man page and lldb --help output

4 years ago[llvm][NFC] Cache FAM in InlineAdvisor
Mircea Trofin [Thu, 21 May 2020 15:40:49 +0000 (08:40 -0700)]
[llvm][NFC] Cache FAM in InlineAdvisor

Summary:
This simplifies the interface by storing the function analysis manager
with the InlineAdvisor, and, thus, not requiring it be passed each time
we inquire for an advice.

Reviewers: davidxl, asbirlea

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAdd DIAError.h to list of headers excluded from the LLVM_DebugInfo_PDB module
Daniel Grumberg [Fri, 29 May 2020 15:34:07 +0000 (16:34 +0100)]
Add DIAError.h to list of headers excluded from the LLVM_DebugInfo_PDB module

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

4 years ago[libc] Expose APIGenerator.
Paula Toth [Mon, 1 Jun 2020 19:27:25 +0000 (12:27 -0700)]
[libc] Expose APIGenerator.

Summary: This is split off from D79192 and exposes APIGenerator (renames to APIIndexer) for use in generating the integrations tests.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years ago[PDB] Use inlinee file checksum offsets directly
Reid Kleckner [Mon, 1 Jun 2020 18:34:09 +0000 (11:34 -0700)]
[PDB] Use inlinee file checksum offsets directly

The inlinees section contains references to the file checksum table. The
file checksum table in the PDB must have the same layout as the file
checksum table in the object file, so all the existing file id
references should stay valid.

Previously, we would do this:
  for all inlined functions:
    - lookup filename from checksum and string table
    - make that filename absolute
    - look up the new file id for that filename up in the new checksum
      table

This lead to pdbMakeAbsolute and remove_dots ending up in the hot path.
We should only need to absolutify the source path once, not once every
time we process an inline function from that source file.

This speeds up linking chrome PGO stage 1 net_unittests.exe from 9.203s
to 8.500s (-7.6%). Looking just at time to process symbol records, it
goes from ~2000ms to ~1300ms, which is consistent with the overall
speedup of about 700ms. This will be less noticeable in debug builds,
which have fewer inlined functions records.

4 years ago[Matrix] Implement matrix index expressions ([][]).
Florian Hahn [Mon, 1 Jun 2020 18:42:03 +0000 (19:42 +0100)]
[Matrix] Implement matrix index expressions ([][]).

This patch implements matrix index expressions
(matrix[RowIdx][ColumnIdx]).

It does so by introducing a new MatrixSubscriptExpr(Base, RowIdx, ColumnIdx).
MatrixSubscriptExprs are built in 2 steps in ActOnMatrixSubscriptExpr. First,
if the base of a subscript is of matrix type, we create a incomplete
MatrixSubscriptExpr(base, idx, nullptr). Second, if the base is an incomplete
MatrixSubscriptExpr, we create a complete
MatrixSubscriptExpr(base->getBase(), base->getRowIdx(), idx)

Similar to vector elements, it is not possible to take the address of
a MatrixSubscriptExpr.
For CodeGen, a new MatrixElt type is added to LValue, which is very
similar to VectorElt. The only difference is that we may need to cast
the type of the base from an array to a vector type when accessing it.

Reviewers: rjmccall, anemet, Bigcheese, rsmith, martong

Reviewed By: rjmccall

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

4 years agoMove internal_uname to #if SANITIZER_LINUX scope.
Martin Liska [Sat, 30 May 2020 08:13:07 +0000 (10:13 +0200)]
Move internal_uname to #if SANITIZER_LINUX scope.

Remove it from target-specific scope which corresponds
to sanitizer_linux.cpp where it lives in the same macro
scope.

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

4 years ago[ELF] Refine --export-dynamic-symbol semantics to be compatible GNU ld 2.35
Fangrui Song [Mon, 1 Jun 2020 18:27:53 +0000 (11:27 -0700)]
[ELF] Refine --export-dynamic-symbol semantics to be compatible GNU ld 2.35

GNU ld from binutils 2.35 onwards will likely support
--export-dynamic-symbol but with different semantics.
https://sourceware.org/pipermail/binutils/2020-May/111302.html

Differences:

1. -export-dynamic-symbol is not supported
2. --export-dynamic-symbol takes a glob argument
3. --export-dynamic-symbol can suppress binding the references to the definition within the shared object if (-Bsymbolic or -Bsymbolic-functions)
4. --export-dynamic-symbol does not imply -u

I don't think the first three points can affect any user.
For the fourth point, Not implying -u can lead to some archive members unfetched.
Add -u foo to restore the previous behavior.

Exact semantics:

* -no-pie or -pie: matched non-local defined symbols will be added to the dynamic symbol table.
* -shared: matched non-local STV_DEFAULT symbols will not be bound to definitions within the shared object
  even if they would otherwise be due to -Bsymbolic, -Bsymbolic-functions, or --dynamic-list.

Reviewed By: psmith

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

4 years ago[InstCombine] fix use of base VectorType; NFC
Sanjay Patel [Mon, 1 Jun 2020 18:06:46 +0000 (14:06 -0400)]
[InstCombine] fix use of base VectorType; NFC

SimplifyDemandedVectorElts() bails out on ScalableVectorType
anyway, but we can exit faster with the external check.

Move this to a helper function because there are likely other
vector folds that we can try here.

4 years agoAMDGPU: Fix not emitting nofpexcept on fdiv expansion
Matt Arsenault [Thu, 28 May 2020 01:41:52 +0000 (21:41 -0400)]
AMDGPU: Fix not emitting nofpexcept on fdiv expansion

In this awkward case, we have to emit custom pseudo-constrained FP
wrappers. InstrEmitter concludes that since a mayRaiseFPException
instruction had a chain, it can't add nofpexcept.

Test deferred until mayRaiseFPException is really set on everything.

4 years ago[LiveDebugValues] Add LocIndex::u32_{location,index}_t types for readability, NFC
Vedant Kumar [Mon, 1 Jun 2020 18:01:49 +0000 (11:01 -0700)]
[LiveDebugValues] Add LocIndex::u32_{location,index}_t types for readability, NFC

This is per Adrian's suggestion in https://reviews.llvm.org/D80684.

4 years ago[LiveDebugValues] Speed up removeEntryValue, NFC
Vedant Kumar [Thu, 28 May 2020 01:19:54 +0000 (18:19 -0700)]
[LiveDebugValues] Speed up removeEntryValue, NFC

Summary:
Instead of iterating over all VarLoc IDs in removeEntryValue(), just
iterate over the interval reserved for entry value VarLocs. This changes
the iteration order, hence the test update -- otherwise this is NFC.

This appears to give an ~8.5x wall time speed-up for LiveDebugValues when
compiling sqlite3.c 3.30.1 with a Release clang (on my machine):

```
          ---User Time---   --System Time--   --User+System--   ---Wall Time--- --- Name ---
  Before: 2.5402 ( 18.8%)   0.0050 (  0.4%)   2.5452 ( 17.3%)   2.5452 ( 17.3%) Live DEBUG_VALUE analysis
   After: 0.2364 (  2.1%)   0.0034 (  0.3%)   0.2399 (  2.0%)   0.2398 (  2.0%) Live DEBUG_VALUE analysis
```

The change in removeEntryValue() is the only one that appears to affect
wall time, but for consistency (and to resolve a pending TODO), I made
the analogous changes for iterating over SpillLocKind VarLocs.

Reviewers: nikic, aprantl, jmorse, djtodoro

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoDAG: Fix getNode dropping flags if there's a glue output
Matt Arsenault [Thu, 28 May 2020 01:39:17 +0000 (21:39 -0400)]
DAG: Fix getNode dropping flags if there's a glue output

The AMDGPU non-strict fdiv lowering needs to introduce an FP mode
switch in some cases, and has custom nodes to provide chain/glue for
the intermediate FP operations. We need to propagate nofpexcept here,
but getNode was dropping the flags.

Adding nofpexcept in the AMDGPU custom lowering is left to a future
patch.

Also fix a second case where flags were dropped, but in this case it
seems it just didn't handle this number of operands.

Test will be included in future AMDGPU patch.

4 years ago[Darwin] Add and adopt a way to query the Darwin kernel version
Julian Lettner [Thu, 14 May 2020 20:43:33 +0000 (13:43 -0700)]
[Darwin] Add and adopt a way to query the Darwin kernel version

This applies the learnings from [1].  What I intended as a simple
cleanup made me realize that the compiler-rt version checks have two
separate issues:

1) In some places (e.g., mmap flag setting) what matters is the kernel
   version, not the OS version.
2) OS version checks are implemented by querying the kernel version.
   This is not necessarily correct inside the simulators if the
   simulator runtime isn't aligned with the host macOS.

This commit tackles 1) by adopting a separate query function for the
Darwin kernel version.  2) (and cleanups) will be dealt with in
follow-ups.

[1] https://reviews.llvm.org/D78942

rdar://63031937

Reviewed By: delcypher

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

4 years ago[PGO] Improve the working set size heuristics under the partial sample PGO.
Hiroshi Yamauchi [Wed, 8 Apr 2020 23:06:25 +0000 (16:06 -0700)]
[PGO] Improve the working set size heuristics under the partial sample PGO.

Summary:
The working set size heuristics (ProfileSummaryInfo::hasHugeWorkingSetSize)
under the partial sample PGO may not be accurate because the profile is partial
and the number of hot profile counters in the ProfileSummary may not reflect the
actual working set size of the program being compiled.

To improve this, the (approximated) ratio of the the number of profile counters
of the program being compiled to the number of profile counters in the partial
sample profile is computed (which is called the partial profile ratio) and the
working set size of the profile is scaled by this ratio to reflect the working
set size of the program being compiled and used for the working set size
heuristics.

The partial profile ratio is approximated based on the number of the basic
blocks in the program and the NumCounts field in the ProfileSummary and computed
through the thin LTO indexing. This means that there is the limitation that the
scaled working set size is available to the thin LTO post link passes only.

Reviewers: davidxl

Subscribers: mgorny, eraman, hiraditya, steven_wu, dexonsmith, arphaman, dang, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU: Fix test in code directory
Matt Arsenault [Mon, 1 Jun 2020 17:15:06 +0000 (13:15 -0400)]
AMDGPU: Fix test in code directory

4 years agoAMDGPU: Remove dead file
Matt Arsenault [Mon, 1 Jun 2020 17:14:18 +0000 (13:14 -0400)]
AMDGPU: Remove dead file

4 years ago[AMDGPU/MemOpsCluster] Let mem ops clustering logic also consider number of clustered...
hsmahesha [Mon, 1 Jun 2020 17:20:29 +0000 (22:50 +0530)]
[AMDGPU/MemOpsCluster] Let mem ops clustering logic also consider number of clustered bytes

Summary:
While clustering mem ops, AMDGPU target needs to consider number of clustered bytes
to decide on max number of mem ops that can be clustered. This patch adds support to pass
number of clustered bytes to target mem ops clustering logic.

Reviewers: foad, rampitec, arsenm, vpykhtin, javedabsar

Reviewed By: foad

Subscribers: MatzeB, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, javed.absar, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[ELF] Set DF_1_PIE for -pie
Fangrui Song [Mon, 1 Jun 2020 17:17:48 +0000 (10:17 -0700)]
[ELF] Set DF_1_PIE for -pie

DF_1_PIE originated from Solaris (https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html ).
GNU ld since
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
sets the flag on non-Solaris platforms.

It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE (https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951 )

glibc uses this flag to reject dlopen'ing a PIE (https://sourceware.org/bugzilla/show_bug.cgi?id=24323 )

Reviewed By: psmith

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

4 years agoTemporarily removed unstable test. NFC.
Stanislav Mekhanoshin [Mon, 1 Jun 2020 17:18:04 +0000 (10:18 -0700)]
Temporarily removed unstable test. NFC.

4 years agoAMDGPU: Fix alignment for dynamic allocas
Matt Arsenault [Sat, 30 May 2020 15:53:54 +0000 (11:53 -0400)]
AMDGPU: Fix alignment for dynamic allocas

The alignment value also needs to be scaled by the wave size.

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Clang
Christopher Tetreault [Mon, 1 Jun 2020 16:55:24 +0000 (09:55 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Clang

Reviewers: efriedma, david-arm, fpetrogalli, ddunbar, rjmccall

Reviewed By: fpetrogalli, rjmccall

Subscribers: tschuett, rkruppe, psnobl, dmgreen, cfe-commits

Tags: #clang

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

4 years ago[Clang][CGM] style cleanups NFC
Nick Desaulniers [Mon, 1 Jun 2020 16:21:51 +0000 (09:21 -0700)]
[Clang][CGM] style cleanups NFC

Summary:
Forked from:
https://reviews.llvm.org/D80242

Use the getter for access to DebugInfo consistently.
Use break in switch in CodeGenModule::EmitTopLevelDecl consistently.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits, srhines

Tags: #clang

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

4 years ago[flang] This adds the lowering stubs for Open MP.
Eric Schweitz [Wed, 27 May 2020 21:18:40 +0000 (14:18 -0700)]
[flang] This adds the lowering stubs for Open MP.

The lowering bridge will call these lowering hooks to process the Open
MP directives that it iterates over in the PFT.  This is a mock
interface without an implementation in this patch.

Reviewed By: kiranchandramohan

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

4 years agoUpdate some names in test. NFC.
Stanislav Mekhanoshin [Mon, 1 Jun 2020 16:07:17 +0000 (09:07 -0700)]
Update some names in test. NFC.

There seems to be some instability with IR nameing between
platforms. Attempted to fix it with replacing dot-numbered
names.

4 years ago[Object] Add DF_1_PIE
Fangrui Song [Mon, 1 Jun 2020 15:50:21 +0000 (08:50 -0700)]
[Object] Add DF_1_PIE

This flag (and the whole field DT_FLAGS_1) originated from Solaris. I intend to use it in an LLD patch D80872.

Reviewed By: jhenderson

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

4 years ago[InstCombine] add test for select-of-shuffle; NFC
Sanjay Patel [Mon, 1 Jun 2020 15:50:43 +0000 (11:50 -0400)]
[InstCombine] add test for select-of-shuffle; NFC

This is based on an example in D80658

4 years agoProcess gep (phi ptr1, ptr2) in SROA
Stanislav Mekhanoshin [Fri, 29 May 2020 21:00:51 +0000 (14:00 -0700)]
Process gep (phi ptr1, ptr2) in SROA

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

4 years ago[libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.
Siva Chandra Reddy [Mon, 18 May 2020 22:06:01 +0000 (15:06 -0700)]
[libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.

Reviewers: abrachet

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

4 years ago[WebAssembly] Update test expectations
Sam Clegg [Mon, 1 Jun 2020 15:12:53 +0000 (08:12 -0700)]
[WebAssembly] Update test expectations

simd-2.C now compiles thanks to:
  https://github.com/WebAssembly/wasi-libc/pull/183

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

4 years ago[InstNamer] use 'i' for Instructions, not 'tmp'
Sanjay Patel [Mon, 1 Jun 2020 14:56:27 +0000 (10:56 -0400)]
[InstNamer] use 'i' for Instructions, not 'tmp'

As discussed in https://bugs.llvm.org/show_bug.cgi?id=45951 and
D80584, the name 'tmp' is almost always a bad choice, but we have
a legacy of regression tests with that name because it was baked
into utils/update_test_checks.py.

This change makes -instnamer more consistent (already using "arg"
and "bb", the common LLVM shorthand). And it avoids the conflict
in telling users of the FileCheck script to run "-instnamer" to
create a better regression test and having that cause a warn/fail
in update_test_checks.py.

4 years ago[openmp] Fixed taskloop recursive splitting so that taskloop tasks have
AndreyChurbanov [Mon, 1 Jun 2020 14:51:02 +0000 (17:51 +0300)]
[openmp] Fixed taskloop recursive splitting so that taskloop tasks have
same parent tasks.

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

4 years agoSupport GCC [[gnu::attributes]] in C2x mode
Aaron Ballman [Mon, 1 Jun 2020 14:39:38 +0000 (10:39 -0400)]
Support GCC [[gnu::attributes]] in C2x mode

GCC 10.1 introduced support for the [[]] style spelling of attributes in C
mode. Similar to how GCC supports __attribute__((foo)) as [[gnu::foo]] in
C++ mode, it now supports the same spelling in C mode as well. This patch
makes a change in Clang so that when you use the GCC attribute spelling,
the attribute is automatically available in all three spellings by default.
However, like Clang, GCC has some attributes it only recognizes in C++ mode
(specifically, abi_tag and init_priority), which this patch also honors.

4 years ago[StructurizeCFG] Fix an incorrect comment, NFC.
Ehud Katz [Mon, 1 Jun 2020 14:42:09 +0000 (17:42 +0300)]
[StructurizeCFG] Fix an incorrect comment, NFC.

4 years ago[CodeGen] remove instnamer dependency from test file; NFC
Sanjay Patel [Mon, 1 Jun 2020 14:14:47 +0000 (10:14 -0400)]
[CodeGen] remove instnamer dependency from test file; NFC

This file was originally added without instnamer at:
rL283716 / fe2b9b4fbf860e3dc7da7705f548bc8d7b6ab9c1

But that was reverted and the test file reappeared with instnamer at:
rL285688 / 62f516f5906f967179610a73e4cc1d852b908bbd

I'm not seeing any difference locally from checking nameless values,
so trying to remove a layering violation and see if that can
survive the build bots.

4 years ago[Support] Add more context to DataExtractor getLEB128 errors
James Henderson [Fri, 22 May 2020 12:53:47 +0000 (13:53 +0100)]
[Support] Add more context to DataExtractor getLEB128 errors

Reviewed by: clayborg, dblaikie, labath

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

4 years agoRevert "[lldb] Pass -fPIC flag even when DYLIB_ONLY is set"
Raphael Isemann [Mon, 1 Jun 2020 12:41:08 +0000 (14:41 +0200)]
Revert "[lldb] Pass -fPIC flag even when DYLIB_ONLY is set"

This reverts commit fd0ab3b3eb88de3fe4792c34b50084595e22d68d.

The fix here is incorrect and the actual fault was an incorrect test Makefile.

To give some more background:

The original test for D80798 compiled three source files into either one
executable or one executable + 2 shared libraries, each being one different
test setup. If both the monolithic executable and the shared libraries
where compiled in the same directory, then Make would overwrite the .o files
of one test setup with the other. This caused that while -fPIC was passed
correctly to the test setup with the shared libraries, the compiler invocations
for the monolithic executable would later overwrite these object files (and
as only the test setup with the shared library used -fPIC, it appeared as if
the shared library object files didn't receive the -fPIC flag).

Thanks to Pavel for figuring this out.

4 years ago[DebugInfo] Add use of truncating data extractor to debug line parsing
James Henderson [Wed, 20 May 2020 14:53:44 +0000 (15:53 +0100)]
[DebugInfo] Add use of truncating data extractor to debug line parsing

This will ensure that nothing can ever start parsing data from a future
sequence and part-read data will be returned as 0 instead.

Reviewed by: aprantl, labath

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

4 years ago[lldb][NFC] Make ClangExpressionSourceCode's wrapping logic more consistent
Raphael Isemann [Mon, 1 Jun 2020 08:28:22 +0000 (10:28 +0200)]
[lldb][NFC] Make ClangExpressionSourceCode's wrapping logic more consistent

Summary:
ClangExpressionSourceCode has different ways to wrap the user expression based on
which context the expression is executed in. For example, if we're in a C++ member
function we put the expression inside a fake member function of a fake class to make the
evaluation possible. Similar things are done for Objective-C instance/static methods.
There is also a default wrapping where we put the expression in a normal function
just to make it possible to execute it.

The way we currently define which kind of wrapping the expression needs is based on
the `wrapping_language` we keep passing to the ClangExpressionSourceCode
instance. We repurposed the language type enum for that variable to distinguish the
cases above with the following mapping:
* language = C_plus_plus -> member function wrapping
* language = ObjC -> instance/static method wrapping (`is_static` distinguished between those two).
* language = C -> normal function wrapping
* all other cases like C_plus_plus11, Haskell etc. make our class a no-op that does mostly nothing.

That mapping is currently not documented and just confusing as the `language`
is unrelated to the expression language (and in the ClangUserExpression we even pretend
that it *is* the actual language, but luckily never used it for anything). Some of the code
in ClangExpressionSourceCode is also obviously thinking that this is the actual language of
the expression as it checks for non-existent cases such as `ObjC_plus_plus` which is
not part of the mapping.

This patch makes a new enum to describe the four cases above (with instance/static Objective-C
methods now being their own case). It also make that enum just a member of
ClangExpressionSourceCode instead of having to pass the same value to the class repeatedly.
This gets also rid of all the switch-case-checks for 'unknown' language such as C_plus_plus11 as this
is no longer necessary.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: abidh

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

4 years ago[utils] change default nameless value to "TMP"
Sanjay Patel [Mon, 1 Jun 2020 10:49:07 +0000 (06:49 -0400)]
[utils] change default nameless value to "TMP"

This is effectively reverting rGbfdc2552664d to avoid test churn
while we figure out a better way forward.

We at least salvage the warning on name conflict from that patch
though.

If we change the default string again, we may want to mass update
tests at the same time. Alternatively, we could live with the poor
naming if we change -instnamer.

This also adds a test to LLVM as suggested in the post-commit
review. There's a clang test that is also affected. That seems
like a layering violation, but I have not looked at fixing that yet.

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

4 years ago[llvm-dwarfdump][test] Use verbose output to check expected opcodes
James Henderson [Wed, 20 May 2020 14:29:55 +0000 (15:29 +0100)]
[llvm-dwarfdump][test] Use verbose output to check expected opcodes

The debug_line_invalid.test test case was previously using the
interpreted line table dumping to identify which opcodes have been
parsed. This change moves to looking for the expected opcodes
explicitly. This is probably a little clearer and also allows for
testing some cases that wouldn't be easily identifiable from the
interpreted table.

Reviewed by: MaskRay

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

4 years agoARMFrameLowering.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 1 Jun 2020 10:39:56 +0000 (11:39 +0100)]
ARMFrameLowering.h - remove unnecessary includes. NFC.

They are implicitly included in TargetFrameLowering.h and only ever used in TargetFrameLowering override methods.

4 years agoMIPatternMatch.h - remove unused APFloat/APInt includes. NFC.
Simon Pilgrim [Mon, 1 Jun 2020 10:36:27 +0000 (11:36 +0100)]
MIPatternMatch.h - remove unused APFloat/APInt includes. NFC.

4 years ago[DebugInfo] Separate fields with commas in headers of type units (3/3).
Igor Kudrin [Mon, 1 Jun 2020 08:57:23 +0000 (15:57 +0700)]
[DebugInfo] Separate fields with commas in headers of type units (3/3).

For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.

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

4 years ago[DebugInfo] Separate fields with commas in headers of compile units (2/3).
Igor Kudrin [Mon, 1 Jun 2020 08:56:28 +0000 (15:56 +0700)]
[DebugInfo] Separate fields with commas in headers of compile units (2/3).

For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.

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

4 years ago[DebugInfo] Separate fields with commas in headers of .debug_pub* tables (1/3).
Igor Kudrin [Mon, 1 Jun 2020 08:35:33 +0000 (15:35 +0700)]
[DebugInfo] Separate fields with commas in headers of .debug_pub* tables (1/3).

For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.

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

4 years ago[llvm-readelf] - Add explicit braces again. NFC.
Georgii Rymar [Mon, 1 Jun 2020 10:10:16 +0000 (13:10 +0300)]
[llvm-readelf] - Add explicit braces again. NFC.

Partially reverts feee98645dde4be31a70cc6660d2fc4d4b9d32d8.

Add explicit braces to a different place to fix
"error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]"

4 years ago[llvm-readelf] - Add explicit braces. NFC.
Georgii Rymar [Mon, 1 Jun 2020 09:53:50 +0000 (12:53 +0300)]
[llvm-readelf] - Add explicit braces. NFC.

Should fix the BB (http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/3907/steps/build%20stage%201/logs/stdio):

llvm-readobj/ELFDumper.cpp:4708:5: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]
    else
    ^

4 years ago[StructurizeCFG] Fix region nodes ordering
Ehud Katz [Mon, 1 Jun 2020 09:50:35 +0000 (12:50 +0300)]
[StructurizeCFG] Fix region nodes ordering

This is a reimplementation of the `orderNodes` function, as the old
implementation didn't take into account all cases.
The new implementation uses SCCs instead of Loops to take account of
irreducible loops.

Fix PR41509

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

4 years ago[llvm-readobj] - Improve error reporting for hash tables.
Georgii Rymar [Thu, 21 May 2020 10:57:41 +0000 (13:57 +0300)]
[llvm-readobj] - Improve error reporting for hash tables.

This improves the next points for broken hash tables:

1) Use reportUniqueWarning to prevent duplication when
   --hash-table and --elf-hash-histogram are used together.

2) Dump nbuckets and nchain fields. It is often possible
   to dump them even when the table itself goes past the EOF etc.

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

4 years agoAArch64: materialize large stack offset into xzr correctly.
Tim Northover [Wed, 22 Apr 2020 13:02:48 +0000 (14:02 +0100)]
AArch64: materialize large stack offset into xzr correctly.

When a stack offset was too big to materialize in a single instruction, we were
trying to do it in stages:

    adds xD, sp, #imm
    adds xD, xD, #imm

Unfortunately, if xD is xzr then the second instruction doesn't exist and
wouldn't do what was needed if it did. Instead we can use a temporary register
for all but the last addition.