Commit Graph

256850 Commits

Author SHA1 Message Date
George Rimar 0a7412f00b [ELF] - Implemented -znotext
gold linker manual describes them as:

-z text	Do not permit relocations in read-only segments
-z notext Permit relocations in read-only segments (default)

In LLD default is to not permit them. Patch implements -z notext.

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

llvm-svn: 297366
2017-03-09 08:48:34 +00:00
George Rimar 1c74c2f2a8 [ELF] - Do not try to create .eh_frame_hdr for relocatable output.
.eh_frame_hdr is a header constructed for .eh_frame sections.
We do not proccess .eh_frame when doing relocatable output,
so should not try to create .eh_frame_hdr too.
Previous behavior without this patch is segfault.

Fixes PR32118.

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

llvm-svn: 297365
2017-03-09 08:45:25 +00:00
Ed Schouten e2de03fd7d Fix up the places where AddressSpace.hpp is included.
The AddressSpace.hpp header declares two classes: LocalAddressSpace and
RemoteAddressSpace. These classes are only used in a very small number
of source files, but passed in as template arguments to many other
classes.

Let's go ahead and only include AddressSpace.hpp in source files where
at least one of these two classes is mentioned. This gets rid of a
cyclic header dependency that was already present, but only caused
breakage on macOS until recently.

Reported by:	Marshall Clow

llvm-svn: 297364
2017-03-09 08:04:07 +00:00
Sylvestre Ledru f3e295a781 Remove a useless subsitution in doxygen2rst which was incorrectly replacing * by \*
Summary: For example, "int\* a;" is displayed instead of "int* a;"

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 297363
2017-03-09 06:41:08 +00:00
Adam Nemet 5361b82d54 [SSP] In opt remarks, stream Function directly
With this, it shows up as an attribute in YAML and non-printable characters
are properly removed by GlobalValue::getRealLinkageName.

llvm-svn: 297362
2017-03-09 06:10:27 +00:00
Adam Nemet 8c83386f89 [SLP] Mark values in Dot that need to be extracted
llvm-svn: 297361
2017-03-09 05:48:03 +00:00
Zachary Turner d82067f83a Remove LLDB's recursive directory deletion function.
LLVM now has such a function, so we use that instead.

llvm-svn: 297360
2017-03-09 05:12:36 +00:00
Eric Fiselier 8d409e810a [coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.
Summary:
A `co_await arg` expression has a dependent type whenever the promise type is still dependent, even if the argument to co_await is not. This is because we cannot attempt the `await_transform(<arg>)` until after we know the promise type.

This patch fixes an assertion in the constructor of `DependentCoawaitExpr` that asserted that `arg` must also be dependent.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 297358
2017-03-09 05:01:31 +00:00
Rui Ueyama 7d271ae21d Fix wrong assertion failure.
Previously, if you have foo=bar in a definition file, this assertion
could fire because when symbols are read from file they could be mangled.
It seems that due to historical reasons underscore mangling scheme is
really ad-hoc, and I cannot find a clean way to handle this. I had
to just de-mangle symbols to search again.

llvm-svn: 297357
2017-03-09 04:47:33 +00:00
Gor Nishanov 6dcb0eb301 [coroutines] Build and pass coroutine_handle to await_suspend
Summary:
This patch adds passing a coroutine_handle object to await_suspend calls.
It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()).

(a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch)

Reviewers: GorNishanov

Subscribers: mehdi_amini, cfe-commits, EricWF

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

llvm-svn: 297356
2017-03-09 03:09:43 +00:00
Eric Fiselier 84a2dadcee Disable unsigned integer sanitizer for basic_string::replace(). Patch from tomcherry@google.com
basic_string::replace() has the below line

__sz += __n2 - __n1;

which fails overflow checks if __n1 > __n2, as the negative result
from the subtraction then overflows the original __sz when added to
it.

This behavior is valid as unsigned integer overflow is defined to wrap
around the maximum value and that produces the correct final value for
__sz.  Therefore, we disable this check on this function.

llvm-svn: 297355
2017-03-09 01:54:13 +00:00
Matt Arsenault 9a3fd87523 DAG: Check no signed zeros instead of unsafe math attribute
llvm-svn: 297354
2017-03-09 01:36:39 +00:00
Rui Ueyama bf84c18cc1 Print an error message instead of an assertion failure.
This assertion is failing on a Chromium builder and I cannot figure out why.
This patch let it print out more info.

llvm-svn: 297353
2017-03-09 01:28:50 +00:00
Mehdi Amini 7103b2ecfd Add a cmake cache file for a stage-2 build with ThinLTO
This is intended to be targetted by a Green Dragon stage-2 bot
I'm bringing up currently. WIP.

llvm-svn: 297351
2017-03-09 01:18:31 +00:00
Peter Collingbourne 0152c8156b WholeProgramDevirt: Implement importing for uniform ret val opt.
Differential Revision: https://reviews.llvm.org/D29854

llvm-svn: 297350
2017-03-09 01:11:15 +00:00
Richard Smith 3f57cff1e8 Fix handling of -fmodule-map-file=X where X has no directory component.
llvm-svn: 297349
2017-03-09 00:58:22 +00:00
Konstantin Zhuravlyov d923a35f34 AMDGPU: add missing lit.local.cfg to test/DebugInfo/AMDGPU
llvm-svn: 297334
2017-03-09 00:21:36 +00:00
Peter Collingbourne 6d284fab20 WholeProgramDevirt: Implement importing for single-impl devirtualization.
Differential Revision: https://reviews.llvm.org/D29844

llvm-svn: 297333
2017-03-09 00:21:25 +00:00
Teresa Johnson d820447212 Perform symbol binding for .symver versioned symbols
Summary:
In a .symver assembler directive like:
.symver name, name2@@nodename
"name2@@nodename" should get the same symbol binding as "name".

While the ELF object writer is updating the symbol binding for .symver
aliases before emitting the object file, not doing so when the module
inline assembly is handled by the RecordStreamer is causing the wrong
behavior in *LTO mode.

E.g. when "name" is global, "name2@@nodename" must also be marked as
global. Otherwise, the symbol is skipped when iterating over the LTO
InputFile symbols (InputFile::Symbol::shouldSkip). So, for example,
when performing any *LTO via the gold-plugin, the versioned symbol
definition is not recorded by the plugin and passed back to the
linker. If the object was in an archive, and there were no other symbols
needed from that object, the object would not be included in the final
link and references to the versioned symbol are undefined.

The llvm-lto2 tests added will give an error about an unused symbol
resolution without the fix.

Reviewers: rafael, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 297332
2017-03-09 00:19:49 +00:00
Vedant Kumar 3dea91fec6 Revert "[ubsan] Detect UB loads from bitfields"
This reverts commit r297298. It breaks the self-host on this bot:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio

llvm-svn: 297331
2017-03-09 00:18:53 +00:00
Shoaib Meenai 5e5d8672a7 [libc++] Avoid double defining macro on Windows
Put proper guards around _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS.
No functional change on non-Windows. Avoids incorrect macro redefinition
on Windows.

llvm-svn: 297330
2017-03-09 00:18:00 +00:00
Konstantin Zhuravlyov 9661f40c93 Driver/ToolChains: Remove extra semicolons. NFC
llvm-svn: 297329
2017-03-09 00:14:57 +00:00
Changpeng Fang 1be9b9f816 AMDGPU/SI: Disable unrolling in the loop vectorizer if the loop is not vectorized.
Reviewers:
  arsenm

Differential Revision:
  http://reviews.llvm.org/D30719

llvm-svn: 297328
2017-03-09 00:07:00 +00:00
Evgeniy Stepanov 8537d9994d Don't merge global constants with non-dbg metadata.
!type metadata can not be dropped. An alternative to this is adding
!type metadata from the replaced globals to the replacement, but that
may weaken type tests and make them slower at the same time.

The merged global gets !dbg metadata from replaced globals, and can
end up with multiple debug locations.

llvm-svn: 297327
2017-03-09 00:03:37 +00:00
Anna Zaks 12d0c8d662 [analyzer] Extend taint propagation and checking to support LazyCompoundVal
A patch by Vlad Tsyrklevich!

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

llvm-svn: 297326
2017-03-09 00:01:16 +00:00
Anna Zaks 37faed97c1 [analyzer] Improve usability of ExprInspectionChecker
Some of the magic functions take arguments of arbitrary type. However,
for semantic correctness, the compiler still requires a declaration
of these functions with the correct type. Since C does not have
argument-type-overloaded function, this made those functions hard to
use in C code. Improve this situation by allowing arbitrary suffixes
in the affected magic functions' names, thus allowing the user to
create different declarations for different types.

A patch by Keno Fischer!

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

llvm-svn: 297325
2017-03-09 00:01:10 +00:00
Anna Zaks d4e43ae22a [analyzer] Add bug visitor for taint checker.
Add a bug visitor to the taint checker to make it easy to distinguish where
the tainted value originated. This is especially useful when the original
taint source is obscured by complex data flow.

A patch by Vlad Tsyrklevich!

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

llvm-svn: 297324
2017-03-09 00:01:07 +00:00
Anna Zaks bbec97ca2c [analyzer] Teach the MallocChecker about about Glib API
A patch by Leslie Zhai!

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

llvm-svn: 297323
2017-03-09 00:01:01 +00:00
David Blaikie 9fd16f84c6 Defensively ensure that GetExternalDeclStmt protects itself from nested deserialization
llvm-svn: 297322
2017-03-08 23:57:08 +00:00
Konstantin Zhuravlyov d1ba16e762 [DebugInfo] Add address space when creating DIDerivedTypes
Differential Revision: https://reviews.llvm.org/D29671

llvm-svn: 297321
2017-03-08 23:56:48 +00:00
Konstantin Zhuravlyov d5561e0a0b [DebugInfo] Emit address space with DW_AT_address_class attribute for pointer and reference types
Differential Revision: https://reviews.llvm.org/D29670

llvm-svn: 297320
2017-03-08 23:55:44 +00:00
Jessica Paquette d4cb9c6da0 [Outliner] Fix memory leak in suffix tree.
This commit changes the BumpPtrAllocator for suffix tree nodes to a SpecificBumpPtrAllocator.
Before, node construction was leaking memory because of the DenseMap in SuffixTreeNodes.
Changing this to a SpecificBumpPtrAllocator allows this memory to properly be released.

llvm-svn: 297319
2017-03-08 23:55:33 +00:00
Michael Kruse 935b2a3654 [DeadCodeElim] Put -polly-dce-precise-steps into the Polly category.
llvm-svn: 297318
2017-03-08 23:25:35 +00:00
Javed Absar 382f98733a [ConstantFold] Fix defect in constant folding computation for GEP
When the array indexes are all determined by GVN to be constants,
a call is made to constant-folding to optimize/simplify the address
computation.

The constant-folding, however, makes a mistake in that it sometimes reads
back stale Idxs instead of NewIdxs, that it re-computed in previous iteration.
This leads to incorrect addresses coming out of constant-folding to GEP.
A test case is included. The error is only triggered when indexes have particular
patterns that the stale/new index updates interplay matters.

Reviewers: Daniel Berlin
Differential Revision: https://reviews.llvm.org/D30642

llvm-svn: 297317
2017-03-08 23:01:50 +00:00
Richard Smith a54d32404c Take into account C++17's noexcept function types during merging -- it should
be possible to merge a declaration with an unresolved function type against one
with a resolved function type.

llvm-svn: 297316
2017-03-08 23:00:26 +00:00
Francis Ricci 0504863383 Use correct function signature for strerror_r interceptor
There are two possible return values for strerror_r:

On OS X, the return value is always `int`.
On Linux, the return value can be either `char *` or `int`, depending
on the value of:
`(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE`

Because OS X interceptors require a matching function signature,
split out the two cases into separate interceptors, using the above
information to determine the correct signature for a given build.

llvm-svn: 297315
2017-03-08 22:51:03 +00:00
Zachary Turner 260bda3fbc [Support] Add llvm::sys::fs::remove_directories.
We already have a function create_directories() which can create
an entire tree, and remove() which can remove an empty directory,
but we do not have remove_directories() which can remove an entire
tree.  This patch adds such a function.

Because removing a directory tree can have dangerous consequences
when the tree contains a directory symlink, the patch here updates
the existing directory_iterator construct to optionally not follow
symlinks (previously it would always follow symlinks).  The delete
algorithm uses this flag so that for symlinks, only the links are
removed, and not the targets.

On Windows this is implemented with SHFileOperation, which also
does not recurse into symbolic links or junctions.

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

llvm-svn: 297314
2017-03-08 22:49:32 +00:00
Rafael Espindola 5616adf655 Remove DefinedSynthetic.
With this we have a single section hierarchy. It is a bit less code,
but the main advantage will be in a future patch being able to handle

foo = symbol_in_obj;

in a linker script. Currently that fails since we try to find the
output section of symbol_in_obj.  With this we should be able to just
return an InputSection from the expression.

llvm-svn: 297313
2017-03-08 22:36:28 +00:00
Konstantin Zhuravlyov e37b32c433 Driver/ToolChains: Mips -> MipsLinux
- Mips is architecture, not a toolchain
  - Might help eliminate the confusion in the future by not having header files with the same name

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

llvm-svn: 297312
2017-03-08 22:36:04 +00:00
Alexander Kornienko 5d698cf9a0 [clang-tidy] readability-function-size: remove default param count threshold
llvm-svn: 297311
2017-03-08 22:19:55 +00:00
Jordan Rose 16300aa296 Add red zones to BumpPtrAllocator under ASan
To help catch buffer overruns, this patch changes BumpPtrAllocator to
insert an extra unused byte between allocations when building with
ASan. SpecificBumpPtrAllocator opts out of this behavior, since it
needs to destroy its items later by walking the allocated memory.

Reviewed by Pete Cooper.

llvm-svn: 297310
2017-03-08 21:53:12 +00:00
George Burgess IV ecb95f58a2 [MemCpyOpt] clang-format + trim the legacy pass. NFC.
None of the declarations below `// Helper functions` seem to have
definitions anymore.

llvm-svn: 297309
2017-03-08 21:28:19 +00:00
Laszlo Nagy 908ed4c90a [scan-build-py] move argument parsing into separate module
Forgot to add the new module.

llvm-svn: 297308
2017-03-08 21:22:32 +00:00
Laszlo Nagy 5270bb978f [scan-build-py] move argument parsing into separate module
Differential Revision: https://reviews.llvm.org/D30601

llvm-svn: 297307
2017-03-08 21:18:51 +00:00
Eric Fiselier e05469392e Fix PR32183 - Wrap GCC exception implementation in missing namespace std
llvm-svn: 297306
2017-03-08 20:06:01 +00:00
Rafael Espindola fcd208fdb3 Use uint32_t for alignment in more places, NFC.
llvm-svn: 297305
2017-03-08 19:35:29 +00:00
Tim Northover 7596bd7a27 GlobalISel: correctly handle trivial fcmp predicates.
It makes sense to only do them once in IRTranslator rather than making everyone
deal with them.

llvm-svn: 297304
2017-03-08 18:49:54 +00:00
Adam Nemet 95da05c3f5 [SLP] Visualize SLP trees with -view-slp-tree
Analyzing larger trees is extremely difficult with the current debug output so
this adds GraphTraits and DOTGraphTraits on top of the VectorizableTree data
structure.  We can now display the SLP trees with Graphviz as in
https://reviews.llvm.org/F3132765.

I decorated the graph where a value needs to be gathered for one reason or
another.  These are the red nodes.

There are other improvement I am planning to make as I work through my case
here.  For example, I would also like to mark nodes that need to be extracted.

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

llvm-svn: 297303
2017-03-08 18:47:50 +00:00
Matthew Simpson 3388de1349 [LV] Select legal insert point when fixing first-order recurrences
Because IRBuilder performs constant-folding, it's not guaranteed that an
instruction in the original loop map to an instruction in the vector loop. It
could map to a constant vector instead. The handling of first-order recurrences
was incorrectly making this assumption when setting the IRBuilder's insert
point.

llvm-svn: 297302
2017-03-08 18:18:20 +00:00
Volkan Keles 5698b2ae6e [GlobalISel] Add default action for G_FNEG
Summary: rL297171 introduced G_FNEG for floating-point negation instruction and IRTranslator started to translate `FSUB -0.0, X` to `FNEG X`. This patch adds a default action for G_FNEG to avoid breaking existing targets.

Reviewers: qcolombet, ab, kristof.beyls, t.p.northover, aditya_nandakumar, dsanders

Reviewed By: qcolombet

Subscribers: dberris, rovka, llvm-commits

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

llvm-svn: 297301
2017-03-08 18:09:14 +00:00