platform/upstream/llvm.git
6 years agoFix a crash when resolving overloads of C++ virtual methods.
Adrian Prantl [Fri, 20 Apr 2018 17:14:05 +0000 (17:14 +0000)]
Fix a crash when resolving overloads of C++ virtual methods.

The isOverload() method needs to account for situations where the two
methods being compared don't have the same number of arguments.

rdar://problem/39542960

llvm-svn: 330450

6 years ago[WebAssembly] Implement --print-gc-sections for synthetic functions
Nicholas Wilson [Fri, 20 Apr 2018 17:09:18 +0000 (17:09 +0000)]
[WebAssembly] Implement --print-gc-sections for synthetic functions

Enables cleaning up confusion between which name variables are mangled
and which are unmangled, and --print-gc-sections then excersises and
tests that.

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

llvm-svn: 330449

6 years ago[WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFC
Nicholas Wilson [Fri, 20 Apr 2018 17:07:24 +0000 (17:07 +0000)]
[WebAssembly] Distinguish debug/symbol names in the Wasm structs.  NFC

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

llvm-svn: 330448

6 years ago[CUDA] Set LLVM calling convention for CUDA kernel
Yaxun Liu [Fri, 20 Apr 2018 17:01:03 +0000 (17:01 +0000)]
[CUDA] Set LLVM calling convention for CUDA kernel

Some targets need special LLVM calling convention for CUDA kernel.
This patch does that through a TargetCodeGenInfo hook.

It only affects amdgcn target.

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

llvm-svn: 330447

6 years agoRevert r330431.
Michael Zolotukhin [Fri, 20 Apr 2018 16:57:10 +0000 (16:57 +0000)]
Revert r330431.

There are still stage3/stage4 miscompares :(

llvm-svn: 330446

6 years ago[x86] auto-generate checks; NFC
Sanjay Patel [Fri, 20 Apr 2018 16:46:58 +0000 (16:46 +0000)]
[x86] auto-generate checks; NFC

There's a proposal to change/add to this file in D45653,
so we should know exactly what those differences would be.

llvm-svn: 330445

6 years ago[NewGVN] Split OpPHI detection and creation.
Florian Hahn [Fri, 20 Apr 2018 16:37:13 +0000 (16:37 +0000)]
[NewGVN] Split OpPHI detection and creation.

It also adds a check making sure PHIs for operands are all in the same
block.

Patch by Daniel Berlin <dberlin@dberlin.org>

Reviewers: dberlin, davide

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

llvm-svn: 330444

6 years ago[ELF] --warn-backrefs: use the same GroupId for object files in the same --{start...
Fangrui Song [Fri, 20 Apr 2018 16:33:01 +0000 (16:33 +0000)]
[ELF] --warn-backrefs: use the same GroupId for object files in the same --{start,end}-lib

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 330443

6 years ago[CodeGen] Add an option to suppress output of llvm.ident
Mikhail Maltsev [Fri, 20 Apr 2018 16:29:03 +0000 (16:29 +0000)]
[CodeGen] Add an option to suppress output of llvm.ident

Summary:
By default Clang outputs its version (including git commit hash, in
case of trunk builds) into object and assembly files. It might be
useful to have an option to disable this, especially for debugging
purposes.
This patch implements new command line flags -Qn and -Qy (the names
are chosen for compatibility with GCC). -Qn disables output of
the 'llvm.ident' metadata string and the 'producer' debug info. -Qy
(enabled by default) does the opposite.

Reviewers: faisalv, echristo, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01

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

llvm-svn: 330442

6 years agoFix some tests that were failing on Windows
Hans Wennborg [Fri, 20 Apr 2018 15:33:44 +0000 (15:33 +0000)]
Fix some tests that were failing on Windows

llvm-svn: 330441

6 years ago[DebugInfo] Use WithColor for more debug line warnings
Andrew Ng [Fri, 20 Apr 2018 15:29:47 +0000 (15:29 +0000)]
[DebugInfo] Use WithColor for more debug line warnings

Updated two more debug line related warnings to use WithColor. This was
necessary to ensure consistent output order of the warnings on Windows
for debug line tests.

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

llvm-svn: 330440

6 years ago[CostModel][X86] Add vector element insert/extract cost tests
Simon Pilgrim [Fri, 20 Apr 2018 15:26:59 +0000 (15:26 +0000)]
[CostModel][X86] Add vector element insert/extract cost tests

llvm-svn: 330439

6 years agoFix test by allowing it to accept an upper or lower case letter as the first character.
Douglas Yung [Fri, 20 Apr 2018 15:23:57 +0000 (15:23 +0000)]
Fix test by allowing it to accept an upper or lower case letter as the first character.

Windows for some reason uses a lower case letter, while linux uses upper case.

llvm-svn: 330438

6 years ago[DAGCombine] (float)((int) f) --> ftrunc (PR36617)
Sanjay Patel [Fri, 20 Apr 2018 15:07:55 +0000 (15:07 +0000)]
[DAGCombine] (float)((int) f) --> ftrunc (PR36617)

This was originally committed at rL328921 and reverted at rL329920 to
investigate failures in Chrome. This time I've added to the ReleaseNotes
to warn users of the potential of exposing UB and let me repeat that
here for more exposure:

  Optimization of floating-point casts is improved. This may cause surprising
  results for code that is relying on undefined behavior. Code sanitizers can
  be used to detect affected patterns such as this:

    int main() {
      float x = 4294967296.0f;
      x = (float)((int)x);
      printf("junk in the ftrunc: %f\n", x);
      return 0;
    }

    $ clang -O1 ftrunc.c -fsanitize=undefined ; ./a.out
    ftrunc.c:5:15: runtime error: 4.29497e+09 is outside the range of
                   representable values of type 'int'
    junk in the ftrunc: 0.000000

Original commit message:

fptosi / fptoui round towards zero, and that's the same behavior as ISD::FTRUNC,
so replace a pair of casts with the equivalent node. We don't have to account for
special cases (NaN, INF) because out-of-range casts are undefined.

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

llvm-svn: 330437

6 years ago[CostModel][X86] Add srem/urem constant cost tests
Simon Pilgrim [Fri, 20 Apr 2018 15:01:03 +0000 (15:01 +0000)]
[CostModel][X86] Add srem/urem constant cost tests

llvm-svn: 330436

6 years ago[CostModel][X86] Add SLM/GLM/BtVer2 compare + division/remainder cost tests
Simon Pilgrim [Fri, 20 Apr 2018 14:50:34 +0000 (14:50 +0000)]
[CostModel][X86] Add SLM/GLM/BtVer2 compare + division/remainder cost tests

llvm-svn: 330435

6 years agoFix typo in a test.
Michael Zolotukhin [Fri, 20 Apr 2018 13:51:36 +0000 (13:51 +0000)]
Fix typo in a test.

llvm-svn: 330434

6 years ago[CostModel][X86] Split off BtVer2 cost checks
Simon Pilgrim [Fri, 20 Apr 2018 13:50:33 +0000 (13:50 +0000)]
[CostModel][X86] Split off BtVer2 cost checks

llvm-svn: 330433

6 years ago[CostModel][X86] Add GoldmontPlus cost tests
Simon Pilgrim [Fri, 20 Apr 2018 13:42:53 +0000 (13:42 +0000)]
[CostModel][X86] Add GoldmontPlus cost tests

Just reuses goldmont costs atm

llvm-svn: 330432

6 years agoRevert "Revert r330403 and r330413."
Michael Zolotukhin [Fri, 20 Apr 2018 13:34:32 +0000 (13:34 +0000)]
Revert "Revert r330403 and r330413."

Reapply the patches with a fix. Thanks Ilya and Hans for the reproducer!
This reverts commit r330416.

The issue was that removing predecessors invalidated uses that we stored
for rewrite. The fix is to finish manipulating with CFG before we select
uses for rewrite.

llvm-svn: 330431

6 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Fri, 20 Apr 2018 13:26:03 +0000 (13:26 +0000)]
[docs] Regenerate command line reference

This will correctly sort some manually added entries which should
generally be avoided!

llvm-svn: 330430

6 years ago[OpenMP] Hide -fopenmp-cuda-mode
Jonas Hahnfeld [Fri, 20 Apr 2018 13:25:59 +0000 (13:25 +0000)]
[OpenMP] Hide -fopenmp-cuda-mode

This is an advanced flag that should show up neither in clang --help
nor in the ClangCommandLineReference.

llvm-svn: 330429

6 years ago[X86][BtVer2] Cleanup some old FIXMEs from the model. NFCI.
Simon Pilgrim [Fri, 20 Apr 2018 13:12:04 +0000 (13:12 +0000)]
[X86][BtVer2] Cleanup some old FIXMEs from the model. NFCI.

llvm-svn: 330428

6 years agoclang-cl: Accept (and ignore) /Zc:__cplusplus.
Nico Weber [Fri, 20 Apr 2018 13:10:44 +0000 (13:10 +0000)]
clang-cl: Accept (and ignore) /Zc:__cplusplus.

See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
clang-cl already sets __cplusplus to the correct value, so we can just ignore this flag.

Also add test coverage for a few more accepted-but-ignored flags.

https://reviews.llvm.org/D45877

llvm-svn: 330427

6 years ago[CUDA] Document recent changes
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:54 +0000 (13:04 +0000)]
[CUDA] Document recent changes

 * Finding installations via ptxas binary
 * Relocatable device code

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

llvm-svn: 330426

6 years ago[CUDA] Register relocatable GPU binaries
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:45 +0000 (13:04 +0000)]
[CUDA] Register relocatable GPU binaries

nvcc generates a unique registration function for each object file
that contains relocatable device code. Unique names are achieved
with a module id that is also reflected in the function's name.

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

llvm-svn: 330425

6 years ago[X86] Tag CLDEMOTE instruction with WriteLoad scheduling class
Simon Pilgrim [Fri, 20 Apr 2018 12:54:53 +0000 (12:54 +0000)]
[X86] Tag CLDEMOTE instruction with WriteLoad scheduling class

Same as other cacheline instructions

llvm-svn: 330424

6 years ago[AArch64][SVE] Asm: Support for contiguous LD1 (scalar+scalar) load instructions.
Sander de Smalen [Fri, 20 Apr 2018 12:52:01 +0000 (12:52 +0000)]
[AArch64][SVE] Asm: Support for contiguous  LD1 (scalar+scalar) load instructions.

This is patch [4/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

Reviewed By: fhahn

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

llvm-svn: 330423

6 years ago[Driver] Support for -save-stats in AddGoldPlugin.
Florian Hahn [Fri, 20 Apr 2018 12:50:10 +0000 (12:50 +0000)]
[Driver] Support for -save-stats in AddGoldPlugin.

This patch updates AddGoldPlugin to pass stats-file to the Gold plugin,
if -save-stats is passed. It also moves the save-stats option handling
to a helper function tools::getStatsFileName.

Reviewers: tejohnson, mehdi_amini, compnerd

Reviewed By: tejohnson, compnerd

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

llvm-svn: 330422

6 years ago[ObjectYAML] Add ability for DWARFYAML to calculate DIE lengths
Jonas Devlieghere [Fri, 20 Apr 2018 12:33:49 +0000 (12:33 +0000)]
[ObjectYAML] Add ability for DWARFYAML to calculate DIE lengths

This patch adds the ability for the ObjectYAML DWARFEmitter to calculate
the lengths of DIEs. This is accomplished by creating a DIEFixupVisitor
class which traverses the DWARF DIEs to calculate and fix up the lengths
in the Compile Unit header.

The DIEFixupVisitor can be extended in the future to enable more complex
fix ups which will enable simplified YAML string representations.

This is also very useful when using the YAML format in unit tests
because you no longer need to know the length of the compile unit when
writing the YAML string.

Differential commandeered from Chris Bieneman (beanz)

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

llvm-svn: 330421

6 years ago[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16...
Ivan A. Kosarev [Fri, 20 Apr 2018 12:09:25 +0000 (12:09 +0000)]
[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16() intrinsics

Related differential revision: https://reviews.llvm.org/D45668

llvm-svn: 330420

6 years ago[UpdateTestChecks] Fix update_mca_test_checks.py slowness issue
Greg Bedwell [Fri, 20 Apr 2018 11:38:11 +0000 (11:38 +0000)]
[UpdateTestChecks] Fix update_mca_test_checks.py slowness issue

The script was using Python's difflib module to calculate the number of
lines changed so that it could report it in its status output.  It turns
out this can be very very slow on large sets of lines (Python bug 6931).
It's not worth the cost, so just remove the usage of difflib entirely.

llvm-svn: 330419

6 years agoParse .h files as objective-c++ if we don't have a compile command.
Sam McCall [Fri, 20 Apr 2018 11:35:17 +0000 (11:35 +0000)]
Parse .h files as objective-c++ if we don't have a compile command.

Summary: This makes C++/objC not totally broken, without hurting C files too much.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 330418

6 years agoRequire asserts for stats-file-option tests.
Florian Hahn [Fri, 20 Apr 2018 11:21:13 +0000 (11:21 +0000)]
Require asserts for stats-file-option tests.

llvm-svn: 330417

6 years agoRevert r330403 and r330413.
Ilya Biryukov [Fri, 20 Apr 2018 10:52:54 +0000 (10:52 +0000)]
Revert r330403 and r330413.

Revert r330413: "[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites."
Revert r330403 "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time."

r330403 commit seems to crash clang during our integrate while doing PGO build with the following stacktrace:
      #2 llvm::SSAUpdaterBulk::RewriteAllUses(llvm::DominatorTree*, llvm::SmallVectorImpl<llvm::PHINode*>*)
      #3 llvm::JumpThreadingPass::ThreadEdge(llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::BasicBlock*)
      #4 llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*, llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
      #5 llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
The crash happens while compiling 'lib/Analysis/CallGraph.cpp'.

r3340413 is reverted due to conflicting changes.

llvm-svn: 330416

6 years ago[NFC][InstCombine] Regenerate two tests that are affected by folding masked merge
Roman Lebedev [Fri, 20 Apr 2018 10:49:19 +0000 (10:49 +0000)]
[NFC][InstCombine] Regenerate two tests that are affected by folding masked merge

llvm-svn: 330415

6 years ago[DebugInfo] Fix for split dwarf test on Windows (NFC)
Andrew Ng [Fri, 20 Apr 2018 10:44:42 +0000 (10:44 +0000)]
[DebugInfo] Fix for split dwarf test on Windows (NFC)

On Windows, %llc_dwarf automatically adds -mtriple causing this test to
error. Changed %llc_dwarf to llc.

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

llvm-svn: 330414

6 years ago[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites.
Michael Zolotukhin [Fri, 20 Apr 2018 10:31:06 +0000 (10:31 +0000)]
[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites.

llvm-svn: 330413

6 years ago[Dockerfiles] Split checkout and build scripts into separate files.
Ilya Biryukov [Fri, 20 Apr 2018 10:19:38 +0000 (10:19 +0000)]
[Dockerfiles] Split checkout and build scripts into separate files.

Summary:
This is a small refactoring to extract the svn checkout code from the
build script used inside the docker image.
This would give more flexibility if more than a single invocation of
cmake is needed inside the docker image.

User-facing interface (build_docker_image.sh) hasn't changed, only the
internal scripts running inside the build container are affected.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 330412

6 years ago[LTO] Add stats-file option to LTO/Config.h.
Florian Hahn [Fri, 20 Apr 2018 10:18:36 +0000 (10:18 +0000)]
[LTO] Add stats-file option to LTO/Config.h.

This patch adds a StatsFile option to LTO/Config.h and updates both
LLVMGold and llvm-lto2 to set it.

Reviewers: MatzeB, tejohnson, espindola

Reviewed By: tejohnson

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

llvm-svn: 330411

6 years agoCODE_OWNERS: Take code ownership of llvm-mca.
Andrea Di Biagio [Fri, 20 Apr 2018 10:16:31 +0000 (10:16 +0000)]
CODE_OWNERS: Take code ownership of llvm-mca.

llvm-svn: 330410

6 years ago[lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit
Dan Liew [Fri, 20 Apr 2018 10:11:41 +0000 (10:11 +0000)]
[lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit
XML printer.

A test has been added that tries to comprehensively test emitting
XUnit XML output for shell tests.

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

llvm-svn: 330409

6 years agoFix -Wunused-variable warnings after r330377.
Andrea Di Biagio [Fri, 20 Apr 2018 09:47:03 +0000 (09:47 +0000)]
Fix -Wunused-variable warnings after r330377.

llvm-svn: 330408

6 years ago[AArch64][SVE] Fix diagnostic for SVE LD4 instructions:
Sander de Smalen [Fri, 20 Apr 2018 09:45:50 +0000 (09:45 +0000)]
[AArch64][SVE] Fix diagnostic for SVE LD4 instructions:

Diagnostic:
  'index must be multiple of 3 in range [-32, 28]'

Must be:
  'index must be multiple of 4 in range [-32, 28]'

llvm-svn: 330407

6 years ago[AArch64][SVE] Added GPR64shifted and GPR64NoXZRshifted register classes.
Sander de Smalen [Fri, 20 Apr 2018 08:54:49 +0000 (08:54 +0000)]
[AArch64][SVE] Added GPR64shifted and GPR64NoXZRshifted register classes.

Summary:
This is patch [3/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

Reviewed By: SjoerdMeijer

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330406

6 years agoMove FileSpecTest to Utility
Pavel Labath [Fri, 20 Apr 2018 08:27:27 +0000 (08:27 +0000)]
Move FileSpecTest to Utility

FileSpec class was moved to the Utility module a while ago, but the test
file was left behind. This corrects that.

llvm-svn: 330405

6 years ago[OpenCL] Add 'denorms-are-zero' function attribute
Alexey Sotkin [Fri, 20 Apr 2018 08:08:04 +0000 (08:08 +0000)]
[OpenCL] Add 'denorms-are-zero' function attribute

Summary:
Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero'
compile option was specified and 'denorms-are-zero'='false' otherwise.

Patch by krisb

Reviewers: Anastasia, yaxunl

Reviewed By:  yaxunl

Subscribers: cfe-commits

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

llvm-svn: 330404

6 years agoReapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
Michael Zolotukhin [Fri, 20 Apr 2018 08:01:08 +0000 (08:01 +0000)]
Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.

Hopefully, changing set to vector removes nondeterminism detected by
some bots, or the new assert will catch something.

This reverts commit r330180.

llvm-svn: 330403

6 years ago[SSAUpdaterBulk] Add an assert.
Michael Zolotukhin [Fri, 20 Apr 2018 07:59:57 +0000 (07:59 +0000)]
[SSAUpdaterBulk] Add an assert.

llvm-svn: 330402

6 years agoAdd SPARC support to update_llc_test_checks.py
Daniel Cederman [Fri, 20 Apr 2018 07:59:13 +0000 (07:59 +0000)]
Add SPARC support to update_llc_test_checks.py

Reviewers: spatel, jyknight

Reviewed By: spatel

Subscribers: fedor.sergeev, llvm-commits

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

llvm-svn: 330401

6 years ago[SSAUpdaterBulk] Add * and & to auto.
Michael Zolotukhin [Fri, 20 Apr 2018 07:58:54 +0000 (07:58 +0000)]
[SSAUpdaterBulk] Add * and & to auto.

llvm-svn: 330400

6 years ago[SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.
Michael Zolotukhin [Fri, 20 Apr 2018 07:57:24 +0000 (07:57 +0000)]
[SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.

llvm-svn: 330399

6 years ago[SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.
Michael Zolotukhin [Fri, 20 Apr 2018 07:56:00 +0000 (07:56 +0000)]
[SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.

llvm-svn: 330398

6 years agoRevert "This pass, fixing an erratum in some LEON 2 processors..."
Daniel Cederman [Fri, 20 Apr 2018 07:53:27 +0000 (07:53 +0000)]
Revert "This pass, fixing an erratum in some LEON 2 processors..."

Summary:
Reading Atmel's AT697E errata document this does not seem like a valid
workaround. While the text only mentions SDIV, it says that the ICC flags
can be wrong, and those are only generated by SDIVcc. Verification on
hardware shows that simply replacing SDIV with SDIVcc does not avoid
the bug with negative operands.

This reverts r283727.

Reviewers: lero_chris, jyknight

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330397

6 years ago[Sparc] Use synthetic instruction clr to zero register instead of sethi
Daniel Cederman [Fri, 20 Apr 2018 07:47:12 +0000 (07:47 +0000)]
[Sparc] Use synthetic instruction clr to zero register instead of sethi

Using `clr reg`/`mov %g0, reg`/`or %g0, %g0, reg` to zero a register
looks much better than `sethi 0, reg`.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330396

6 years agoRevert r330376 "[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into...
Hans Wennborg [Fri, 20 Apr 2018 07:34:59 +0000 (07:34 +0000)]
Revert r330376 "[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC."

This broke the Windows build, see e.g. http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10130

> Differential Revision: https://reviews.llvm.org/D44246

llvm-svn: 330395

6 years ago[AArch64][AsmParser] Extend RegOp with integrated 'shift/extend'.
Sander de Smalen [Fri, 20 Apr 2018 07:24:20 +0000 (07:24 +0000)]
[AArch64][AsmParser] Extend RegOp with integrated 'shift/extend'.

Summary:
In some cases the shift/extend needs to be explicitly parsed together
with the register, rather than as a separate operand. This is needed
for addressing modes where the instruction as a whole dictates the
scaling/extend, rather than specific bits in the instruction.
By parsing them as a single operand, we avoid the need to pass an
extra operand in all CodeGen patterns (because all operands need to
have an associated value), and we avoid the need to update TableGen to
accept operands that have no associated bits in the instruction.

An added benefit of parsing them together is that the assembler
can give a sensible diagnostic if the scaling is not correct.

This is patch [2/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

Reviewed By: fhahn, SjoerdMeijer

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 330394

6 years agoAMDGPU: Legalize the operand of SI_INIT_M0
Nicolai Haehnle [Fri, 20 Apr 2018 07:14:25 +0000 (07:14 +0000)]
AMDGPU: Legalize the operand of SI_INIT_M0

Summary:
This fixes a case where the argument to a sendmsg intrinsic
ends up in a VGPR, for whatever reason.

The underlying performance issue is that a multiplication that
can be an s_mul_i32 is instead needlessly generated as
v_mul_u32_u24, but this is not addressed by this patch.

Change-Id: I61fd4034314d5acdf6074632c30b65364dfa7328

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 330393

6 years ago[Sparc] Fix addressing mode when using 64-bit values in inline assembly
Daniel Cederman [Fri, 20 Apr 2018 06:57:49 +0000 (06:57 +0000)]
[Sparc] Fix addressing mode when using 64-bit values in inline assembly

Summary:
If a 64-bit register is used as an operand in inline assembly together
with a memory reference, the memory addressing will be wrong. The
addressing will be a single reg, instead of reg+reg or reg+imm. This
will generate a bad offset value or an exception in printMemOperand().

For example:

```
long long int val = 5;
long long int mem;
__asm__ volatile ("std %1, %0":"=m"(mem):"r"(val));
```
becomes:

```
std %i0, [%i2+589833]
```

The problem is that SelectInlineAsmMemoryOperand() is never called for
the memory references if one of the operands is a 64-bit register.
By calling SelectInlineAsmMemoryOperands() in tryInlineAsm() the Sparc
version of  SelectInlineAsmMemoryOperand() gets called for each memory
reference.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330392

6 years ago[LibFuzzer] Report when custom counters are available.
Dan Liew [Fri, 20 Apr 2018 06:46:19 +0000 (06:46 +0000)]
[LibFuzzer] Report when custom counters are available.

This upstreams a feature from the JFS solver's fork of LibFuzzer.

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

llvm-svn: 330391

6 years ago[LibFuzzer] Try to unbreak the `FuzzerMutate.ShuffleBytes1` unit test.
Dan Liew [Fri, 20 Apr 2018 06:46:14 +0000 (06:46 +0000)]
[LibFuzzer] Try to unbreak the `FuzzerMutate.ShuffleBytes1` unit test.

This test is failing on my Linux box. Just increasing the number of
iterations works around this. The divergence is likely due to
our reliance on `std::shuffle()` which is not guaranteed to have
the same behaviour across platforms.

This is a strong argument for us to implement our own shuffle
function to avoid divergence in behaviour across platforms.

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

llvm-svn: 330390

6 years ago[LibFuzzer] Unbreak the `trace-malloc-unbalanced.test` when using Python 3.
Dan Liew [Fri, 20 Apr 2018 06:46:09 +0000 (06:46 +0000)]
[LibFuzzer] Unbreak the `trace-malloc-unbalanced.test` when using Python 3.

The `unbalanced_allocs.py` script uses Python 2 print statement
and `iteritems()`. Running `2to3` over the script fixes these.

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

llvm-svn: 330389

6 years agoFix build failures for r330387 on buildbots that don't build the X86 target
Vlad Tsyrklevich [Fri, 20 Apr 2018 02:26:12 +0000 (02:26 +0000)]
Fix build failures for r330387 on buildbots that don't build the X86 target

llvm-svn: 330388

6 years agoLowerTypeTests: Propagate symver directives
Vlad Tsyrklevich [Fri, 20 Apr 2018 01:36:48 +0000 (01:36 +0000)]
LowerTypeTests: Propagate symver directives

Summary:
This change fixes https://crbug.com/834474, a build failure caused by
LowerTypeTests not preserving .symver symbol versioning directives for
exported functions. Emit symver information to ThinLTO summary data and
then propagate symver directives for exported functions to the merged
module.

Emitting symver information to the summaries increases the size of
intermediate build artifacts for a Chromium build by less than 0.2%.

Reviewers: pcc

Reviewed By: pcc

Subscribers: tejohnson, mehdi_amini, eraman, llvm-commits, eugenis, kcc

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

llvm-svn: 330387

6 years agoFix trap instruction on pp64.
Rafael Espindola [Fri, 20 Apr 2018 01:21:24 +0000 (01:21 +0000)]
Fix trap instruction on pp64.

The test was passing on a big endian host, but just because od with x4
was compensating for it.

llvm-svn: 330386

6 years ago[DWARFASTParserClang] Remove dead code. NFCI.
Davide Italiano [Fri, 20 Apr 2018 00:44:33 +0000 (00:44 +0000)]
[DWARFASTParserClang] Remove dead code. NFCI.

llvm-svn: 330385

6 years agoMove a dump() implementation out of line.
Amara Emerson [Fri, 20 Apr 2018 00:42:46 +0000 (00:42 +0000)]
Move a dump() implementation out of line.

Fixes some link issues.

llvm-svn: 330384

6 years ago[Fuzzer] Add a missing header in Fuchsia implementation
Petr Hosek [Fri, 20 Apr 2018 00:41:06 +0000 (00:41 +0000)]
[Fuzzer] Add a missing header in Fuchsia implementation

This is needed for fd_set.

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

llvm-svn: 330383

6 years ago[CFG] [analyzer] Add construction contexts for loop condition variables.
Artem Dergachev [Thu, 19 Apr 2018 23:30:15 +0000 (23:30 +0000)]
[CFG] [analyzer] Add construction contexts for loop condition variables.

Loop condition variables, eg.

  while (shared_ptr<int> P = getIntPtr()) { ... })

weren't handled in r324794 because they don't go through the common
CFGBuilder::VisitDeclStmt method. Which means that they regressed
after r324800.

Fix the regression by duplicating the necessary construction context scan in
the loop visiting code.

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

llvm-svn: 330382

6 years ago[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
Artem Dergachev [Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)]
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.

If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

llvm-svn: 330380

6 years ago[ELF] Increase NextGroupId with --end-group
Fangrui Song [Thu, 19 Apr 2018 23:23:23 +0000 (23:23 +0000)]
[ELF] Increase NextGroupId with --end-group

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 330379

6 years agoImplement proper support for `-falign-functions`
Saleem Abdulrasool [Thu, 19 Apr 2018 23:14:57 +0000 (23:14 +0000)]
Implement proper support for `-falign-functions`

This implements support for the previously ignored flag
`-falign-functions`.  This allows the frontend to request alignment on
function definitions in the translation unit where they are not
explicitly requested in code.  This is compatible with the GCC behaviour
and the ICC behaviour.

The scalar value passed to `-falign-functions` aligns functions to a
power-of-two boundary.  If flag is used, the functions are aligned to
16-byte boundaries.  If the scalar is specified, it must be an integer
less than or equal to 4096.  If the value is not a power-of-two, the
driver will round it up to the nearest power of two.

llvm-svn: 330378

6 years ago[CFG] [analyzer] Don't treat argument constructors as temporary constructors.
Artem Dergachev [Thu, 19 Apr 2018 23:09:22 +0000 (23:09 +0000)]
[CFG] [analyzer] Don't treat argument constructors as temporary constructors.

Function argument constructors (that are used for passing objects into functions
by value) are completely unlike temporary object constructors, but we were
treating them as such because they are also wrapped into a CXXBindTemporaryExpr.

This patch adds a partial construction context layer for call argument values,
but doesn't proceed to transform it into an actual construction context yet.
This is tells the clients that we aren't supporting these constructors yet.

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

llvm-svn: 330377

6 years ago[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.
Kuba Mracek [Thu, 19 Apr 2018 23:00:43 +0000 (23:00 +0000)]
[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.

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

llvm-svn: 330376

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