platform/upstream/llvm.git
6 years ago[OPENMP][NVPTX]Reduce memory usage in orphaned functions.
Alexey Bataev [Fri, 12 Oct 2018 16:04:20 +0000 (16:04 +0000)]
[OPENMP][NVPTX]Reduce memory usage in orphaned functions.

if the function has globalized variables and called in context of
target/teams/distribute regions, it does not need to globalize 32
copies of the same variables for memory coalescing, it is enough to
have just one copy, because there is parallel region.
Patch does this by adding call for `__kmpc_parallel_level` function and
checking its return value. If the code sees that the parallel level is
0, then only one variable is allocated, not 32.

llvm-svn: 344356

6 years agoPull out repeated value types. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 15:49:19 +0000 (15:49 +0000)]
Pull out repeated value types. NFCI.

llvm-svn: 344355

6 years agoPull out repeated value types. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 15:48:47 +0000 (15:48 +0000)]
Pull out repeated value types. NFCI.

llvm-svn: 344354

6 years ago[AArch64][x86] add tests for trunc disguised as vector ops (PR39016); NFC
Sanjay Patel [Fri, 12 Oct 2018 15:22:14 +0000 (15:22 +0000)]
[AArch64][x86] add tests for trunc disguised as vector ops (PR39016); NFC

These correspond to the IR transform from:
D52439

llvm-svn: 344353

6 years agoFix MSVC 2015 ambiguous symbol warning introduced by rL344337. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 15:16:25 +0000 (15:16 +0000)]
Fix MSVC 2015 ambiguous symbol warning introduced by rL344337. NFCI.

llvm-svn: 344352

6 years ago[llvm-exegesis][NFC] Simplify code at the cost of small code duplication
Guillaume Chatelet [Fri, 12 Oct 2018 15:12:22 +0000 (15:12 +0000)]
[llvm-exegesis][NFC] Simplify code at the cost of small code duplication

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 344351

6 years agoFix unused variable warning after r344348
Eric Liu [Fri, 12 Oct 2018 15:01:11 +0000 (15:01 +0000)]
Fix unused variable warning after r344348

llvm-svn: 344350

6 years ago[SelectionDAG] Move VectorLegalizer::ExpandCTLZ codegen into SelectionDAGLegalize
Simon Pilgrim [Fri, 12 Oct 2018 14:45:57 +0000 (14:45 +0000)]
[SelectionDAG] Move VectorLegalizer::ExpandCTLZ codegen into SelectionDAGLegalize

Generalize SelectionDAGLegalize's CTLZ expansion to handle vectors - lets VectorLegalizer::ExpandCTLZ to just pass the expansion on instead of repeating the same codegen.

llvm-svn: 344349

6 years ago[X86][SSE] LowerVectorCTPOP - pull out repeated byte sum stage.
Simon Pilgrim [Fri, 12 Oct 2018 14:18:47 +0000 (14:18 +0000)]
[X86][SSE] LowerVectorCTPOP - pull out repeated byte sum stage.

Pull out repeated byte sum stage for popcount of vector elements > 8bits.

This allows us to simplify the LUT/BITMATH popcnt code to always assume vXi8 vectors, and also improves avx512bitalg codegen which only has access to vpopcntb/vpopcntw.

llvm-svn: 344348

6 years ago[PowerPC] avoid masking already-zero bits in BitPermutationSelector
Hiroshi Inoue [Fri, 12 Oct 2018 14:02:20 +0000 (14:02 +0000)]
[PowerPC] avoid masking already-zero bits in BitPermutationSelector

The current BitPermutationSelector generates a code to build a value by tracking two types of bits: ConstZero and Variable.
ConstZero means a bit we need to mask off and Variable is a bit we copy from an input value.

This patch add third type of bits VariableKnownToBeZero caused by AssertZext node or zero-extending load node.
VariableKnownToBeZero means a bit comes from an input value, but it is known to be already zero. So we do not need to mask them.
VariableKnownToBeZero enhances flexibility to group bits, since we can avoid redundant masking for these bits.

This patch also renames "HasZero" to "NeedMask" since now we may skip masking even when we have zeros (of type VariableKnownToBeZero).

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

llvm-svn: 344347

6 years ago[libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl,-dead_strip.
Max Moroz [Fri, 12 Oct 2018 13:59:56 +0000 (13:59 +0000)]
[libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl,-dead_strip.

Summary:
The corresponding asncov change: https://reviews.llvm.org/D53113.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=892167

Reviewers: morehouse, kcc, george.karpenkov

Reviewed By: morehouse, george.karpenkov

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 344346

6 years ago[SanitizerCoverage] Make Inline8bit and TracePC counters dead stripping resistant.
Max Moroz [Fri, 12 Oct 2018 13:59:31 +0000 (13:59 +0000)]
[SanitizerCoverage] Make Inline8bit and TracePC counters dead stripping resistant.

Summary:
Otherwise, at least on Mac, the linker eliminates unused symbols which
causes libFuzzer to error out due to a mismatch of the sizes of coverage tables.

Issue in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=892167

Reviewers: morehouse, kcc, george.karpenkov

Reviewed By: morehouse

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 344345

6 years ago[ELF] - Remove unused variable. NFC.
George Rimar [Fri, 12 Oct 2018 13:39:35 +0000 (13:39 +0000)]
[ELF] - Remove unused variable. NFC.

It triggered a bot failture somehow today:
http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/7993

llvm-svn: 344344

6 years ago[clang-tidy] Fix check_clang_tidy.py trivially passing default CHECK
Zinovy Nis [Fri, 12 Oct 2018 13:35:47 +0000 (13:35 +0000)]
[clang-tidy] Fix check_clang_tidy.py trivially passing default CHECK

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

llvm-svn: 344343

6 years ago[ELF] - Remove dead declaration. NFC.
George Rimar [Fri, 12 Oct 2018 13:25:25 +0000 (13:25 +0000)]
[ELF] - Remove dead declaration. NFC.

MipsGotSection::FileGot::isOverflow()
was a dead declararion.

llvm-svn: 344342

6 years ago[X86][AVX] Regenerate tzcnt tests
Simon Pilgrim [Fri, 12 Oct 2018 13:24:51 +0000 (13:24 +0000)]
[X86][AVX] Regenerate tzcnt tests

llvm-svn: 344341

6 years ago[clang-tidy] White List Option for performance-unnecessary-value-param, performance...
Adam Balogh [Fri, 12 Oct 2018 13:05:21 +0000 (13:05 +0000)]
[clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy

New option added to these three checks to be able to silence false positives on
types that are intentionally passed by value or copied. Such types are e.g.
intrusive reference counting pointer types like llvm::IntrusiveRefCntPtr. The
new option is named WhiteListTypes and can contain a semicolon-separated list of
names of these types. Regular expressions are allowed. Default is empty.

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

llvm-svn: 344340

6 years ago[llvm-mca] Remove method RegisterFileStatistics::initializeRegisterFileInfo(). NFC
Andrea Di Biagio [Fri, 12 Oct 2018 12:38:27 +0000 (12:38 +0000)]
[llvm-mca] Remove method RegisterFileStatistics::initializeRegisterFileInfo(). NFC

llvm-svn: 344339

6 years agoFix documentation of MachineInstr::getNumOperands
Sam Parker [Fri, 12 Oct 2018 12:26:37 +0000 (12:26 +0000)]
Fix documentation of MachineInstr::getNumOperands

The documentation stated "Access to explicit operands of the
instruction." This is misleading, as it also lists implicit operands.

Patch by Philip Ginsbach.

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

llvm-svn: 344338

6 years agoRemove top-level using declaration from header files, as these aliases leak.
Sam McCall [Fri, 12 Oct 2018 12:21:29 +0000 (12:21 +0000)]
Remove top-level using declaration from header files, as these aliases leak.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

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

llvm-svn: 344337

6 years ago[X86][SSE] Add extract_subvector(PSHUFB) -> PSHUFB(extract_subvector()) combine
Simon Pilgrim [Fri, 12 Oct 2018 12:10:34 +0000 (12:10 +0000)]
[X86][SSE] Add extract_subvector(PSHUFB) -> PSHUFB(extract_subvector()) combine

Fixes PR32160 by reducing the size of PSHUFB if we only use one of the lanes.

This approach can probably be generalized to handle any target shuffle (and any subvector index) but we have no test coverage at the moment.

llvm-svn: 344336

6 years ago[Tooling] Expose ExecutorName option.
Eric Liu [Fri, 12 Oct 2018 11:47:36 +0000 (11:47 +0000)]
[Tooling] Expose ExecutorName option.

llvm-svn: 344335

6 years ago[tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen.
Andrea Di Biagio [Fri, 12 Oct 2018 11:23:04 +0000 (11:23 +0000)]
[tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen.

This patch adds the ability to identify instructions that are "move elimination
candidates". It also allows scheduling models to describe processor register
files that allow move elimination.

A move elimination candidate is an instruction that can be eliminated at
register renaming stage.
Each subtarget can specify which instructions are move elimination candidates
with the help of tablegen class "IsOptimizableRegisterMove" (see
llvm/Target/TargetInstrPredicate.td).

For example, on X86, BtVer2 allows both GPR and MMX/SSE moves to be eliminated.
The definition of 'IsOptimizableRegisterMove' for BtVer2 looks like this:

```
def : IsOptimizableRegisterMove<[
  InstructionEquivalenceClass<[
    // GPR variants.
    MOV32rr, MOV64rr,

    // MMX variants.
    MMX_MOVQ64rr,

    // SSE variants.
    MOVAPSrr, MOVUPSrr,
    MOVAPDrr, MOVUPDrr,
    MOVDQArr, MOVDQUrr,

    // AVX variants.
    VMOVAPSrr, VMOVUPSrr,
    VMOVAPDrr, VMOVUPDrr,
    VMOVDQArr, VMOVDQUrr
  ], CheckNot<CheckSameRegOperand<0, 1>> >
]>;
```

Definitions of IsOptimizableRegisterMove from processor models of a same
Target are processed by the SubtargetEmitter to auto-generate a target-specific
override for each of the following predicate methods:

```
bool TargetSubtargetInfo::isOptimizableRegisterMove(const MachineInstr *MI)
const;
bool MCInstrAnalysis::isOptimizableRegisterMove(const MCInst &MI, unsigned
CPUID) const;
```

By default, those methods return false (i.e. conservatively assume that there
are no move elimination candidates).

Tablegen class RegisterFile has been extended with the following information:
 - The set of register classes that allow move elimination.
 - Maxium number of moves that can be eliminated every cycle.
 - Whether move elimination is restricted to moves from registers that are
   known to be zero.

This patch is structured in three part:

A first part (which is mostly boilerplate) adds the new
'isOptimizableRegisterMove' target hooks, and extends existing register file
descriptors in MC by introducing new fields to describe properties related to
move elimination.

A second part, uses the new tablegen constructs to describe move elimination in
the BtVer2 scheduling model.

A third part, teaches llm-mca how to query the new 'isOptimizableRegisterMove'
hook to mark instructions that are candidates for move elimination. It also
teaches class RegisterFile how to describe constraints on move elimination at
PRF granularity.

llvm-mca tests for btver2 show differences before/after this patch.

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

llvm-svn: 344334

6 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 10:34:03 +0000 (10:34 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 344333

6 years ago[X86][AVX] Add examples of shuffles that can be reduced to a cross-lane shuffle follo...
Simon Pilgrim [Fri, 12 Oct 2018 10:26:59 +0000 (10:26 +0000)]
[X86][AVX] Add examples of shuffles that can be reduced to a cross-lane shuffle followed by a in-lane permute

Suitable for lowering by D53148

llvm-svn: 344332

6 years ago[X86] Ignore float/double non-temporal loads (PR39256)
Simon Pilgrim [Fri, 12 Oct 2018 10:20:16 +0000 (10:20 +0000)]
[X86] Ignore float/double non-temporal loads (PR39256)

Scalar non-temporal loads were asserting instead of just being ignored.

Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10895

llvm-svn: 344331

6 years ago[clangd] Support hover on "aut^o *".
Haojian Wu [Fri, 12 Oct 2018 10:11:02 +0000 (10:11 +0000)]
[clangd] Support hover on "aut^o *".

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 344330

6 years ago[TSan] Cleanup TSan runtime support for Go on linux-aarch64. NFC.
Arnaud A. de Grandmaison [Fri, 12 Oct 2018 10:01:09 +0000 (10:01 +0000)]
[TSan] Cleanup TSan runtime support for Go on linux-aarch64. NFC.

This is a follow-up patch to r342541. After further investigations, only
48bits VMA size can be supported. As this is enforced in function
InitializePlatformEarly from lib/rt1/tsan_platform_linux.cc, the access
to the global variable vmaSize variable + switch can be removed. This
also addresses a comment from https://reviews.llvm.org/D52167.

vmaSize of 39 or 42bits are not compatible with a Go program memory
layout as the Go heap will not fit in the shadow memory area.

Patch by: Fangming Fang <Fangming.Fang@arm.com>

llvm-svn: 344329

6 years ago[LLDB] - Add support for DW_FORM_implicit_const.
George Rimar [Fri, 12 Oct 2018 09:46:15 +0000 (09:46 +0000)]
[LLDB] - Add support for DW_FORM_implicit_const.

LLDB does not support this DWARF5 form atm.
At least gcc emits it in some cases when doing optimization
for abbreviations.

As far I can tell, clang does not support it yet, though
the rest LLVM code already knows about it.

The patch adds the support.

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

llvm-svn: 344328

6 years agoSCCP: avoid caching DenseMap entry that might be invalidated.
Tim Northover [Fri, 12 Oct 2018 09:01:59 +0000 (09:01 +0000)]
SCCP: avoid caching DenseMap entry that might be invalidated.

Later calls to getValueState might insert entries into the ValueState map and
cause reallocation, invalidating a reference.

llvm-svn: 344327

6 years ago[mips] Mark fmaxl as a long double emulation routine
Stefan Maksimovic [Fri, 12 Oct 2018 08:18:38 +0000 (08:18 +0000)]
[mips] Mark fmaxl as a long double emulation routine

Failure was discovered upon running
projects/compiler-rt/test/builtins/Unit/divtc3_test.c
in a stage2 compiler build.

When compiling projects/compiler-rt/lib/builtins/divtc3.c,
a call to fmaxl within the divtc3 implementation had its
return values read from registers $2 and $3 instead of $f0 and $f2.
Include fmaxl in the list of long double emulation routines
to have its return value correctly interpreted as f128.

Almost exact issue here: https://reviews.llvm.org/D17760

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

llvm-svn: 344326

6 years ago[ThinLTO] Don't import GV which contains blockaddress
Eugene Leviant [Fri, 12 Oct 2018 07:24:02 +0000 (07:24 +0000)]
[ThinLTO] Don't import GV which contains blockaddress

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

llvm-svn: 344325

6 years agoFix bug where `config.asan_dynamic` in generated ASan `lit.site.cfg` files was set...
Dan Liew [Fri, 12 Oct 2018 02:36:19 +0000 (02:36 +0000)]
Fix bug where `config.asan_dynamic` in generated ASan `lit.site.cfg` files was set to `False` for macOS.

`config.asan_dynamic` should actually be `True` because dylibs are the
only supported form of the ASan runtime on Apple platforms.

Reviewers: kubamracek, george.karpenkov, samsonov

Subscribers: srhines, mgorny, #sanitizers, llvm-commits

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

llvm-svn: 344324

6 years agoRemove references to source/Plugins/SymbolFile/NativePDB.
Jason Molenda [Fri, 12 Oct 2018 00:53:55 +0000 (00:53 +0000)]
Remove references to source/Plugins/SymbolFile/NativePDB.

llvm-svn: 344323

6 years ago[analyzer] Fix a bug in unexplored_first_location_queue iteration order.
George Karpenkov [Fri, 12 Oct 2018 00:52:13 +0000 (00:52 +0000)]
[analyzer] Fix a bug in unexplored_first_location_queue iteration order.

Pointed out by Artem in post-commit review for https://reviews.llvm.org/D53058

llvm-svn: 344322

6 years ago[llvm-objcopy] Add -F|--target compatibility
Jordan Rupprecht [Fri, 12 Oct 2018 00:36:01 +0000 (00:36 +0000)]
[llvm-objcopy] Add -F|--target compatibility

Summary:
This change adds support for the GNU --target flag, which sets both --input-target and --output-target.

GNU objcopy doesn't do any checking for whether both --target and --{input,output}-target are used, and so it allows both, e.g. "--target A --output-target B" is equivalent to "--input-target A --output-target B" since the later command line flag would override earlier ones. This may be error prone, so I chose to implement it as an error if both are used. I'm not sure if anyone is actually using both.

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jakehehrlich, alexshap

Subscribers: llvm-commits

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

llvm-svn: 344321

6 years ago[DAGCombiner] rearrange extract_element+bitcast fold; NFC
Sanjay Patel [Thu, 11 Oct 2018 23:56:56 +0000 (23:56 +0000)]
[DAGCombiner] rearrange extract_element+bitcast fold; NFC

I want to add another pattern here that includes scalar_to_vector,
so this makes that patch smaller. I was hoping to remove the
hasOneUse() check because it shouldn't be necessary for common
codegen, but an AMDGPU test has a comment suggesting that the
extra check makes things better on one of those targets.

llvm-svn: 344320

6 years agoUpdate user's manual documentation of profile remapping file to match
Richard Smith [Thu, 11 Oct 2018 23:48:11 +0000 (23:48 +0000)]
Update user's manual documentation of profile remapping file to match
llvm-cxxmap documentation.

Add a hint as to how to perform off-line profile data remapping.

llvm-svn: 344319

6 years agoRevert "DwarfDebug: Pick next location in case of missing location at block begin"
Matthias Braun [Thu, 11 Oct 2018 23:37:58 +0000 (23:37 +0000)]
Revert "DwarfDebug: Pick next location in case of missing location at block begin"

It originally triggered a stepping problem in the debugger, which could
be fixed by adjusting CodeGen/LexicalScopes.cpp however it seems we prefer
the previous behavior anyway.

See the discussion for details: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181008/593833.html

This reverts commit r343880.
This reverts commit r343874.

llvm-svn: 344318

6 years agoRevert "AMDGPU/GlobalISel: Implement select for G_INSERT"
Tom Stellard [Thu, 11 Oct 2018 23:36:46 +0000 (23:36 +0000)]
Revert "AMDGPU/GlobalISel: Implement select for G_INSERT"

This reverts commit r344310.

The test case was failing on some bots.

llvm-svn: 344317

6 years agoOverride libcxxabi's .clang-format in the demangle directory
Erik Pilkington [Thu, 11 Oct 2018 23:30:56 +0000 (23:30 +0000)]
Override libcxxabi's .clang-format in the demangle directory

This directory uses LLVM style.

llvm-svn: 344316

6 years agoX86/TargetTransformInfo: Report div/rem constant immediate costs as TCC_Free
Matthias Braun [Thu, 11 Oct 2018 23:14:35 +0000 (23:14 +0000)]
X86/TargetTransformInfo: Report div/rem constant immediate costs as TCC_Free

DIV/REM by constants should always be expanded into mul/shift/etc.
patterns. Unfortunately the ConstantHoisting pass runs too early at a
point where the pattern isn't expanded yet. However after
ConstantHoisting hoisted some immediate the result may not expand
anymore. Also the hoisting typically doesn't make sense because it
operates on immediates that will change completely during the expansion.

Report DIV/REM as TCC_Free so ConstantHoisting will not touch them.

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

llvm-svn: 344315

6 years agomerge two near-identical functions createPrivateGlobalForString into one
Kostya Serebryany [Thu, 11 Oct 2018 23:03:27 +0000 (23:03 +0000)]
merge two near-identical functions createPrivateGlobalForString into one

Summary:
We have two copies of createPrivateGlobalForString (in asan and in esan).
This change merges them into one. NFC

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 344314

6 years ago[analyzer] Experiment with an iteration order only based on location, and not using...
George Karpenkov [Thu, 11 Oct 2018 22:59:59 +0000 (22:59 +0000)]
[analyzer] Experiment with an iteration order only based on location, and not using the stack frame

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

llvm-svn: 344313

6 years ago[analyzer] Avoid unneeded invalidation in RetainCountChecker
George Karpenkov [Thu, 11 Oct 2018 22:59:38 +0000 (22:59 +0000)]
[analyzer] Avoid unneeded invalidation in RetainCountChecker

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

llvm-svn: 344312

6 years ago[analyzer] Retain count checker for OSObject: recognize OSDynamicCast
George Karpenkov [Thu, 11 Oct 2018 22:59:16 +0000 (22:59 +0000)]
[analyzer] Retain count checker for OSObject: recognize OSDynamicCast

For now, tresting the cast as a no-op, and disregarding the case where
the output becomes null due to the type mismatch.

rdar://45174557

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

llvm-svn: 344311

6 years agoAMDGPU/GlobalISel: Implement select for G_INSERT
Tom Stellard [Thu, 11 Oct 2018 22:49:54 +0000 (22:49 +0000)]
AMDGPU/GlobalISel: Implement select for G_INSERT

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 344310

6 years ago[RISCV] Fix disassembling of fence instruction with invalid field
Ana Pazos [Thu, 11 Oct 2018 22:49:13 +0000 (22:49 +0000)]
[RISCV] Fix disassembling of fence instruction with invalid field

Summary:
Instruction with 0 in fence field being disassembled as fence , iorw.
Printing "unknown" to match GAS behavior.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, asb

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

llvm-svn: 344309

6 years agoInline variable into assert to avoid unused variable warning.
Richard Trieu [Thu, 11 Oct 2018 22:42:41 +0000 (22:42 +0000)]
Inline variable into assert to avoid unused variable warning.

llvm-svn: 344308

6 years ago[llvm-objcopy] Factor out CopyConfig
Alexander Shaposhnikov [Thu, 11 Oct 2018 22:33:50 +0000 (22:33 +0000)]
[llvm-objcopy] Factor out CopyConfig

In this diff we move out CopyConfig from llvm-oobjcopy.cpp into a separate header CopyConfig.h
to enable us (in the future) reuse this class in the other implementations of objcopy (for coff, mach-o).
Additionally this enables us to unload the complexity from llvm-objcopy.cpp a little bit.

Test plan: make check-all

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

llvm-svn: 344307

6 years ago[llvm-pdbutil] Add missing pdb for test
Aaron Smith [Thu, 11 Oct 2018 22:25:55 +0000 (22:25 +0000)]
[llvm-pdbutil] Add missing pdb for test

llvm-svn: 344306

6 years agoRemove SymbolTable::addAbsolute().
Rui Ueyama [Thu, 11 Oct 2018 22:15:41 +0000 (22:15 +0000)]
Remove SymbolTable::addAbsolute().

addAbsolute() could be implemented as a non-member function.

llvm-svn: 344305

6 years ago[SampleFDO][NFC] Remove debugging log left over in the code.
Wei Mi [Thu, 11 Oct 2018 22:14:27 +0000 (22:14 +0000)]
[SampleFDO][NFC] Remove debugging log left over in the code.

llvm-svn: 344304

6 years ago[x86] add tests for extract_element; NFC
Sanjay Patel [Thu, 11 Oct 2018 22:04:36 +0000 (22:04 +0000)]
[x86] add tests for extract_element; NFC

The transform for this pattern has an unnecessary one-use limitation.

llvm-svn: 344303

6 years agoRemove `else` after `return`.
Rui Ueyama [Thu, 11 Oct 2018 21:57:52 +0000 (21:57 +0000)]
Remove `else` after `return`.

llvm-svn: 344302

6 years ago[x86] regenerate CHECKs; NFC
Sanjay Patel [Thu, 11 Oct 2018 21:44:38 +0000 (21:44 +0000)]
[x86] regenerate CHECKs; NFC

llvm-svn: 344301

6 years ago[ELF] Fix link failure with Android compressed relocation support.
Eli Friedman [Thu, 11 Oct 2018 21:43:06 +0000 (21:43 +0000)]
[ELF] Fix link failure with Android compressed relocation support.

Android uses a compressed relocation format, which means the size of the
relocation section isn't predictable based on the number of relocations,
and can vary if the layout changes in any way. To deal with this, the
linker normally runs multiple passes until the layout converges.

The layout should converge if the size of the compressed
relocation section increases monotonically: if the size of an encoded
offset increases by one byte, the larget value which can be encoded is
multiplied by 128, so the representable offsets grow much faster than
the size of the section itself.

The problem here is that there is no code to ensure the size of the
section doesn't decrease.  If the size of the relocation section
decreases, the relative offsets can increase due to alignment
restrictions, so that can force the size of the relocation section to
increase again.  The end result is an infinite loop; the loop gets cut
off after 10 iterations with the message "thunk creation not
converged".

To avoid this issue, this patch adds padding to the end of the
relocation section if its size would decrease.  The extra
padding is harmless because of the way the format is defined:
decoding stops after it reaches the number of relocations specified
in the section's header.

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

llvm-svn: 344300

6 years ago[Documentation] Rephrase modernize-deprecated-ios-base-aliases description. Add clang...
Eugene Zelenko [Thu, 11 Oct 2018 21:40:32 +0000 (21:40 +0000)]
[Documentation] Rephrase modernize-deprecated-ios-base-aliases description. Add clangd and clang-doc placeholders in Release Notes.

llvm-svn: 344299

6 years ago[llvm-pdbutil] Pretty print PDBSymbolUsingNamespace symbols
Aaron Smith [Thu, 11 Oct 2018 21:37:18 +0000 (21:37 +0000)]
[llvm-pdbutil] Pretty print PDBSymbolUsingNamespace symbols

Reviewers: rnk, zturner, llvm-commits

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

llvm-svn: 344298

6 years agoRevert "[Driver] Default Android toolchains to libc++."
Dan Albert [Thu, 11 Oct 2018 21:28:42 +0000 (21:28 +0000)]
Revert "[Driver] Default Android toolchains to libc++."

Breaks some of the Android bots because they aren't expecting to need
to explicitly set -stdlib.

This reverts commit 031072f5048654b01a40f639633de1ff4e2f3dc8.

llvm-svn: 344297

6 years ago[Driver] Default Android toolchains to libc++.
Dan Albert [Thu, 11 Oct 2018 20:58:43 +0000 (20:58 +0000)]
[Driver] Default Android toolchains to libc++.

Reviewers: srhines, pirama, EricWF

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344296

6 years ago[Driver] Default to `-z now` and `-z relro` on Android.
Dan Albert [Thu, 11 Oct 2018 20:57:54 +0000 (20:57 +0000)]
[Driver] Default to `-z now` and `-z relro` on Android.

Summary:
RTLD_LAZY is not supported on Android (though failing to use `-z now`
will work since it is assumed by the loader).

RelRO is required.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344295

6 years agoRename SymbolTable::addRegular -> SymbolTable::addDefined.
Rui Ueyama [Thu, 11 Oct 2018 20:43:01 +0000 (20:43 +0000)]
Rename SymbolTable::addRegular -> SymbolTable::addDefined.

We have addAbsolute, addBitcode, addCommon, etc. addRegular looked a
bit inconsistent.

llvm-svn: 344294

6 years ago[Driver] Fix --hash-style choice for Android.
Dan Albert [Thu, 11 Oct 2018 20:39:32 +0000 (20:39 +0000)]
[Driver] Fix --hash-style choice for Android.

Summary:
Android supports GNU style hashes as of Marshmallow, so we should be
generating both styles for pre-M targets and GNU hashes for newer
targets.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344293

6 years agoRemove unused default arguments.
Rui Ueyama [Thu, 11 Oct 2018 20:38:34 +0000 (20:38 +0000)]
Remove unused default arguments.

llvm-svn: 344292

6 years ago[X86] Type legalize v2f32 loads by using an f64 load and a scalar_to_vector.
Craig Topper [Thu, 11 Oct 2018 20:36:06 +0000 (20:36 +0000)]
[X86] Type legalize v2f32 loads by using an f64 load and a scalar_to_vector.

On 64-bit targets the generic legalize will use an i64 load and a scalar_to_vector for us. But on 32-bit targets i64 isn't legal and the generic legalizer will end up emitting two 32-bit loads. We have DAG combines that try to put those two loads back together with pretty good success.

This patch instead uses f64 to avoid the splitting entirely. I've made it do the same for 64-bit mode for consistency and to keep the load in the fp domain.

There are a few things in here that look like regressions in 32-bit mode, but I believe they bring us closer to the 64-bit mode codegen. And that the 64-bit mode code could be better. I think those issues should be looked at separately.

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

llvm-svn: 344291

6 years agoRemove SymbolTable::addUndefined<ELF32LE>(StringRef).
Rui Ueyama [Thu, 11 Oct 2018 20:34:29 +0000 (20:34 +0000)]
Remove SymbolTable::addUndefined<ELF32LE>(StringRef).

Because we can implement the function as a non-member function.

llvm-svn: 344290

6 years ago[hwasan] relax a test
Kostya Serebryany [Thu, 11 Oct 2018 20:29:00 +0000 (20:29 +0000)]
[hwasan] relax a test

llvm-svn: 344289

6 years ago[python] [tests] Fix calling tests on Windows
Michal Gorny [Thu, 11 Oct 2018 20:26:55 +0000 (20:26 +0000)]
[python] [tests] Fix calling tests on Windows

Fix passing arguments to the Python test command to use 'env' builtin
CMake command, in order to fix compatibility with Windows.

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

llvm-svn: 344288

6 years ago[WebAssembly][NFC] Remove repetition of Defs = [ARGUMENTS] (fixed)
Thomas Lively [Thu, 11 Oct 2018 20:21:22 +0000 (20:21 +0000)]
[WebAssembly][NFC] Remove repetition of Defs = [ARGUMENTS] (fixed)

llvm-svn: 344287

6 years agoUpdate test of r344198 to work with release builds.
Warren Ristow [Thu, 11 Oct 2018 20:19:25 +0000 (20:19 +0000)]
Update test of r344198 to work with release builds.

llvm-svn: 344286

6 years ago[HIP] Remove unused irif bitcode from test
Aaron Enye Shi [Thu, 11 Oct 2018 19:52:32 +0000 (19:52 +0000)]
[HIP] Remove unused irif bitcode from test

This is part of previous commit [HIP] Replace irif library with hip.amdgcn.bc

Reviewers: yaxunl

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

llvm-svn: 344285

6 years ago[Hexagon] Restrict compound instructions with constant value.
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:48:15 +0000 (19:48 +0000)]
[Hexagon] Restrict compound instructions with constant value.

Having a constant value operand in the compound instruction
is not always profitable. This patch improves coremark by ~4% on
Hexagon.

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

llvm-svn: 344284

6 years ago[Pipeliner] Use the Index from Topo instead of relying on NodeNum. (NFC)
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:45:07 +0000 (19:45 +0000)]
[Pipeliner] Use the Index from Topo instead of relying on NodeNum. (NFC)

In future, if we may add any new DAG mutations other than artificial dependencies,
the NodeNum may not be valid. Instead the index from topological schedule DAG can be
used as long as we update it with the DAG change.

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

llvm-svn: 344283

6 years ago[Pipeliner] Fix the Schedule DAG topoligical order.
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:42:46 +0000 (19:42 +0000)]
[Pipeliner] Fix the Schedule DAG topoligical order.

This patch updates the DAG change to reflect in the topological ordering
of the nodes.

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

llvm-svn: 344282

6 years ago[HIP] Replace irif library with hip.amdgcn.bc
Aaron Enye Shi [Thu, 11 Oct 2018 19:41:54 +0000 (19:41 +0000)]
[HIP] Replace irif library with hip.amdgcn.bc

No longer use irif amdgcn library, instead we will use the previous fence functions from new hip.amdgcn.bc bitcode library. Update hip-device-libs.hip test as well.

llvm-svn: 344281

6 years ago[WebAssembly] Revert rL344180, which was breaking expensive checks
Thomas Lively [Thu, 11 Oct 2018 18:45:48 +0000 (18:45 +0000)]
[WebAssembly] Revert rL344180, which was breaking expensive checks

llvm-svn: 344280

6 years agoRevert SymbolFileNativePDB plugin.
Zachary Turner [Thu, 11 Oct 2018 18:45:44 +0000 (18:45 +0000)]
Revert SymbolFileNativePDB plugin.

This was originally causing some test failures on non-Windows
platforms, which required fixes in the compiler and linker.  After
those fixes, however, other tests started failing.  Reverting
temporarily until I can address everything.

llvm-svn: 344279

6 years agoRevert r344197 "[MC][ELF] compute entity size for explicit sections"
Artem Dergachev [Thu, 11 Oct 2018 18:43:08 +0000 (18:43 +0000)]
Revert r344197 "[MC][ELF] compute entity size for explicit sections"

Revert r344206 "[MC][ELF] Fix section_mergeable_size.ll"

They were causing failures on too many important buildbots for too long.
Please revert eagerly if your fix takes more than a couple of hours to land!

llvm-svn: 344278

6 years agoFix this comment so it is consistent with all the others.
Jason Molenda [Thu, 11 Oct 2018 18:41:34 +0000 (18:41 +0000)]
Fix this comment so it is consistent with all the others.

llvm-svn: 344277

6 years agoRevert "clang-cl: Add /showFilenames option (PR31957)"
Sean Fertile [Thu, 11 Oct 2018 18:40:35 +0000 (18:40 +0000)]
Revert "clang-cl: Add /showFilenames option (PR31957)"

This reverts https://reviews.llvm.org/rL344234 which is causing failures on
several bots due to invalid llvm.linker.options.

llvm-svn: 344276

6 years agoDon't mark an LC_BUILD_VERSION as giving us a
Jason Molenda [Thu, 11 Oct 2018 18:37:53 +0000 (18:37 +0000)]
Don't mark an LC_BUILD_VERSION as giving us a
correct version if it has a major verison 0.

llvm-svn: 344275

6 years ago[PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager
Leonard Chan [Thu, 11 Oct 2018 18:31:51 +0000 (18:31 +0000)]
[PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager

This patch ports the legacy pass manager to the new one to take advantage of
the benefits of the new PM. This involved moving a lot of the declarations for
`AddressSantizer` to a header so that it can be publicly used via
PassRegistry.def which I believe contains all the passes managed by the new PM.

This patch essentially decouples the instrumentation from the legacy PM such
hat it can be used by both legacy and new PM infrastructure.

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

llvm-svn: 344274

6 years ago[OPENMP][NVPTX]Reduce memory use for globalized vars in
Alexey Bataev [Thu, 11 Oct 2018 18:30:31 +0000 (18:30 +0000)]
[OPENMP][NVPTX]Reduce memory use for globalized vars in
target/teams/distribute regions.

Previously introduced globalization scheme that uses memory coalescing
scheme may increase memory usage fr the variables that are devlared in
target/teams/distribute contexts. We don't need 32 copies of such
variables, just 1. Patch reduces memory use in this case.

llvm-svn: 344273

6 years ago[DAG] Fix Big Endian in Load-Store forwarding
Nirav Dave [Thu, 11 Oct 2018 18:28:59 +0000 (18:28 +0000)]
[DAG] Fix Big Endian in Load-Store forwarding

Summary:
Correct offset calculation in load-store forwarding for big-endian
targets.

Reviewers: rnk, RKSimon, waltl

Subscribers: sdardis, nemanjai, hiraditya, jrtc27, atanasyan, jsji, llvm-commits

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

llvm-svn: 344272

6 years ago[Hexagon] Eliminate potential sources of non-determinism in HCE
Krzysztof Parzyszek [Thu, 11 Oct 2018 18:26:02 +0000 (18:26 +0000)]
[Hexagon] Eliminate potential sources of non-determinism in HCE

Also, avoid comparing GUIDs when ordering global addresses, because
source file location can cause different GUID to be calculated. As a
result, a pair of symbols can compare "less" in one directory, but
"greater" in another.

llvm-svn: 344271

6 years ago[X86] Restore X86ISelDAGToDAG::matchBEXTRFromAnd. Teach address matching to create...
Craig Topper [Thu, 11 Oct 2018 18:06:07 +0000 (18:06 +0000)]
[X86] Restore X86ISelDAGToDAG::matchBEXTRFromAnd. Teach address matching to create a BEXTR pattern from a (shl (and X, mask >> C1) if C1 can be folded into addressing mode.

This is an alternative to D53080 since I think using a BEXTR for a shifted mask is definitely an improvement when the shl can be absorbed into addressing mode. The other cases I'm less sure about.

We already have several tricks for handling an and of a shift in address matching. This adds a new case for BEXTR.

I've moved the BEXTR matching code back to X86ISelDAGToDAG to allow it to match. I suppose alternatively we could directly emit a X86ISD::BEXTR node that isel could pattern match. But I'm trying to view BEXTR matching as an isel concern so DAG combine can see 'and' and 'shift' operations that are well understood. We did lose a couple cases from tbm_patterns.ll, but I think there are ways to recover that.

I've also put back the manual load folding code in matchBEXTRFromAnd that I removed a few months ago in r324939. This gives us some more freedom to make decisions based on the ability to fold a load. I haven't done anything with that yet.

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

llvm-svn: 344270

6 years agoBetter support for POSIX paths in PDBs.
Zachary Turner [Thu, 11 Oct 2018 18:01:55 +0000 (18:01 +0000)]
Better support for POSIX paths in PDBs.

While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.

The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).

There's changes in clang, LLD, and lldb in this patch.  After
this the cross-platform disassembly and source-list tests pass
on Linux.

Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.

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

llvm-svn: 344269

6 years ago[llvm-nm] Fix crash when running with --print-armap on corrupt archives.
Jordan Rupprecht [Thu, 11 Oct 2018 17:55:11 +0000 (17:55 +0000)]
[llvm-nm] Fix crash when running with --print-armap on corrupt archives.

error() in llvm-nm intentionally does not return so that the callee can move on to future files/slices. When printing the archive map, this is not currently handled (the caller assumes that error() returns), so processing continues despite there being an error.

Also, change one return to a break, so that symbols can be printed even if the archive map is corrupt.

llvm-svn: 344268

6 years agoRevert "[Lex] TokenConcatenation now takes const Preprocessor"
Eric Liu [Thu, 11 Oct 2018 17:50:04 +0000 (17:50 +0000)]
Revert "[Lex] TokenConcatenation now takes const Preprocessor"

This reverts commit r344262. This was an unintentional commit.

llvm-svn: 344267

6 years agoclang-cl: set output of lit-test to a tmp file after r344234
Eric Liu [Thu, 11 Oct 2018 17:49:20 +0000 (17:49 +0000)]
clang-cl: set output of lit-test to a tmp file after r344234

Some test frameworks do not allow output file in CWD.

llvm-svn: 344266

6 years ago[COFF] Add and use a Wordsize field in Config. NFCI.
Martin Storsjo [Thu, 11 Oct 2018 17:45:58 +0000 (17:45 +0000)]
[COFF] Add and use a Wordsize field in Config. NFCI.

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

llvm-svn: 344265

6 years ago[COFF] Set proper pointer size alignment for LocalImportChunk
Martin Storsjo [Thu, 11 Oct 2018 17:45:51 +0000 (17:45 +0000)]
[COFF] Set proper pointer size alignment for LocalImportChunk

When these are accessed with load/store instructions on ARM64,
it becomes strictly necessary to have them properly aligned.

This fixes PR39228.

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

llvm-svn: 344264

6 years ago[python] [tests] Retab CMakeLists.txt for consistency (NFC)
Michal Gorny [Thu, 11 Oct 2018 17:45:35 +0000 (17:45 +0000)]
[python] [tests] Retab CMakeLists.txt for consistency (NFC)

llvm-svn: 344263

6 years ago[Lex] TokenConcatenation now takes const Preprocessor
Eric Liu [Thu, 11 Oct 2018 17:35:29 +0000 (17:35 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

llvm-svn: 344262

6 years agoRevert commit r344254; does not work with C++03
Marshall Clow [Thu, 11 Oct 2018 17:28:57 +0000 (17:28 +0000)]
Revert commit r344254; does not work with C++03

llvm-svn: 344261

6 years ago[tests] Remove Python tests from check-all due to breakage
Michal Gorny [Thu, 11 Oct 2018 17:25:05 +0000 (17:25 +0000)]
[tests] Remove Python tests from check-all due to breakage

Remove the Python tests from default target in order to fix two
kinds of breakage uncovered by enabling them: one failing test on Linux,
and problem with the test command on Windows.  Both to be addressed
in followup revisions.

llvm-svn: 344260

6 years agoImprove -Wshadow warnings with enumerators.
Aaron Ballman [Thu, 11 Oct 2018 16:40:18 +0000 (16:40 +0000)]
Improve -Wshadow warnings with enumerators.

Addresses PR24718 by checking for enumerators that shadow other enumerators. Catches issues like:

enum E1{e1};
void f(void) {
  enum E2{e1};
}

llvm-svn: 344259

6 years ago[tests] Include Python binding tests in CMake rules
Michal Gorny [Thu, 11 Oct 2018 16:32:54 +0000 (16:32 +0000)]
[tests] Include Python binding tests in CMake rules

Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.

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

llvm-svn: 344258

6 years agoSome improvements to the OpenBSD driver.
Brad Smith [Thu, 11 Oct 2018 16:13:44 +0000 (16:13 +0000)]
Some improvements to the OpenBSD driver.

- OpenBSD has switched to compiler_rt / libcxx
- Fix sysroot and lib path handling
- Some cleaning up

llvm-svn: 344257