platform/upstream/llvm.git
6 years ago[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.
Artem Dergachev [Thu, 19 Apr 2018 23:00:22 +0000 (23:00 +0000)]
[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.

r315736 added support for the misplaced CF_RETURNS_RETAINED annotation on
CFRetain() wrappers. It works by trusting the function's name (seeing if it
confirms to the CoreFoundation naming convention) rather than the annotation.

There are more false positives caused by users using a different naming
convention, namely starting the function name with "retain" or "release"
rather than suffixing it with "retain" or "release" respectively.

Because this isn't according to the naming convention, these functions
are usually inlined and the annotation is therefore ignored, which is correct.
But sometimes we run out of inlining stack depth and the function is
evaluated conservatively and then the annotation is trusted.

Add support for the "alternative" naming convention and test the situation when
we're running out of inlining stack depth.

rdar://problem/18270122

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

llvm-svn: 330375

6 years ago[WebAssembly] Fix bug where reloc addends were written as unsigned
Sam Clegg [Thu, 19 Apr 2018 22:48:03 +0000 (22:48 +0000)]
[WebAssembly] Fix bug where reloc addends were written as unsigned

Relocation addends can be negative so should be written as
signed LEBs. This bug meant that writing value between 64
and 128 would be incorrectly interpreted as negative by the
object file readers.

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

llvm-svn: 330374

6 years ago[MachineOutliner] NFC: Move EnableLinkOnceODROutlining into MachineOutliner.cpp
Jessica Paquette [Thu, 19 Apr 2018 22:17:07 +0000 (22:17 +0000)]
[MachineOutliner] NFC: Move EnableLinkOnceODROutlining into MachineOutliner.cpp

This moves the EnableLinkOnceODROutlining flag from TargetPassConfig.cpp into
MachineOutliner.cpp. It also removes OutlineFromLinkOnceODRs from the
MachineOutliner constructor. This is now handled by the moved command-line
flag.

llvm-svn: 330373

6 years agoDon't do aligned allocations on MSVCRT before 19.12 (update 15.3)
Reid Kleckner [Thu, 19 Apr 2018 22:12:10 +0000 (22:12 +0000)]
Don't do aligned allocations on MSVCRT before 19.12 (update 15.3)

Reviewers: EricWF, pcc

Subscribers: christof, cfe-commits

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

llvm-svn: 330372

6 years ago[llvm-mca][X86] Add prefetch instruction resource tests
Simon Pilgrim [Thu, 19 Apr 2018 22:11:58 +0000 (22:11 +0000)]
[llvm-mca][X86] Add prefetch instruction resource tests

llvm-svn: 330371

6 years ago[WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive...
Sam Clegg [Thu, 19 Apr 2018 22:00:53 +0000 (22:00 +0000)]
[WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive parser.

This is a temporary solution until a proper WASM implementation of
MCAsmParserExtension is in place, but at least for now will unblock this
path.

Added test to make sure this path works with the WASM Assembler.

Patch By Wouter van Oortmerssen!

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

llvm-svn: 330370

6 years agoAdd a test. NFC.
Rafael Espindola [Thu, 19 Apr 2018 21:58:28 +0000 (21:58 +0000)]
Add a test. NFC.

We have relatively few tests on the contents of non alloc
sections. This one would have found a bug in a patch I am working on.

llvm-svn: 330369

6 years ago[Reassociate] add baseline tests for binop swapping; NFC
Sanjay Patel [Thu, 19 Apr 2018 21:56:17 +0000 (21:56 +0000)]
[Reassociate] add baseline tests for binop swapping; NFC

Similar to rL330086, I don't know if we want to do these
transforms here, but we might as well have the tests
here either way to show that this pass is missing
potential functionality (intentionally or not).

llvm-svn: 330368

6 years agoCOFF: Remove OutputSection::getPermissions() and getCharacteristics().
Peter Collingbourne [Thu, 19 Apr 2018 21:48:37 +0000 (21:48 +0000)]
COFF: Remove OutputSection::getPermissions() and getCharacteristics().

All callers can just access the header directly.

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

llvm-svn: 330367

6 years ago[llvm-mca][FMA] Add FMA resource tests
Simon Pilgrim [Thu, 19 Apr 2018 21:32:22 +0000 (21:32 +0000)]
[llvm-mca][FMA] Add FMA resource tests

llvm-svn: 330366

6 years ago[AMDGPU] Use packed literals with zero either lower or hi part
Stanislav Mekhanoshin [Thu, 19 Apr 2018 21:16:50 +0000 (21:16 +0000)]
[AMDGPU] Use packed literals with zero either lower or hi part

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

llvm-svn: 330365

6 years ago[llvm-objdump] Issue error message when object file cannot be created
Gerolf Hoflehner [Thu, 19 Apr 2018 20:48:35 +0000 (20:48 +0000)]
[llvm-objdump] Issue error message when object file cannot be created

llvm-svn: 330364

6 years ago[X86] Remove non-existant instruction name from X86DisassemblerTables.cpp.
Craig Topper [Thu, 19 Apr 2018 20:44:15 +0000 (20:44 +0000)]
[X86] Remove non-existant instruction name from X86DisassemblerTables.cpp.

This instruction was removed a long time so we don't need to check for it here.

llvm-svn: 330363

6 years agoRefine the loop rotation's API
Jin Lin [Thu, 19 Apr 2018 20:29:43 +0000 (20:29 +0000)]
Refine the loop rotation's API

Summary:
The following changes addresses the following two issues.

1) The existing loop rotation pass contains both loop latch simplification and loop rotation. So one flag RotationOnly is added to be passed to the loop rotation pass.
2) The threshold value is initialized with MAX_UINT since the loop rotation utility should not have threshold limit.

Reviewers: dmgreen, efriedma

Reviewed By: efriedma

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

llvm-svn: 330362

6 years agoCOFF: Rename Chunk::getPermissions to getOutputCharacteristics.
Peter Collingbourne [Thu, 19 Apr 2018 20:03:24 +0000 (20:03 +0000)]
COFF: Rename Chunk::getPermissions to getOutputCharacteristics.

In an upcoming change I will need to make a distinction between section
type (code, data, bss) and permissions. The term that I use for both
of these things is "output characteristics".

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

llvm-svn: 330361

6 years agoRemove impossible _MSC_VER check
Reid Kleckner [Thu, 19 Apr 2018 19:40:12 +0000 (19:40 +0000)]
Remove impossible _MSC_VER check

Summary:
It is immediately preceded by this check:
  #if _MSC_VER < 1900
  #error "MSVC versions prior to Visual Studio 2015 are not supported"
  #endif

Reviewers: EricWF

Subscribers: christof, cfe-commits

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

llvm-svn: 330360

6 years ago[ORC] Fix an assertion condition from r329934.
Lang Hames [Thu, 19 Apr 2018 19:30:35 +0000 (19:30 +0000)]
[ORC] Fix an assertion condition from r329934.

Thanks to Alexander Ivchenko for finding the issue!

llvm-svn: 330359

6 years ago[X86] Enable popcnt false dependency breaking on Silvermont and Goldmont.
Craig Topper [Thu, 19 Apr 2018 19:25:24 +0000 (19:25 +0000)]
[X86] Enable popcnt false dependency breaking on Silvermont and Goldmont.

Silvermont and Goldmont have the same issue on popcnt as Sandy Bridge, Haswell, Broadwell, and Skylake. Believe it is fixed in Goldmont Plus.

llvm-svn: 330358

6 years ago[PM/LoopUnswitch] Detect irreducible control flow within loops and skip unswitching...
Chandler Carruth [Thu, 19 Apr 2018 18:44:25 +0000 (18:44 +0000)]
[PM/LoopUnswitch] Detect irreducible control flow within loops and skip unswitching non-trivial edges.

Summary:
This fixes the bug pointed out in review with non-trivial unswitching.

This also provides a basis that should make it pretty easy to finish
fleshing out a routine to scan an entire function body for irreducible
control flow, but this patch remains minimal for disabling loop
unswitch.

Reviewers: sanjoy, fedor.sergeev

Subscribers: mcrosier, hiraditya, llvm-commits

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

llvm-svn: 330357

6 years ago[ORC] Make VSO symbol resolution/finalization operations private.
Lang Hames [Thu, 19 Apr 2018 18:42:49 +0000 (18:42 +0000)]
[ORC] Make VSO symbol resolution/finalization operations private.

This forces these operations to be carried out via a
MaterializationResponsibility instance, ensuring responsibility is explicitly
tracked.

llvm-svn: 330356

6 years ago[sanitizer] Minor refactor of some ReservedAddressRange functions
Kostya Kortchinsky [Thu, 19 Apr 2018 18:38:15 +0000 (18:38 +0000)]
[sanitizer] Minor refactor of some ReservedAddressRange functions

Summary:
Some of the functions had spurious conditional statements and checks, and some
intermediary variables that I feel made the code more complicated than it needs
to be. Also, when unmapping the whole range, the range size would be 0, but
the base was set to the address of the end of the range, which sounds prone to
error. I think nulling out the base in this scenario is a better way to go.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330355

6 years agoFix narrowing warning by appending `f` to literal constant.
Adrian McCarthy [Thu, 19 Apr 2018 18:31:57 +0000 (18:31 +0000)]
Fix narrowing warning by appending `f` to literal constant.

llvm-svn: 330354

6 years ago[UnitTests] NFC/build-perf: Break up nontrivial compile jobs
David Zarzycki [Thu, 19 Apr 2018 18:19:02 +0000 (18:19 +0000)]
[UnitTests] NFC/build-perf: Break up nontrivial compile jobs

RecursiveASTVisitorTest.cpp is one of the longest compile jobs and a
build bottleneck on many-core machines. This patch breaks that file and
some peer files up into smaller files to increase build concurrency and
overall rebuild performance.

llvm-svn: 330353

6 years ago[llvm-mca][X86] Add resource test for every out-of-order scheduler model
Simon Pilgrim [Thu, 19 Apr 2018 18:08:10 +0000 (18:08 +0000)]
[llvm-mca][X86] Add resource test for every out-of-order scheduler model

I've copied and regenerated a resource file from btver2 to every x86 scheduler model supported by llvm-mca so we have at least some basic coverage.

For most this has been the avx1 tests, but for silvermont I've used sse42 as thats the latest it supports.

More will be added later.

llvm-svn: 330352

6 years ago[X86][SLM] Fix typo using SandyBridge resources.
Simon Pilgrim [Thu, 19 Apr 2018 18:01:52 +0000 (18:01 +0000)]
[X86][SLM] Fix typo using SandyBridge resources.

Luckily this was on instructions not supported on Silvermont....

llvm-svn: 330351

6 years agoDefine InputSection::getOffset inline.
Rafael Espindola [Thu, 19 Apr 2018 18:00:46 +0000 (18:00 +0000)]
Define InputSection::getOffset inline.

This is much simpler than the other section types and there are many
places where the section type is statically know.

llvm-svn: 330350

6 years ago[X86] Correct the scheduling data for register forms of XCHG and XADD on Intel CPUs.
Craig Topper [Thu, 19 Apr 2018 18:00:17 +0000 (18:00 +0000)]
[X86] Correct the scheduling data for register forms of XCHG and XADD on Intel CPUs.

The XCHG16rr/XCHG32rr/XCHG64rr instructions should be 3 uops just like XCHG8rr. I believe they're just implemented as 3 move uops with a temporary register.

XADD is probably 2 moves and an add also using a temporary register.

Change the latency for both from 2 cycles to 3 cycles. Only 2 of the uops are serialized in their execution, the move into the temporary and the move out of the temporary. The move from one GPR to the other should be able to go in parallel with this if there are ALU resources available.

llvm-svn: 330349

6 years ago[Reassociate] fix formatting; NFC
Sanjay Patel [Thu, 19 Apr 2018 17:56:36 +0000 (17:56 +0000)]
[Reassociate] fix formatting; NFC

llvm-svn: 330348

6 years ago[X86] Merge some MMX instregex
Simon Pilgrim [Thu, 19 Apr 2018 17:32:10 +0000 (17:32 +0000)]
[X86] Merge some MMX instregex

There's a lot more but I'd prefer focussing on removing unnecessary InstRWs first.

llvm-svn: 330347

6 years agoSimplify Repl handling.
Rafael Espindola [Thu, 19 Apr 2018 17:26:50 +0000 (17:26 +0000)]
Simplify Repl handling.

Now that we don't ICF synthetic sections, we can go back to the old
logic on whose responsibility it is to check Repl.

The idea is that Sec->something() will not check Repl. It is the
responsibility of the caller to find the correct Sec.

llvm-svn: 330346

6 years ago[if-converter] Handle BBs that terminate in ret during diamond conversion
Krzysztof Parzyszek [Thu, 19 Apr 2018 17:26:46 +0000 (17:26 +0000)]
[if-converter] Handle BBs that terminate in ret during diamond conversion

This fixes https://llvm.org/PR36825.

Original patch by Valentin Churavy (D45218).

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

llvm-svn: 330345

6 years ago[Hexagon] Use legal types when lowering CONCAT_VECTORS via BUILD_VECTOR
Krzysztof Parzyszek [Thu, 19 Apr 2018 17:11:58 +0000 (17:11 +0000)]
[Hexagon] Use legal types when lowering CONCAT_VECTORS via BUILD_VECTOR

llvm-svn: 330344

6 years ago[llvm-objdump] Remove test object file
Francis Visoiu Mistrih [Thu, 19 Apr 2018 17:05:03 +0000 (17:05 +0000)]
[llvm-objdump] Remove test object file

Forgot to remove it from the previous commit.

llvm-svn: 330343

6 years ago[llvm-objdump] Print "..." instead of random data for virtual sections
Francis Visoiu Mistrih [Thu, 19 Apr 2018 17:02:57 +0000 (17:02 +0000)]
[llvm-objdump] Print "..." instead of random data for virtual sections

When disassembling with -D, skip virtual sections by printing "..." for
each symbol.

This patch also implements `MachOObjectFile::isSectionVirtual`.

Test case comes from:

```
.zerofill __DATA,__common,_data64unsigned,472,3
```

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

llvm-svn: 330342

6 years ago[gold/ThinLTO] Invoke llvm_shutdown when exiting after ThinLTO indexing
Teresa Johnson [Thu, 19 Apr 2018 16:55:13 +0000 (16:55 +0000)]
[gold/ThinLTO] Invoke llvm_shutdown when exiting after ThinLTO indexing

Summary:
Instead of manually invoking PrintStatistics, simply invoke
llvm_shutdown which will take care of destroying managed statics, and as
a side effect will destroy the StatisticInfo ManagedStatic, invoking
PrintStatistics when needed.

Reviewers: fhahn

Subscribers: inglorion, llvm-commits

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

llvm-svn: 330341

6 years agoSimplify getOffset for synthetic sections.
Rafael Espindola [Thu, 19 Apr 2018 16:54:30 +0000 (16:54 +0000)]
Simplify getOffset for synthetic sections.

We had a single symbol using -1 with a synthetic section. It is
simpler to just update its value.

This is not a big will by itself, but will allow having a simple
getOffset for InputSeciton.

llvm-svn: 330340

6 years agoRename MergeInputSection::getOffset.
Rafael Espindola [Thu, 19 Apr 2018 16:05:07 +0000 (16:05 +0000)]
Rename MergeInputSection::getOffset.

Unlike the getOffset in the base class, this one computes the offset
in the parent synthetic section, not the final output section.

llvm-svn: 330339

6 years ago[CXX] Templates specialization visibility can be wrong
Steven Wu [Thu, 19 Apr 2018 15:46:43 +0000 (15:46 +0000)]
[CXX] Templates specialization visibility can be wrong

Summary:
Under some conditions, LinkageComputer can get the visibility for
ClassTemplateSpecializationDecl wrong because it failed to find the Decl
that has the explicit visibility.

This fixes:
llvm.org/bugs/pr36810
rdar://problem/38080953

Reviewers: rsmith, arphaman, doug.gregor

Reviewed By: doug.gregor

Subscribers: doug.gregor, cfe-commits

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

llvm-svn: 330338

6 years ago[AMDGPU] Do not only rely on BB number when finding bottom loop
Mark Searles [Thu, 19 Apr 2018 15:42:30 +0000 (15:42 +0000)]
[AMDGPU] Do not only rely on BB number when finding bottom loop

We should also check that the "bottom" basic block of a loopis a successor of the "header" basic block, otherwise we don't propagate the information correctly when the CFG is complex. This fixes an important rendering problem with Wolfsentein 2, because of one vector-memory wait was missing.

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

llvm-svn: 330337

6 years ago[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode
Ivan A. Kosarev [Thu, 19 Apr 2018 15:27:28 +0000 (15:27 +0000)]
[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode

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

llvm-svn: 330336

6 years ago[llvm-mca][X86] Add mmx instruction to btver2 resource tests
Simon Pilgrim [Thu, 19 Apr 2018 15:09:46 +0000 (15:09 +0000)]
[llvm-mca][X86] Add mmx instruction to btver2 resource tests

Useful to see scheduler class deltas against xmm equivalents

llvm-svn: 330335

6 years ago[NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.
Florian Hahn [Thu, 19 Apr 2018 15:05:47 +0000 (15:05 +0000)]
[NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.

If those operands change, we might find a leader for ValueOp, which
could enable new phi-of-op creation.

This fixes a case where we missed creating a phi-of-ops node. With D43865
and this patch, bootstrapping clang/llvm works with -enable-newgvn, whereas
without it, the "value changed after iteration" assertion is triggered.

Reviewers: dberlin, davide

Reviewed By: dberlin

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

llvm-svn: 330334

6 years ago[Hexagon] Generate code for vector bswap intrinsics
Krzysztof Parzyszek [Thu, 19 Apr 2018 14:46:44 +0000 (14:46 +0000)]
[Hexagon] Generate code for vector bswap intrinsics

llvm-svn: 330333

6 years ago[X86][BtVer2] Remove SSE4A EXTRQ/EXTRQI InstRW overrides.
Simon Pilgrim [Thu, 19 Apr 2018 14:38:36 +0000 (14:38 +0000)]
[X86][BtVer2] Remove SSE4A EXTRQ/EXTRQI InstRW overrides.

These are already handled identically by WriteALU.

llvm-svn: 330332

6 years agoFix __attribute__((force_align_arg_pointer)) misalignment bug
Erich Keane [Thu, 19 Apr 2018 14:27:05 +0000 (14:27 +0000)]
Fix __attribute__((force_align_arg_pointer)) misalignment bug

The force_align_arg_pointer attribute was using a hardcoded 16-byte
alignment value which in combination with -mstack-alignment=32 (or
larger) would produce a misaligned stack which could result in crashes
when accessing stack buffers using aligned AVX load/store instructions.

Fix the issue by using the "stackrealign" function attribute instead
of using a hardcoded 16-byte alignment.

Patch By: Gramner

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

llvm-svn: 330331

6 years ago[Hexagon] Add/fix patterns for 32/64-bit vector compares and logical ops
Krzysztof Parzyszek [Thu, 19 Apr 2018 14:24:31 +0000 (14:24 +0000)]
[Hexagon] Add/fix patterns for 32/64-bit vector compares and logical ops

llvm-svn: 330330

6 years ago[Unittests] Fix plugins test
Mikhail Maltsev [Thu, 19 Apr 2018 14:02:46 +0000 (14:02 +0000)]
[Unittests] Fix plugins test

Summary:
Currently the PluginsTests.LoadPlugin unit test is failing in
LLVM configurations that have LLVM_EXPORT_SYMBOLS_FOR_PLUGINS enabled
because the EnableABIBreakingChecks symbol is missing.

This patch fixes the issue by linking some additional libraries to the
test plugin if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is enabled.

Reviewers: philip.pfaffe

Reviewed By: philip.pfaffe

Subscribers: mgorny, llvm-commits, rogfer01

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

llvm-svn: 330329

6 years ago[Fuzzer] Make InterruptHandler non-blocking for Fuchsia
Petr Hosek [Thu, 19 Apr 2018 14:01:46 +0000 (14:01 +0000)]
[Fuzzer] Make InterruptHandler non-blocking for Fuchsia

The initial naive approach to simulate SIGINT on Fuchsia was to getchar
and look for ETX. This caused the InterruptHandler thread to lock stdin,
preventing musl's exit() from being able to close the stdio descriptors
and complete. This change uses select() instead.

Patch By: aarongreen

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

llvm-svn: 330328

6 years ago[clang-tidy] Fix unused-variable warning.
Haojian Wu [Thu, 19 Apr 2018 13:34:03 +0000 (13:34 +0000)]
[clang-tidy] Fix unused-variable warning.

llvm-svn: 330327

6 years ago[mips] Correct the definitions of the unaligned word memory operation instructions
Simon Dardis [Thu, 19 Apr 2018 13:33:51 +0000 (13:33 +0000)]
[mips] Correct the definitions of the unaligned word memory operation instructions

These instructions lacked the correct predicates, were not marked
as loads and stores and lacked the proper instruction mapping information.

In the case of microMIPS sw(l|r)e (EVA) these instructions were using the load
EVA description.

Reviewers: abeserminji, smaksimovic, atanasyan

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

llvm-svn: 330326

6 years ago[NFC][InstCombine] A few more tests for masked merge add/xor -> or with constant...
Roman Lebedev [Thu, 19 Apr 2018 13:02:17 +0000 (13:02 +0000)]
[NFC][InstCombine] A few more tests for masked merge add/xor -> or with constant mask

llvm-svn: 330325

6 years ago[clang-format] Don't remove empty lines before namespace endings
Krasimir Georgiev [Thu, 19 Apr 2018 13:02:15 +0000 (13:02 +0000)]
[clang-format] Don't remove empty lines before namespace endings

Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 330324

6 years agoLowering x86 adds/addus/subs/subus intrinsics (clang)
Alexander Ivchenko [Thu, 19 Apr 2018 12:15:11 +0000 (12:15 +0000)]
Lowering x86 adds/addus/subs/subus intrinsics (clang)

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations.

Patch by tkrupa

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

llvm-svn: 330323

6 years agoLowering x86 adds/addus/subs/subus intrinsics (llvm part)
Alexander Ivchenko [Thu, 19 Apr 2018 12:13:30 +0000 (12:13 +0000)]
Lowering x86 adds/addus/subs/subus intrinsics (llvm part)

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Patch by tkrupa

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

llvm-svn: 330322

6 years agoRemove file accidentally added in r330320.
Florian Hahn [Thu, 19 Apr 2018 12:09:05 +0000 (12:09 +0000)]
Remove file accidentally added in r330320.

llvm-svn: 330321

6 years ago[IR/BasicBlockTest] Fix asan failure introduced in rL330316.
Florian Hahn [Thu, 19 Apr 2018 12:06:26 +0000 (12:06 +0000)]
[IR/BasicBlockTest] Fix asan failure introduced in rL330316.

The argument has to be deleted after the module containing the function
gets deleted.

llvm-svn: 330320

6 years ago[X86][FMA] Remove FMA reg-reg InstRW scheduler overrides.
Simon Pilgrim [Thu, 19 Apr 2018 11:37:26 +0000 (11:37 +0000)]
[X86][FMA] Remove FMA reg-reg InstRW scheduler overrides.

These are all already handled identically by WriteFMA.

llvm-svn: 330319

6 years ago[X86][BtVer2] Remove 128-bit F16C InstRW overrides.
Simon Pilgrim [Thu, 19 Apr 2018 11:16:33 +0000 (11:16 +0000)]
[X86][BtVer2] Remove 128-bit F16C InstRW overrides.

These are already handled identically by WriteCvtF2F.

llvm-svn: 330318

6 years ago[llvm-exegesis] Fix PfmIssueCountersTable creation
Simon Pilgrim [Thu, 19 Apr 2018 10:59:49 +0000 (10:59 +0000)]
[llvm-exegesis] Fix PfmIssueCountersTable creation

This patch ensures that the pfm issue counter tables are the correct size, accounting for the invalid resource entry at the beginning of the resource tables.

It also fixes an issue with pfm failing to match event counters due to a trailing comma added to all the event names.

I've also added a counter comment to each entry as it helps locate problems with the tables.

Note: I don't have access to a SandyBridge test machine, which is the only model to make use of multiple event counters being mapped to a single resource. I don't know if pfm accepts a comma-seperated list or not, but that is what it was doing.

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

llvm-svn: 330317

6 years ago[BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.
Florian Hahn [Thu, 19 Apr 2018 09:48:07 +0000 (09:48 +0000)]
[BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.

Reviewers: aprantl, vsk, mattd, chandlerc

Reviewed By: aprantl, vsk

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

llvm-svn: 330316

6 years ago[mips] Guard some macro expansions properly
Simon Dardis [Thu, 19 Apr 2018 09:45:04 +0000 (09:45 +0000)]
[mips] Guard some macro expansions properly

Reviewers: atanasyan, abeserminji

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

llvm-svn: 330315

6 years agoAttempt to fix TestMiniDump on windows
Pavel Labath [Thu, 19 Apr 2018 09:38:42 +0000 (09:38 +0000)]
Attempt to fix TestMiniDump on windows

It was failing because the modules names were coming out as
C:\Windows\System32/MSVCP120D.dll (last separator is a forward slash) on
windows.

There are two issues at play here:
- the first problem is that the paths in minidump were being parsed as a
  host path. This meant that on posix systems the whole path was
  interpreted as a file name.
- on windows the path was split into a directory-filename pair
  correctly, but then when it was reconsituted, the last separator ended
  up being a forward slash because SBFileSpec.fullpath was joining them
  with '/' unconditionally.

I fix the first issue by parsing the minidump paths according to the
path syntax of the host which produced the dump, which should make the
test behavior on posix&windows identical. The last path will still be a
forward slash because of the second issue. We should probably fix the
"fullpath" property to do something smarter in the future.

llvm-svn: 330314

6 years ago[ARM] Add some missing FP16 VSEL test cases
Sjoerd Meijer [Thu, 19 Apr 2018 08:21:50 +0000 (08:21 +0000)]
[ARM] Add some missing FP16 VSEL test cases

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

llvm-svn: 330313

6 years agotsan: fix compiler warnings
Dmitry Vyukov [Thu, 19 Apr 2018 07:42:08 +0000 (07:42 +0000)]
tsan: fix compiler warnings

vmaSize is uptr, so we need to print it with %zd.

llvm-svn: 330312

6 years ago[AArch64][AsmParser] NFC: Cleanup parsing of scalar registers.
Sander de Smalen [Thu, 19 Apr 2018 07:35:08 +0000 (07:35 +0000)]
[AArch64][AsmParser] NFC: Cleanup parsing of scalar registers.

Summary:
- Renamed tryParseRegister to tryParseScalarRegister, which
  now returns an OperandMatchResultTy.
- Moved matching of certain aliases into matchRegisterNameAlias.
- Changed type of most 'Reg' variables to 'unsigned'.

This is patch [1/4] in a series to add assembler/disassembler support for
SVE's contiguous LD1 (scalar+scalar) instructions:
- Patch [1/4]: https://reviews.llvm.org/D45687
- Patch [2/4]: https://reviews.llvm.org/D45688
- Patch [3/4]: https://reviews.llvm.org/D45689
- Patch [4/4]: https://reviews.llvm.org/D45690

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro, samparker

Reviewed By: samparker

Subscribers: samparker, llvm-commits, kristof.beyls

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

llvm-svn: 330311

6 years agoOpenBSD add C++ runtime in a driver's standpoint
Dean Michael Berris [Thu, 19 Apr 2018 06:55:30 +0000 (06:55 +0000)]
OpenBSD add C++ runtime in a driver's standpoint

Summary: - Since 6.2 release, on supporters platforms clang is shipped with both libcxx and libcxxabi.

Reviewers: dberris, alekseyshl, EricWF

Reviewed By: dberris

Subscribers: cfe-commits

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

llvm-svn: 330310

6 years ago[RuntimeDebugBuilder] Do not break for 64 bit integers
Tobias Grosser [Thu, 19 Apr 2018 05:38:12 +0000 (05:38 +0000)]
[RuntimeDebugBuilder] Do not break for 64 bit integers

In r330292 this assert was turned incorrectly into an unreachable, but
the correct behavior (thanks Michael) is to assert for anything that is
not 64 bit, but falltrough for 64 bit. I document this in the source
code.

llvm-svn: 330309

6 years ago[X86] Scrub scheduling information for MUL/IMUL on Intel CPUs.
Craig Topper [Thu, 19 Apr 2018 05:34:05 +0000 (05:34 +0000)]
[X86] Scrub scheduling information for MUL/IMUL on Intel CPUs.

This removes a bunch of unnecessary InstRW overrides. It also cleans up the missing information from the Sandy Bridge model. Other fixes to other models.

llvm-svn: 330308

6 years agoSimplify. NFC.
Rafael Espindola [Thu, 19 Apr 2018 03:51:26 +0000 (03:51 +0000)]
Simplify. NFC.

Using getOffset is here was a bit of an overkill. This is being
written and has relocations. This implies it is a .eh_frame or regular
section.

llvm-svn: 330307

6 years agoDon't call getOffset twice. NFC.
Rafael Espindola [Thu, 19 Apr 2018 02:24:28 +0000 (02:24 +0000)]
Don't call getOffset twice. NFC.

Just a bit faster.

llvm-svn: 330306

6 years agoFix test from r330245 on Windows.
Douglas Yung [Wed, 18 Apr 2018 23:58:05 +0000 (23:58 +0000)]
Fix test from r330245 on Windows.

llvm-svn: 330305

6 years ago[CodeGen] Do not push a destructor cleanup for a struct that doesn't
Akira Hatanaka [Wed, 18 Apr 2018 23:33:15 +0000 (23:33 +0000)]
[CodeGen] Do not push a destructor cleanup for a struct that doesn't
have a non-trivial destructor.

This fixes a bug introduced in r328731 where CodeGen emits calls to
synthesized destructors for non-trivial C structs in C++ mode when the
struct passed to EmitCallArg doesn't have a non-trivial destructor.
Under Microsoft's ABI, ASTContext::isParamDestroyedInCallee currently
always returns true, so it's necessary to check whether the struct has a
non-trivial destructor before pushing a cleanup in EmitCallArg.

This fixes PR37146.

llvm-svn: 330304

6 years ago[MS] Fix unprototyped thunk emission for incomplete return types
Reid Kleckner [Wed, 18 Apr 2018 23:21:32 +0000 (23:21 +0000)]
[MS] Fix unprototyped thunk emission for incomplete return types

Fixes PR37161

llvm-svn: 330303

6 years agoImprove LLDB's handling of non-local minidumps
Leonard Mosescu [Wed, 18 Apr 2018 23:10:46 +0000 (23:10 +0000)]
Improve LLDB's handling of non-local minidumps

Normally, LLDB is creating a high-fidelity representation of a live
process, including a list of modules and sections, with the
associated memory address ranges. In order to build the module and
section map LLDB tries to locate the local module image (object file)
and will parse it.

This does not work for postmortem debugging scenarios where the crash
dump (minidump in this case) was captured on a different machine.

Fortunately the minidump format encodes enough information about
each module's memory range to allow us to create placeholder modules.
This enables most LLDB functionality involving address-to-module
translations.

Also, we may want to completly disable the search for matching
local object files if we load minidumps unless we can prove that the
local image matches the one from the crash origin.
(not part of this change, see: llvm.org/pr35193)

Example: Identify the module from a stack frame PC:

Before:
  thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14
    frame #0: 0x00164d14
    frame #1: 0x00167c79
    frame #2: 0x00167e6d
    frame #3: 0x7510336a
    frame #4: 0x77759882
    frame #5: 0x77759855

After:
  thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14
    frame #0: 0x00164d14 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #1: 0x00167c79 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #2: 0x00167e6d C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #3: 0x7510336a C:\Windows\SysWOW64\kernel32.dll
    frame #4: 0x77759882 C:\Windows\SysWOW64\ntdll.dll
    frame #5: 0x77759855 C:\Windows\SysWOW64\ntdll.dll

Example: target modules list

Before:
error: the target has no associated executable images

After:
[ 0] C:\Windows\System32\MSVCP120D.dll
[ 1] C:\Windows\SysWOW64\kernel32.dll
[ 2] C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
[ 3] C:\Windows\System32\MSVCR120D.dll
[ 4] C:\Windows\SysWOW64\KERNELBASE.dll
[ 5] C:\Windows\SysWOW64\ntdll.dll

NOTE: the minidump format also includes the debug info GUID, so we can
fill-in the module UUID from it, but this part was excluded from this change
to keep the changes simple (the LLDB UUID is hardcoded to be either 16 or
20 bytes, while the CodeView GUIDs are normally 24 bytes)

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

llvm-svn: 330302

6 years agoFix data race in X86FloatingPoint.cpp ASSERT_SORTED
Bob Haarman [Wed, 18 Apr 2018 23:04:09 +0000 (23:04 +0000)]
Fix data race in X86FloatingPoint.cpp ASSERT_SORTED

Summary:
ASSERT_SORTED checks if a table is sorted, and uses a boolean to
prevent the check from being run again if it was earlier determined
that the table is in fact sorted. Unsynchronized reads and writes of
that boolean triggered ThreadSanitizer's data race detection. This
change rewrites the code to use std::atomic<bool> instead.

Fixes PR36922.

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 330301

6 years ago[COFF] Mark images with no exception handlers for /safeseh
Reid Kleckner [Wed, 18 Apr 2018 22:37:10 +0000 (22:37 +0000)]
[COFF] Mark images with no exception handlers for /safeseh

Summary:
DLLs and executables with no exception handlers need to be marked with
IMAGE_DLL_CHARACTERISTICS_NO_SEH, even if they have a load config.

Discovered here when building Chromium with LLD on Windows:
https://crbug.com/833951

Reviewers: ruiu, mstorsjo

Subscribers: llvm-commits

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

llvm-svn: 330300

6 years ago[OpenMP] Compilation error fix on const char*
Heejin Ahn [Wed, 18 Apr 2018 22:23:31 +0000 (22:23 +0000)]
[OpenMP] Compilation error fix on const char*

Summary:
This line
(https://github.com/llvm-mirror/openmp/blob/0ed912c7a798f5c4f65f8bb6b492e07fab7f4cea/runtime/src/kmp_gsupport.cpp#L1459)
added in D45327 (rL330282) causes a compilation failure.

Reviewers: jlpeyton

Subscribers: guansong, openmp-commits

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

llvm-svn: 330299

6 years ago[X86] Correct the Defs, Uses, hasSideEffects, mayLoad, mayStore for XCHG and XADD...
Craig Topper [Wed, 18 Apr 2018 22:07:53 +0000 (22:07 +0000)]
[X86] Correct the Defs, Uses, hasSideEffects, mayLoad, mayStore for XCHG and XADD instructions.

I don't think we emit any of these from codegen except for using XCHG16ar as 2 byte NOP.

llvm-svn: 330298

6 years ago[HWASan] Add "N" suffix to generic __hwasan_load/store.
Alex Shlyapnikov [Wed, 18 Apr 2018 22:05:18 +0000 (22:05 +0000)]
[HWASan] Add "N" suffix to generic __hwasan_load/store.

Summary:
"N" suffix is added by the instrumentation and interface functions
are expected to be exported from the library as __hwasan_loadN* and
__hwasan_storeN*.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330297

6 years ago[NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.
Artem Belevich [Wed, 18 Apr 2018 21:51:48 +0000 (21:51 +0000)]
[NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.

The new instructions were added added for sm_70+ GPUs in CUDA-9.1.

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

llvm-svn: 330296

6 years ago[llvm-mca][X86] Add mmx versions of SSSE3 instructions
Simon Pilgrim [Wed, 18 Apr 2018 20:47:48 +0000 (20:47 +0000)]
[llvm-mca][X86] Add mmx versions of SSSE3 instructions

Move PABS instructions incorrectly tested under SSE2

llvm-svn: 330295

6 years ago[RISCV] Add test changes missed from rL330293
Alex Bradbury [Wed, 18 Apr 2018 20:36:12 +0000 (20:36 +0000)]
[RISCV] Add test changes missed from rL330293

llvm-svn: 330294

6 years ago[RISCV] Introduce pattern for materialising immediates with 0 for lower 12 bits
Alex Bradbury [Wed, 18 Apr 2018 20:34:23 +0000 (20:34 +0000)]
[RISCV] Introduce pattern for materialising immediates with 0 for lower 12 bits

These immediates can be materialised with just an lui, rather than an lui+addi
pair.

llvm-svn: 330293

6 years ago[RuntimeDebugBuilder] Print vectors passed without withspaces
Tobias Grosser [Wed, 18 Apr 2018 20:28:26 +0000 (20:28 +0000)]
[RuntimeDebugBuilder] Print vectors passed without withspaces

Originally the RuntimeDebugBuilder printed vectors with withspaces
between the elements. This historic use is meanwhile gone, but the
functionality is still available.

We now change the behavior to print elements just one after the other
without adding white spaces in between. This is useful for D45743, an
upcoming commmit, which also adds test coverage for this feature.

In general, printing elements of a vector directly is more generic as
it allows uses where no white-spaces are desired. Specifically, it
allows the user to build vectors of items to be printed where their
length is only known at run-time.

llvm-svn: 330292

6 years ago[RISCV] Add imm-cse.ll test case
Alex Bradbury [Wed, 18 Apr 2018 20:25:07 +0000 (20:25 +0000)]
[RISCV] Add imm-cse.ll test case

This test case demonstrates that common subexpression elimination takes place
between code sequences for materialising constants. In particular, it
demonstrates that redundant lui aren't generated. This would capture a
regression if applying a patch such as D41949.

llvm-svn: 330291

6 years ago[NFC] test case clean up
Lei Huang [Wed, 18 Apr 2018 20:22:26 +0000 (20:22 +0000)]
[NFC] test case clean up

1. remove redundant tests
2. update XForm_tests to generated expected code gen

llvm-svn: 330290

6 years ago[RuntimeDebugBuilder] Turn assert into an unreachable
Tobias Grosser [Wed, 18 Apr 2018 20:18:43 +0000 (20:18 +0000)]
[RuntimeDebugBuilder] Turn assert into an unreachable

llvm-svn: 330289

6 years ago[RISCV] Expand codegen -> compression sanity checks and move to a single file
Alex Bradbury [Wed, 18 Apr 2018 20:17:29 +0000 (20:17 +0000)]
[RISCV] Expand codegen -> compression sanity checks and move to a single file

The objdump tests interfere with update_llc_test_checks.py and can't be
automatically update them. Put the sanitify check for compression on the
codegen codepath into a separate file, and expand it to also include tests of
integer materialisation. This would catch changes such as those triggered by
D41949.

llvm-svn: 330288

6 years ago[X86] Fix the Uses/Defs,mayLoad,mayStore,hasSideEffects flags for the CMPXCHG instruc...
Craig Topper [Wed, 18 Apr 2018 20:15:00 +0000 (20:15 +0000)]
[X86] Fix the Uses/Defs,mayLoad,mayStore,hasSideEffects flags for the CMPXCHG instructions.

The compiler only emits the locked version of these which use different instruction definitions. The versions fixed here are only used by the assembler/disassembler.

llvm-svn: 330287

6 years agoadd extra acronyms for objc property names
Yan Zhang [Wed, 18 Apr 2018 20:09:10 +0000 (20:09 +0000)]
add extra acronyms for objc property names

Summary: This is to support general acronyms in Objective-C like 2G/3G/4G/... and coordinates X, Y, Z and W.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

llvm-svn: 330286

6 years ago[ScopDetect / ScopInfo] Get statistics for scops without any loop correctly
Tobias Grosser [Wed, 18 Apr 2018 20:03:36 +0000 (20:03 +0000)]
[ScopDetect / ScopInfo] Get statistics for scops without any loop correctly

Make sure we also counts scops not containing any loops.

llvm-svn: 330285

6 years ago[OPENMP] Fix -Wunused-lambda-capture. NFC
Fangrui Song [Wed, 18 Apr 2018 19:32:01 +0000 (19:32 +0000)]
[OPENMP] Fix -Wunused-lambda-capture. NFC

llvm-svn: 330284

6 years ago[OpenMP] Fix affinity API for KMP_AFFINITY=none|compact|scatter
Jonathan Peyton [Wed, 18 Apr 2018 19:25:48 +0000 (19:25 +0000)]
[OpenMP] Fix affinity API for KMP_AFFINITY=none|compact|scatter

Currently, the affinity API reports garbage for the initial place list and any
thread's place lists when using KMP_AFFINITY=none|compact|scatter.
This patch does two things:

for KMP_AFFINITY=none, Creates a one entry table for the places, this way, the
initial place list is just a single place with all the proc ids in it. We also
set the initial place of any thread to 0 instead of KMP_PLACE_ALL so that the
thread reports that single place (place 0) instead of garbage (-1) when using
the affinity API.

When non-OMP_PROC_BIND affinity is used
(including KMP_AFFINITY=compact|scatter), a thread's place list is populated
correctly. We assume that each thread is assigned to a single place. This is
implemented in two of the affinity API functions

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

llvm-svn: 330283

6 years agoIntroduce GOMP_taskloop API
Jonathan Peyton [Wed, 18 Apr 2018 19:23:54 +0000 (19:23 +0000)]
Introduce GOMP_taskloop API

This patch introduces GOMP_taskloop to our API. It adds GOMP_4.5 to our
version symbols. Being a wrapper around __kmpc_taskloop, the function
creates a task with the loop bounds properly nested in the shareds so that
the GOMP task thunk will work properly. Also, the firstprivate copy constructors
are properly handled using the __kmp_gomp_task_dup() auxiliary function.

Currently, only linear spawning of tasks is supported
for the GOMP_taskloop interface.

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

llvm-svn: 330282

6 years agoRevert "[RISCV] implement li pseudo instruction"
Alex Bradbury [Wed, 18 Apr 2018 19:02:31 +0000 (19:02 +0000)]
Revert "[RISCV] implement li pseudo instruction"

Reverts rL330224, while issues with the C extension and missed common
subexpression elimination opportunities are addressed. Neither of these issues
are visible in current RISC-V backend unit tests, which clearly need
expanding.

llvm-svn: 330281

6 years ago[CUDA] added missing __ldg(const signed char *)
Artem Belevich [Wed, 18 Apr 2018 18:33:43 +0000 (18:33 +0000)]
[CUDA] added missing __ldg(const signed char *)

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

llvm-svn: 330280

6 years ago[HIP] Add driver input type for HIP
Yaxun Liu [Wed, 18 Apr 2018 18:25:03 +0000 (18:25 +0000)]
[HIP] Add driver input type for HIP

Patch by Greg Rodgers.
Revised by Yaxun Liu.

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

llvm-svn: 330279

6 years ago[Power9]Legalize and emit code for converting Unsigned HWord/Char to Quad-Precision
Lei Huang [Wed, 18 Apr 2018 17:41:46 +0000 (17:41 +0000)]
[Power9]Legalize and emit code for converting Unsigned HWord/Char to Quad-Precision

Legalize and emit code for converting unsigned HWord/Char to QP:

xscvsdqp
xscvudqp

Only covering patterns for unsigned forms cause we don't have part-word
sign-extending integer loads into VSX registers.

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

llvm-svn: 330278

6 years ago[MinGW] Try to fix asan testing after r330244
Martin Storsjo [Wed, 18 Apr 2018 17:34:29 +0000 (17:34 +0000)]
[MinGW] Try to fix asan testing after r330244

Twines shouldn't be stored as they can refer to temporaries.

llvm-svn: 330277

6 years ago[AArch64] Add isel pattern for v8i8->v2f32 NVCASTs.
Amara Emerson [Wed, 18 Apr 2018 17:10:19 +0000 (17:10 +0000)]
[AArch64] Add isel pattern for v8i8->v2f32 NVCASTs.

rdar://39454635

llvm-svn: 330276