Commit Graph

273774 Commits

Author SHA1 Message Date
Matthew Simpson c253c193dc [SparsePropagation] Use SmallVector for work lists
This patch changes the work lists from std::vector to SmallVector, which
matches the SCCP implementation. This patch also updates some related comments.

llvm-svn: 315373
2017-10-10 21:33:48 +00:00
Jake Ehrlich 70bd75f8d8 [llvm-objcopy] Fix latent bug that allowed some Sections to be improperly cast to StringTableSections
If a Section had Type SHT_STRTAB (which could happen if you had a
.dynstr section) it was possible to cast Section to StringTableSection
and get away with any operation that was supported by SectionBase
without it being noticed. This change makes this bug easier to notice
and fixes it where it occurred. It also made me realize that there was
some duplication of efforts in the loop that calls ::initialize. These
issues are all fixed by this change.

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

llvm-svn: 315372
2017-10-10 21:28:22 +00:00
Rafael Espindola ef421f9c18 Make the ELFObjectFile constructor private.
This forces every user to use the new create method that returns an
Expected. This in turn propagates better error messages.

llvm-svn: 315371
2017-10-10 21:21:16 +00:00
Vlad Tsyrklevich a45919f54d Revert "Classify llvm-cfi-verify."
This reverts commit r315363. It has a simple build failure, but more
importantly I want to confirm that unit tests run in check-all to make
sure that they don't silently break in the future.

llvm-svn: 315370
2017-10-10 21:21:13 +00:00
Dehao Chen 3f56a05ae5 Use the first instruction's count to estimate the funciton's entry frequency.
Summary: In the current implementation, we only have accurate profile count for standalone symbols. For inlined functions, we do not have entry count data because it's not available in LBR. In this patch, we use the first instruction's frequency to estimiate the function's entry count, especially for inlined functions. This may be inaccurate due to debug info in optimized code. However, this is a better estimate than the static 80/20 estimation we have in the current implementation.

Reviewers: tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits, aprantl

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

llvm-svn: 315369
2017-10-10 21:13:50 +00:00
Sanjay Patel b74063d21f [x86] fix prefix typos for CHECK lines; NFC
llvm-svn: 315368
2017-10-10 21:12:47 +00:00
Jan Korous 330f0887d6 Fix indexer crash for default template template parameter value
rdar://33058798

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

llvm-svn: 315367
2017-10-10 21:09:49 +00:00
Richard Smith decaff11aa Add test for regression caused by reverted patch r315251.
llvm-svn: 315366
2017-10-10 21:07:44 +00:00
Craig Topper ad3d03193a [X86] Fix some patterns that select VLX instructions, but were incorrectly also checking presence of BWI instructions.
The EVEX->VEX pass probably obscures this.

llvm-svn: 315365
2017-10-10 21:07:14 +00:00
Rafael Espindola 04e4dbab6b Simplify. NFC.
llvm-svn: 315364
2017-10-10 21:03:46 +00:00
Vlad Tsyrklevich b5488a2281 Classify llvm-cfi-verify.
Summary: Move llvm-cfi-verify into a class in preparation for CFI analysis to come.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315363
2017-10-10 20:59:08 +00:00
Simon Dardis b994128d14 [mips] Correct the instruction predicates for microMIPSr3
Rather than using the AdditionalPredicates mechanism to guard
the microMIPS instructions, use the existing predicates to properly
guard those instructions.

This also resolves a case where an instruction pattern was incorrectly
available for microMIPS32R6, which caused a register allocation failure
as the registers specified in the pattern were not available.

Reviewers: nitesh.jain, atanasyan

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

llvm-svn: 315362
2017-10-10 20:52:53 +00:00
Matt Arsenault f42074b699 AMDGPU: Fix missing skipFunction calls
llvm-svn: 315361
2017-10-10 20:48:36 +00:00
Matt Arsenault d674e0ac0d AMDGPU: Fix failure to select branch with optnone
opt-bisect/optnone disable the AMDGPUUniformAnnotateValues pass.
The heuristic in the custom selector for brcond deferred the
branch uniformity check to the pattern, which would fail.

llvm-svn: 315360
2017-10-10 20:34:49 +00:00
Adrian Prantl 3a3ba77ba3 Convert condition to an early exit (NFC).
<rdar://problem/34689604>

llvm-svn: 315359
2017-10-10 20:33:43 +00:00
Guozhi Wei 3625f3efad [CGExprScalar] In EmitCompare trunc the result if it has different type as E->getType()
Usually compare expression should return i1 type, so EmitScalarConversion is called before return

return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType(), E->getExprLoc());

But when ppc intrinsic is called to compare vectors, the ppc intrinsic can return i32 even E->getType() is BoolTy, in this case EmitScalarConversion does nothing, an i32 type result is returned and causes crash later.

This patch detects this case and truncates the result before return.

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

llvm-svn: 315358
2017-10-10 20:31:27 +00:00
Matt Arsenault cc85223f87 AMDGPU: Fix incorrect selection of pseudo-branches
These should only be used if the machine structurizer is enabled.

llvm-svn: 315357
2017-10-10 20:22:07 +00:00
Matthew Simpson e9d85fc8dd [SparseSolver] Rename getLatticeState to getExistingValueState (NFC)
The new name clarifies the function's relation to getValueState. That is,
unlike getValueState, the state of a given value will not be initialized if
it's not already in the map.

llvm-svn: 315356
2017-10-10 20:19:34 +00:00
Matt Morehouse 51e4481cfe Revert "[clang-fuzzer] Allow building without coverage instrumentation."
This reverts r315336 due to build breakage with gcc.
http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/2173

llvm-svn: 315355
2017-10-10 20:13:13 +00:00
Rafael Espindola 12db383e20 Convert two uses of ErrorOr to Expected.
llvm-svn: 315354
2017-10-10 20:00:07 +00:00
Yaxun Liu de4b88d9a1 [AMDGPU] Lower enqueued blocks and generate runtime metadata
This patch adds a post-linking pass which replaces the function pointer of enqueued
block kernel with a global variable (runtime handle) and adds
runtime-handle attribute to the enqueued block kernel.

In LLVM CodeGen the runtime-handle metadata will be translated to
RuntimeHandle metadata in code object. Runtime allocates a global buffer
for each kernel with RuntimeHandel metadata and saves the kernel address
required for the AQL packet into the buffer. __enqueue_kernel function
in device library knows that the invoke function pointer in the block
literal is actually runtime handle and loads the kernel address from it
and puts it into AQL packet for dispatching.

This cannot be done in FE since FE cannot create a unique global variable
with external linkage across LLVM modules. The global variable with internal
linkage does not work since optimization passes will try to replace loads
of the global variable with its initialization value.

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

llvm-svn: 315352
2017-10-10 19:39:48 +00:00
Peter Collingbourne 0f9e889881 Support: On Windows, use CreateFileW to delete files in sys::fs::remove().
This saves a call to stat().

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

llvm-svn: 315351
2017-10-10 19:39:46 +00:00
Roman Lebedev afd049b6a4 [opt-viewer] Don't Decode HTML bytes for Python 2
Summary:
D36624 added some python3 compatibility. But that fix has a problem..

With python2 (which is specified by `#!/usr/bin/env python2.7`), if the env variables do not specify the UTF8,
and the source file is UTF8 (contains non-ASCII symbols), then the `.decode('utf-8')` causes the following exception:
```
Reading YAML files...
Rendering HTML files...
        8 of 41Traceback (most recent call last):
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 277, in <module>
    print_progress)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 213, in generate_report
    should_print_progress)
  File "/build/llvm/tools/opt-viewer/optpmap.py", line 45, in pmap
    result = map(_wrapped_func, func_and_args, *args, **kwargs)
  File "/build/llvm/tools/opt-viewer/optpmap.py", line 25, in _wrapped_func
    return func(argument)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 174, in _render_file
    SourceFileRenderer(source_dir, output_dir, filename).render(remarks)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 125, in render
    self.render_source_lines(self.source_stream, line_remarks)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 79, in render_source_lines
    </tr>'''.format(**locals()), file=self.stream)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 47: ordinal not in range(128)
```
This is similar to https://bugs.llvm.org/show_bug.cgi?id=33548, which was fixed by https://reviews.llvm.org/D37661

Unlike that fix, here, *removing* `.decode('utf-8')` actually fixes it.

Since i assume that the original fix is needed, i simply made
that fix conditional, since for python2 it actually breaks things.

Reviewers: modocache, anemet

Reviewed By: anemet

Subscribers: fhahn, llvm-commits

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

llvm-svn: 315350
2017-10-10 19:34:15 +00:00
Rafael Espindola 8ed1198774 Try to make gcc happy.
llvm-svn: 315349
2017-10-10 19:27:51 +00:00
Rafael Espindola ff9f5f3372 Return Expected from createRTDyldELFObject.
No functionality change, it just makes it easier to use Expected in
Object.

llvm-svn: 315348
2017-10-10 19:14:30 +00:00
Rafael Espindola 563ede149a Simplify. NFC.
llvm-svn: 315347
2017-10-10 19:07:10 +00:00
Jake Ehrlich 36a2eb34ed [llvm-objcopy] Add support for removing sections
This change adds support for removing sections using the -R field (as
GNU objcopy does as well). This change should let us add many helpful
tests and is a proper stepping stone for adding more general kinds of
stripping.

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

llvm-svn: 315346
2017-10-10 18:47:09 +00:00
Jake Ehrlich c5ff72708d Revert "temporary"
I forgot to add a proper commit message. I'm reverting this
to fix that.

This reverts commit r315344.

llvm-svn: 315345
2017-10-10 18:32:22 +00:00
Jake Ehrlich 77ec1ffe5c temporary
llvm-svn: 315344
2017-10-10 18:28:15 +00:00
Jan Vesely 577c52b9c7 travis: enable checks of nvptx libraries
Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315343
2017-10-10 18:10:25 +00:00
Jan Vesely 2601429bac travis: Enable external function call checks on llvm-{4,5}
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315342
2017-10-10 18:10:24 +00:00
Jan Vesely 3d349ea98e Make image builtins r600/llvm-3.9 only
The implementation uses r600 sepcific intrinsics
LLVM-4 switched to _ro_t and _rw_t image types
Portions of the code can be moved back as more targets/llvm versions add image support

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315341
2017-10-10 18:10:21 +00:00
Adrian Prantl 16b8b47152 Debug Info: Fix the SDLoc propagation for a DAGCombiner rule
This patch ensures that the rule:
  fold (zext (load x)) -> (zext (truncate (zextload x)))
propagates the SDLoc of the load to the zextload.

<rdar://problem/33755881>

llvm-svn: 315340
2017-10-10 18:08:32 +00:00
Matt Morehouse 6e5f158642 [clang-fuzzer] Build proto-to-cxx with fuzzer-no-link.
Makes it possible to build with any sanitizer or none at all.

llvm-svn: 315339
2017-10-10 17:59:37 +00:00
Francis Ricci 00284d9497 [lit] Add host_cxx to lit config
Summary: This is required to get the clang version for sanitized builds.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 315338
2017-10-10 17:53:45 +00:00
Francis Ricci 5776f26fa1 [llvm-objdump] Disable leak checking on an llvm-objdump test
Summary:
This leak doesn't reproduce locally on macOS 10.12, but is causing
buildbot failures. Disable leak checking until it can be fixed.

Reviewers: sqlbyme, qcolombet, enderby, bruno

Reviewed By: bruno

Subscribers: bruno, llvm-commits

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

llvm-svn: 315337
2017-10-10 17:50:57 +00:00
Matt Morehouse bb380c3c72 [clang-fuzzer] Allow building without coverage instrumentation.
Summary:
Compile with DummyClangFuzzer.cpp as entry point rather than
libFuzzer's main when coverage instrumentation is missing.

https://llvm.org/pr34314

Reviewers: kcc, bogner, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, mgorny

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

llvm-svn: 315336
2017-10-10 17:41:43 +00:00
Derek Schuff 669300db9c [WebAssembly] Update MCObjectWriter and associated interfaces after r315327
llvm-svn: 315335
2017-10-10 17:31:43 +00:00
Rafael Espindola 97c57b9e7b Don't create a dummy __tls_get_addr.
We just don't need one with the current setup.

We only error on undefined references that are used by some
relocation.

If we managed to relax all uses of __tls_get_addr, no relocation uses
it and we don't produce an error.

This is less code and fixes the case were we fail to relax. Before we
would produce a broken output, but now we produce an error.

llvm-svn: 315334
2017-10-10 17:27:34 +00:00
Francis Ricci 072eff0930 [lit] Only enable LSan on darwin when clang supports it
Summary:
LSan on darwin doesn't exist on older versions of clang,
causing non-boostrapped sanitized buildbots to fail

Reviewers: kubamracek, qcolombet, sqlbyme, zturner, modocache

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 315333
2017-10-10 17:21:32 +00:00
Lang Hames 232cdb48fc [MC] Add another missing <memory> include left out of r315327.
llvm-svn: 315332
2017-10-10 16:59:01 +00:00
Lang Hames 3a67075a3a [MC] Add a missing <memory> include left out of r315327.
llvm-svn: 315331
2017-10-10 16:58:26 +00:00
Hans Wennborg 90ccab6855 For dllexport class templates, export specializations of member functions (PR34849) (take 2)
This is a re-commit of r315025, but making sure to only apply this to
specializations of class template member functions; i.e. not when the function
itself is a template.

llvm-svn: 315330
2017-10-10 16:53:25 +00:00
Bruno Cardoso Lopes 57304923ca Revert "[SCCP] Propagate integer range info for parameters in IPSCCP."
This reverts commit r315288. This is part of fixing segfault introduced
in:

http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/21675/

llvm-svn: 315329
2017-10-10 16:37:57 +00:00
Bruno Cardoso Lopes 122c4b3c8c Revert "[SCCP] Fix mem-sanitizer failure introduced by r315288."
This reverts commit r315294. Part of fixing seg fault introduced in:
http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/21675/

llvm-svn: 315328
2017-10-10 16:37:51 +00:00
Lang Hames 60fbc7cc38 [MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriter
functions.

This makes the ownership of the resulting MCObjectWriter clear, and allows us
to remove one instance of MCObjectStreamer's bizarre "holding ownership via
someone else's reference" trick.

llvm-svn: 315327
2017-10-10 16:28:07 +00:00
Jacob Gravelle 37af00e7d0 [WebAssembly] Narrow the scope of WebAssemblyFixFunctionBitcasts
Summary:
The pass to fix function bitcasts generates thunks for functions that
are called directly with a mismatching signature. It was also generating
thunks in cases where the function was address-taken, causing aliasing
problems in otherwise valid cases.
This patch tightens the restrictions for when the pass runs.

Reviewers: sunfish, dschuff

Subscribers: jfb, sbc100, llvm-commits, aheejin

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

llvm-svn: 315326
2017-10-10 16:20:18 +00:00
Ilya Biryukov 98a1fd7f96 [clangd] Use UniqueFunction for deferred computations.
Previsouly, `std::future` that were results of
`std::async(std::launch::deferred, ...` were used.

llvm-svn: 315325
2017-10-10 16:12:54 +00:00
Ilya Biryukov eab499d31b [clangd] Added missing #includes to Function.h
llvm-svn: 315324
2017-10-10 16:12:50 +00:00
Ilya Biryukov cfcc0d3eb6 [clangd] Added forgotten return in UniqueFunction.
This hasn't bitten us because we only used functions returning
'void'.

llvm-svn: 315323
2017-10-10 16:12:47 +00:00