Commit Graph

279907 Commits

Author SHA1 Message Date
Sam Clegg 87e61923a4 [WebAssembly] Write out undefined symbol addresses as zero
The addresses of undefined symbols that make it into the final
executable (i.e. weak references to non-existent symbols) should
resolve to zero.

Also, make sure to not include function in the indirect function
table if they are not included in the output.

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

llvm-svn: 322045
2018-01-08 23:39:11 +00:00
Petr Hosek 0f03c79b6d [libcxx] Support the use of compiler-rt in lit tests
Don't link tests against libgcc when compiler-rt is being used.

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

llvm-svn: 322044
2018-01-08 23:36:53 +00:00
Erich Keane ace10a20a6 Document attribute target multiversioning.
Add attribute target multiversioning to the release notes. 
Additionally adds multiversioning support to the attribute
documentation for 'target'.

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

llvm-svn: 322043
2018-01-08 23:36:29 +00:00
Shoaib Meenai c1ca8065b5 [ELF] Small grammar fix. NFC
The whole consists of the parts, not the other way around.

llvm-svn: 322042
2018-01-08 23:18:16 +00:00
Rui Ueyama 0657e5c3f2 Do not use parallelForEach to call maybeCompress().
Currently LLVM's paralellForEach has a problem with reentracy.
That caused https://bugs.llvm.org/show_bug.cgi?id=35788 (lld somtimes
hangs while linking Ruby 2.4) because maybeCompress calls writeTo which
uses paralellForEach.

This patch is to avoid using paralellForEach to call maybeCompress
to workaround the issue.

llvm-svn: 322041
2018-01-08 23:12:42 +00:00
Zachary Turner dc0ba5daff Fix newly failing tests.
These tests started failing because we now properly convert
DefRange records to and from Yaml, but there were some old yaml
files that had incorrect record definitions generated by the
old buggy obj2yaml.  Rather than try to re-generate the yaml files,
it's easier to just remove the records, and they weren't necessary
for the proper execution of the test anyway.

llvm-svn: 322040
2018-01-08 23:07:39 +00:00
Dan Albert 553b09b515 Revert "Make rehash(0) work with ubsan's unsigned-integer-overflow."
Seems to have broken some tests since I first wrote this a while
back. Will reland after checking what went wrong with the tests.

This reverts commit 7023194c8d11a081fd01ed25308b3d60193c6a06.

llvm-svn: 322039
2018-01-08 22:57:12 +00:00
Craig Topper de91dff5d4 [X86] Replace cvt*2mask intrinsics with native IR using 'icmp slt X, zeroinitializer.
llvm-svn: 322038
2018-01-08 22:37:56 +00:00
Craig Topper 53bf4ba69d [X86] Remove GCCBuiltin from int_x86_avx512_cvtb2mask_128 and similar intrinsics.
I'm going to convert these to 'icmp slt X, zeroinitializer' in clang's CGBuiltin.cpp, but the GCCBuiltin names need to be removed to do that.

llvm-svn: 322037
2018-01-08 22:37:49 +00:00
Stefan Pintilie 55bfdd040a [PowerPC] Manually schedule the prologue and epilogue
This patch makes the following changes to the schedule of instructions in the
prologue and epilogue.

The stack pointer update is moved down in the prologue so that the callee saves
do not have to wait for the update to happen.
Saving the lr is moved down in the prologue to hide the latency of the mflr.
The stack pointer is moved up in the epilogue so that restoring of the lr can
happen sooner.
The mtlr is moved up in the epilogue so that it is away form the blr at the end
of the epilogue. The latency of the mtlr can now be hidden by the loads of the
callee saved registers.

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

llvm-svn: 322036
2018-01-08 22:23:10 +00:00
Rafael Espindola d1bd95cf73 Move scanReloc to an auxiliary function.
The body of the in scanRelocs is fairly big. This moves it to its own
function.

It is not a big readability win by itself, but should help further
refactoring.

llvm-svn: 322035
2018-01-08 22:20:44 +00:00
Marshall Clow e426a832dd Apparently 'C++14' is different than 'c++14'
llvm-svn: 322034
2018-01-08 22:16:30 +00:00
Justin Bogner 6f6846fc9d AlwaysInliner: Alow setting InsertLifetime in the new-style pass
llvm-svn: 322033
2018-01-08 22:07:42 +00:00
Shoaib Meenai 8b1378a9a3 [cmake] Pass CMAKE_MAKE_PROGRAM to native configure
If the make program isn't in the path, the native configure will fail.
Pass CMAKE_MAKE_PROGRAM to the native configure explicitly to remedy
this, similar to what's already done for external project configuration.
Explicitly set CMAKE_MAKE_PROGRAM before the user flags so that they can
override it for the native build if they desire (though I can't fathom
why that would be useful).

llvm-svn: 322032
2018-01-08 21:52:58 +00:00
Dan Albert 0802327a39 Make rehash(0) work with ubsan's unsigned-integer-overflow.
Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 322031
2018-01-08 21:49:12 +00:00
Richard Smith 52b36918d6 PR35862: Suppress -Wmissing-variable-declarations warning on inline variables,
variable templates, and instantiations thereof.

llvm-svn: 322030
2018-01-08 21:46:42 +00:00
Zachary Turner 59468f5a1e Fix uninitialized read error reported by MSAN.
The problem was that our Obj -> Yaml dumper had not been taught
to handle certain types of records.  This meant that when I
generated the test input files, the records were still there but
none of its fields were filled out.  So when it did the
Yaml -> Obj conversion as part of the test, it generated records
with garbage in them.

The patch here fixes the Obj <-> Yaml converter, and additionally
updates the test file with fresh Yaml generated by the fixed
converter.

llvm-svn: 322029
2018-01-08 21:38:50 +00:00
Erich Keane 281d20b601 Implement Attribute Target MultiVersioning
GCC's attribute 'target', in addition to being an optimization hint,
also allows function multiversioning. We currently have the former
implemented, this is the latter's implementation.

This works by enabling functions with the same name/signature to coexist,
so that they can all be emitted. Multiversion state is stored in the
FunctionDecl itself, and SemaDecl manages the definitions.
Note that it ends up having to permit redefinition of functions so
that they can all be emitted. Additionally, all versions of the function
must be emitted, so this also manages that.

Note that this includes some additional rules that GCC does not, since
defining something as a MultiVersion function after a usage has been made illegal.

The only 'history rewriting' that happens is if a function is emitted before
it has been converted to a multiversion'ed function, at which point its name
needs to be changed.

Function templates and virtual functions are NOT yet supported (not supported
in GCC either).

Additionally, constructors/destructors are disallowed, but the former is 
planned.

llvm-svn: 322028
2018-01-08 21:34:17 +00:00
Douglas Yung 7ff91421b4 [DOXYGEN] Fix doxygen and content issues in avxintrin.h
- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".
- Fix a few typos and errors found during review.
- Restore new line endings.

This patch was made by Craig Flores

llvm-svn: 322027
2018-01-08 21:21:17 +00:00
Shoaib Meenai 7e3e28f968 [COFF] Delete CanExitEarly
It was being set but never used, and its value is only ever needed
locally in lld::coff::link.

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

llvm-svn: 322026
2018-01-08 21:14:51 +00:00
Justin Bogner 92fe563b57 ArgPromotion: Allow setting MaxElements in the new-style pass
llvm-svn: 322025
2018-01-08 21:13:35 +00:00
Richard Smith a12bf9106a Factor out comparison handling for arithmetic types.
This is not quite NFC: we don't perform the usual arithmetic conversions unless
we have an operand of arithmetic or enumeration type any more. This matches the
standard rule, but actually has no effect other than to marginally improve our
diagnostics for the non-arithmetic, non-enumeration cases (by not performing
integral promotions on one operand if the other is a pointer).

llvm-svn: 322024
2018-01-08 21:12:04 +00:00
Walter Lee 215284d089 [Myriad] Remove invalidated -elf flag for MoviAsm
Summary:
The flag has been deprecated, and is becoming invalid in the latest
MDK.

Reviewers: jyknight

Subscribers: cfe-commits

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

llvm-svn: 322023
2018-01-08 20:36:08 +00:00
Alexey Bataev aee9389b04 [OPENMP] Fix debug info for outlined functions in NVPTX + add more tests.
Fixed name of emitted outlined functions in NVPTX target + extra tests
for the debug info.

llvm-svn: 322022
2018-01-08 20:09:47 +00:00
Billy Robert O'Neal III b6e3c55465 Change add_ten to add_one to avoid triggering ubsan integer overflow.
llvm-svn: 322021
2018-01-08 19:45:16 +00:00
Petar Jovanovic 9f279a4e11 Add lit.local.cfg in test/DebugInfo/MIR/Mips/
Add test/DebugInfo/MIR/Mips/lit.local.cfg so no tests are run if Mips is
not a supported target.
This should resolve buildbot failures seen after r322015.

llvm-svn: 322020
2018-01-08 19:44:03 +00:00
Marshall Clow d835e59211 Add the C++17 extensions to std::search. Include the default searcher, but not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon
llvm-svn: 322019
2018-01-08 19:18:00 +00:00
Alexey Bataev 8ede819858 [OPENMP] Current status of OpenMP support.
Summary: Some info about supported features of OpenMP 4.5-5.0.

Reviewers: hfinkel, rsmith

Subscribers: kkwli0, Hahnfeld, cfe-commits

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

llvm-svn: 322018
2018-01-08 19:02:51 +00:00
Fangrui Song e61045feb3 [index] Return when DC is null in handleReference
Summary:
DC may sometimes be NULL and getContainerInfo(DC, Container) will dereference a null pointer.

Default template arguments (the following example and many test files in https://github.com/nlohmann/json)
may cause null pointer dereference.

```c++
template <typename>
struct actor;

template <template <typename> class Actor = actor>
struct terminal;
```

In tools/libclang/CXIndexDataConsumer.cpp#L203

    handleReference(ND, Loc, Cursor,
                    dyn_cast_or_null<NamedDecl>(ASTNode.Parent),
                    ASTNode.ContainerDC, ASTNode.OrigE, Kind);

`dyn_cast_or_null<NamedDecl>(ASTNode.Parent)` is somehow a null pointer and in tools/libclang/CXIndexDataConsumer.cpp:935

  ContainerInfo Container;
  getContainerInfo(DC, Container);

The null DC is casted `ContInfo.cursor = getCursor(cast<Decl>(DC));` and SIGSEGV.

```

See discussions in https://github.com/jacobdufault/cquery/issues/219 https://github.com/jacobdufault/cquery/issues/192

Reviewers: akyrtzi, sammccall, yvvan

Reviewed By: sammccall

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 322017
2018-01-08 18:57:38 +00:00
Sanjay Patel 7dfe96ad16 [ValueTracking] remove overzealous assert
The test is derived from a failing fuzz test:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5008

Credit to @rksimon for pointing out the problem.

llvm-svn: 322016
2018-01-08 18:31:13 +00:00
Petar Jovanovic e9500ba745 [LiveDebugValues] Change condition for block termination recognition
The last iterator of MBB should be recognized as MBB.end() not as
MBB.instr_end() which could return bundled instruction that is not iterable
with basic iterator.

Patch by Nikola Prica.

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

llvm-svn: 322015
2018-01-08 18:21:15 +00:00
Simon Atanasyan b9efca3257 Check test conditions more precisely. NFC
llvm-svn: 322014
2018-01-08 18:17:25 +00:00
Marshall Clow 86de37aee6 Document upcoming TS feature removal
llvm-svn: 322011
2018-01-08 17:43:46 +00:00
Sanjay Patel 52149f0305 [TargetLibraryInfo] fix finite mathlib function availability
This patch was part of:
https://reviews.llvm.org/D41338
...but we can expose the bug in IR via constant propagation
as shown in the test. Unless the triple includes 'linux', we
should not fold these because the functions don't exist on
other platforms (yet?).

llvm-svn: 322010
2018-01-08 17:38:09 +00:00
Simon Pilgrim 342fa05343 Fixed spelling mistake. NFCI.
llvm-svn: 322009
2018-01-08 17:16:59 +00:00
Adrian McCarthy ce63a925cc Revert "Emit Function IDs table for Control Flow Guard"
The new test fails on the Hexagon bot.  Reverting while I investigate.

This reverts https://reviews.llvm.org/rL322005

This reverts commit b7e0026b4385180c378edc658ec91a39566f2942.

llvm-svn: 322008
2018-01-08 17:12:01 +00:00
Aleksandar Beserminji a734d409c6 [mips] Remove duplicated R6 EVA instructions
This patch removes duplicated EVA instructions in R6.

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

llvm-svn: 322007
2018-01-08 16:50:33 +00:00
Davide Italiano 9a60d2c157 [CVP] Replace incoming values from unreachable blocks with undef.
This is an attempt of fixing PR35807.
Due to the non-standard definition of dominance in LLVM, where uses in
unreachable blocks are dominated by anything, you can have, in an
unreachable block:

  %patatino = OP1 %patatino, CONSTANT

When `SimplifyInstruction` receives a PHI where an incoming value is of
the aforementioned form, in some cases, loops indefinitely.

What I propose here instead is keeping track of the incoming values
from unreachable blocks, and replacing them with undef. It fixes this
case, and it seems to be good regardless (even if we can't prove that
the value is constant, as it's coming from an unreachable block, we
can ignore it).

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

llvm-svn: 322006
2018-01-08 16:34:06 +00:00
Adrian McCarthy cf6e6c82c1 Emit Function IDs table for Control Flow Guard
Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

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

llvm-svn: 322005
2018-01-08 16:33:42 +00:00
Aleksandar Beserminji f02ad15ff1 [mips] Improve diagnostics for instruction mapping
This patch improves diagnostic for case when mapped instruction 
does not contain a field listed under RowFields.

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

llvm-svn: 322004
2018-01-08 16:25:40 +00:00
Nirav Dave 6e2d03d410 [DAG] Teach BaseIndexOffset to correctly handle with indexed operations
BaseIndexOffset address analysis incorrectly ignores offsets folded
into indexed memory operations causing potential errors in alias
analysis of pre-indexed operations.

Reviewers: efriedma, RKSimon, hfinkel, jyknight

Subscribers: hiraditya, javed.absar, llvm-commits

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

llvm-svn: 322003
2018-01-08 16:21:35 +00:00
Samuel Benzaquen 1092ceae55 [clang-tidy] Fix DanglingHandleCheck for the correct conversion operation between basic_string and basic_string_view.
Summary:
Fix DanglingHandleCheck to handle the final implementation of std::string and std::string_view.
These use a conversion operator instead of a conversion constructor.

Reviewers: hokein

Subscribers: klimek, xazax.hun, cfe-commits

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

llvm-svn: 322002
2018-01-08 15:59:08 +00:00
Sam McCall 718397632e Avoid assumption that lit tests are writable. NFC
llvm-svn: 322001
2018-01-08 15:49:40 +00:00
Sean Eveson 9e867b68fb Fix test added in r321992 failing on some buildbots (again), test requires x86.
llvm-svn: 322000
2018-01-08 15:46:18 +00:00
Ivan A. Kosarev ed4f330174 [CodeGen] Fix TBAA info for accesses to members of base classes
Resolves:
Bug 35724 - regression (r315984): fatal error: error in backend:
Broken function found (Did not see access type in access path!)
https://bugs.llvm.org/show_bug.cgi?id=35724

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

llvm-svn: 321999
2018-01-08 15:36:06 +00:00
Sanjay Patel 31b4b76f99 [InstCombine] fold min/max tree with common operand (PR35717)
There is precedence for factorization transforms in instcombine for FP ops with fast-math. 
We also have similar logic in foldSPFofSPF().

It would take more work to add this to reassociate because that's specialized for binops, 
and min/max are not binops (or even single instructions). Also, I don't have evidence that 
larger min/max trees than this exist in real code, but if we find that's true, we might
want to reorganize where/how we do this optimization.

In the motivating example from https://bugs.llvm.org/show_bug.cgi?id=35717 , we have:

int test(int xc, int xm, int xy) {
  int xk;
  if (xc < xm)
    xk = xc < xy ? xc : xy;
  else
    xk = xm < xy ? xm : xy;
  return xk;
}

This patch solves that problem because we recognize more min/max patterns after rL321672

https://rise4fun.com/Alive/Qjne
https://rise4fun.com/Alive/3yg

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

llvm-svn: 321998
2018-01-08 15:05:34 +00:00
Sam McCall 18b6b2f994 Avoid assumption that lit tests are writable. NFC
llvm-svn: 321997
2018-01-08 15:05:01 +00:00
Momchil Velikov ac7c5c1d92 [ARM] Fix PR35379 - incorrect unwind information when compiling with -Oz
The patch makes the unwind information not mention registers, which were pushed
solely for the purpose of saving stack adjustment instructions.

Differential revision: https://reviews.llvm.org/D41300
Fixes https://bugs.llvm.org/show_bug.cgi?id=35379

llvm-svn: 321996
2018-01-08 14:47:19 +00:00
Sean Eveson 31db713615 Fix test added in r321992 failing on some buildbots.
llvm-svn: 321995
2018-01-08 14:43:28 +00:00
Alexey Bataev 5b9a77d4ea [SLP] Fix PR35777: Incorrect handling of aggregate values.
Summary:
Fixes the bug with incorrect handling of InsertValue|InsertElement
instrucions in SLP vectorizer. Currently, we may use incorrect
ExtractElement instructions as the operands of the original
InsertValue|InsertElement instructions.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: llvm-commits

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

llvm-svn: 321994
2018-01-08 14:43:06 +00:00