Commit Graph

309789 Commits

Author SHA1 Message Date
Petr Hosek 5300d84116 [CMake] Avoid passing -rtlib=compiler-rt when using compiler-rt
We build libc++ and libc++abi with -nodefaultlibs, so -rtlib=compiler-rt
has no effect and results in an 'argument unused during compilation'
warning which breaks the build when using -Werror. We can therefore drop
-rtlib=compiler-rt without any functional change; note that the actual
compiler-rt linking is handled by HandleCompilerRT.

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

llvm-svn: 353786
2019-02-12 01:35:29 +00:00
David Blaikie 43d6122f73 Fix r353771 to target linux only (split-dwarf isn't supported on macho)
llvm-svn: 353785
2019-02-12 01:19:00 +00:00
Petr Hosek 47de76b0d4 [CMake][XRay] Silence llvm-config error when checking library support
Otherwise this propagates all the way to CMake and results in an error
during configuration. We check and handle the result and report warning
separately so this is not changing the behavior.

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

llvm-svn: 353784
2019-02-12 01:09:07 +00:00
Jonas Devlieghere 6e31f4758f [Thread] Update the correct variable
The new shared pointer was assigning to the temporary instead of the
member (m_curr_frames_sp).

llvm-svn: 353783
2019-02-12 01:04:57 +00:00
Kostya Serebryany 73bf6d5b35 [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand; second attempt after failed r352732, this time with a fix for cmake
llvm-svn: 353782
2019-02-12 01:00:08 +00:00
Kostya Serebryany 56b2d57cbf [libFuzzer] simplify the code for print_coverage=1 so that it doesn't fail on broken debug info
llvm-svn: 353781
2019-02-12 00:52:11 +00:00
Julian Lettner ee82db57ec [libFuzzer] Make coverage.test work on ARM64
Summary:
This test instruments the following code with coverage, runs the fuzzer
once, and asserts that there are uncovered PCs. The ARM64 backend
optimizes this code using the `csel` (Conditional select) instruction,
which removes all branching from the resulting machine code. The test
then fails because we do not have any uncovered PCs. The easiest
solution for now is to turn off optimization for the DSOs used in this
test.

```
int DSO1(int a) {
  if (a < 123456)
    return 0;
  return 1;
}
```

rdar://47646400

Reviewers: kcc

Tags: #sanitizers, #llvm

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

llvm-svn: 353780
2019-02-12 00:37:40 +00:00
Eli Friedman 806136f8ef [LoopReroll] Fix reroll root legality checking.
The code checked that the first root was an appropriate distance from
the base value, but skipped checking the other roots. This could lead to
rerolling a loop that can't be legally rerolled (at least, not without
rewriting the loop in a non-trivial way).

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

llvm-svn: 353779
2019-02-12 00:33:25 +00:00
Jonas Devlieghere 9d0c5f9953 Define _ENABLE_EXTENDED_ALIGNED_STORAGE on Windows.
Apparently there are multiple places where MSVC complains about
instantiations with extended aligment. I think it's better to define
`_ENABLE_EXTENDED_ALIGNED_STORAGE` as suggested by the error message.

I don't have access to a Windows machine so this is all speculative.

llvm-svn: 353778
2019-02-12 00:30:21 +00:00
Kostya Serebryany 8cc38effe2 [libFuzzer] run the -fork=1 tests only on linux
llvm-svn: 353777
2019-02-12 00:29:51 +00:00
Philip Reames 5292a3b6aa [Test] Use autogenerated checks for more statepoint tests
llvm-svn: 353776
2019-02-12 00:12:46 +00:00
Kostya Serebryany 63f48717b5 [libFuzzer] extend the -fork=1 functionality. Still not fully usable, but good enough for the first unit test
llvm-svn: 353775
2019-02-12 00:12:33 +00:00
Eric Fiselier 9ebc9dbd3c Don't declare fenv.h functions when they're a macro.
libc still provides function declarations, and these declarations
conflict with libc++'s

llvm-svn: 353774
2019-02-12 00:05:14 +00:00
Philip Reames 8663b00ce1 [Tests] Fill out a few tests around gc relocation uniquing
llvm-svn: 353773
2019-02-12 00:01:39 +00:00
Eric Fiselier 1eb19e5277 Make the sym_diff utilities more useful.
In particular when working with static libraries and libstdc++.

llvm-svn: 353772
2019-02-12 00:00:43 +00:00
David Blaikie 104dcb348f DebugInfo: Split DWARF + gmlt + no-split-dwarf-inlining shouldn't emit anything to the .dwo file
This configuration (due to r349207) was intended not to emit any DWO CU,
but a degenerate CU was still being emitted - containing a header and a
DW_TAG_compile_unit with no attributes.

Under that situation, emit nothing to the .dwo file. (since this is a
dynamic property of the input the .dwo file is still emitted, just with
nothing in it (so a valid, but empty, ELF file) - if some other CU
didn't satisfy this criteria, its DWO CU would still go there, etc)

llvm-svn: 353771
2019-02-12 00:00:38 +00:00
Philip Reames 6a3862e3c2 [Test] Autogenerate a statepoint test and actual show the reload
llvm-svn: 353770
2019-02-11 23:55:24 +00:00
Jonas Devlieghere 55fb848e84 [ObjectFileMachO] Revert std::make_shared
This caused a rather interesting error message on MSVC: error C2338 and
I'm not sure how to properly fix it.

llvm-svn: 353769
2019-02-11 23:49:13 +00:00
Jonas Devlieghere c6091d2bed Some cleanup after moving to std::make_shared
Addresses Tatyana Krasnukha's feedback from D57990.

llvm-svn: 353768
2019-02-11 23:48:59 +00:00
Eric Fiselier cf39dd44b8 Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

llvm-svn: 353767
2019-02-11 23:47:19 +00:00
Philip Reames 5906a6591c Be conservative about unordered accesses for the moment
Background: As described in https://reviews.llvm.org/D57601, I'm working towards separating volatile and atomic in the MMO uses for atomic instructions.

In https://reviews.llvm.org/D57593, I fixed a bug where isUnordered was returning the wrong result, but didn't account for the fact I was getting slightly ahead of myself. While both uses of isUnordered are correct (as far as I can tell), we don't have tests to demonstrate this and being aggressive gets in the way of having the removal of volatile truly be non-functional. Once D57601 lands, I will return to these call sites, revert this patch, and add the appropriate tests to show the expected behaviour.

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

llvm-svn: 353766
2019-02-11 23:34:33 +00:00
Erik Pilkington e3cd735ea6 Add a new attribute, fortify_stdlib
This attribute applies to declarations of C stdlib functions
(sprintf, memcpy...) that have known fortified variants
(__sprintf_chk, __memcpy_chk, ...). When applied, clang will emit
calls to the fortified variant functions instead of calls to the
defaults.

In GCC, this is done by adding gnu_inline-style wrapper functions,
but that doesn't work for us for variadic functions because we don't
support __builtin_va_arg_pack (and have no intention to).

This attribute takes two arguments, the first is 'type' argument
passed through to __builtin_object_size, and the second is a flag
argument that gets passed through to the variadic checking variants.

rdar://47905754

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

llvm-svn: 353765
2019-02-11 23:21:39 +00:00
Jonas Devlieghere 796ac80b86 Use std::make_shared in LLDB (NFC)
Unlike std::make_unique, which is only available since C++14,
std::make_shared is available since C++11. Not only is std::make_shared
a lot more readable compared to ::reset(new), it also performs a single
heap allocation for the object and control block.

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

llvm-svn: 353764
2019-02-11 23:13:08 +00:00
Daniel Sanders 6cbc92915a [tblgen] Add a timer covering the time spent reading the Instruction defs
This patch adds a -time-regions option to tablegen that can enable timers
(currently only one) that assess the performance of tablegen itself. This
can be useful for identifying scaling problems with tablegen backends.

This particular timer has allowed me to ignore time that is not attributed
the GISel combiner pass. It's useful by itself but it is particularly
useful in combination with https://reviews.llvm.org/D52954 which causes
this period of time to be annotated within Xcode Instruments which in turn
allows profile samples and recorded allocations attributed to reading
instructions to be filtered out.

llvm-svn: 353763
2019-02-11 23:02:02 +00:00
Eli Friedman 88fccbdea7 [Sema] Mark GNU compound literal array init as an rvalue.
Basically the same issue as string init, except it didn't really have
any visible consequences before I removed the implicit lvalue-to-rvalue
conversion from CodeGen.

While I'm here, a couple minor drive-by cleanups: IgnoreParens never
returns a ConstantExpr, and there was a potential crash with string init
involving a ChooseExpr.

The analyzer test change maybe indicates we could simplify the analyzer
code a little with this fix?  Apparently a hack was added to support
lvalues in initializers in r315750, but I'm not really familiar with the
relevant code.

Fixes regression reported in the kernel build at
https://bugs.llvm.org/show_bug.cgi?id=40430#c6 .

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

llvm-svn: 353762
2019-02-11 22:54:27 +00:00
Heejin Ahn 9d5a089bf5 [WebAssembly] Make thread-related options consistent
Summary:
There have been three options related to threads and users had to set
all three of them separately to get the correct compilation results.
This makes sure the relationship between the options makes sense and
sets necessary options for users if only part of the necessary options
are specified. This does:

- Remove `-matomics`; this option alone does not enable anything, so
  removed it to not confuse users.
- `-mthread-model posix` sets `-target-feature +atomics`
- `-pthread` sets both `-target-feature +atomics` and
  `-mthread-model posix`
Also errors out when explicitly given options don't match, such as
`-pthread` is given with `-mthread-model single`.

Reviewers: dschuff, sbc100, tlively, sunfish

Subscribers: jgravelle-google, jfb, cfe-commits

Tags: #clang

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

llvm-svn: 353761
2019-02-11 22:47:50 +00:00
Francis Visoiu Mistrih 1608c12027 [NFC][clangd] Remove unused lambda capture
Avoid this warning:

llvm/clang-tools-extra/clangd/ClangdServer.cpp:365:23: warning: lambda
capture 'this' is not used [-Wunused-lambda-capture]

  auto Action = [Sel, this](decltype(CB) CB, std::string File,
                    ~~^~~~
1 warning generated.

llvm-svn: 353760
2019-02-11 22:36:47 +00:00
Matt Arsenault b2d245771f GlobalISel: Verify G_EXTRACT
llvm-svn: 353759
2019-02-11 22:12:43 +00:00
Evandro Menezes f4a369596f [TargetLibraryInfo] Update run time support for Windows
It seems that, since VC19, the `float` C99 math functions are supported for all
targets, unlike the C89 ones.

According to the discussion at https://reviews.llvm.org/D57625.

llvm-svn: 353758
2019-02-11 22:12:01 +00:00
Ana Pazos 9a3dc3e60b [LegalizeTypes] Expand FNEG to bitwise op for IEEE FP types
Summary:
Except for custom floating point types x86_fp80 and ppc_fp128,
expand Y = FNEG(X) to Y = X ^ sign mask to avoid library call.
 Using bitwise operation can improve code size and performance.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: efriedma, kpn, arsenm, eli.friedman, javed.absar, rbar, johnrusso, simoncook, sabuasal, niosHD, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, asb, llvm-commits

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

llvm-svn: 353757
2019-02-11 22:10:08 +00:00
Rui Ueyama 016833bac2 lld: unquote possibly quoted `EXTERN("symbol")` entry in linker script.
gold accepts quoted strings. binutils requires quoted strings for some
kinds of symbols, e.g.:

  it accepts quoted symbols with @ in name:

  $ echo 'EXTERN("__libc_start_main@@GLIBC_2.2.5")' > a.script
  $ g++ a.script
  /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
  (.text+0x20): undefined reference to `main'
  collect2: error: ld returned 1 exit status

  but rejects them if unquoted:

  $ echo 'EXTERN(__libc_start_main@@GLIBC_2.2.5)' > a.script
  $ g++ a.script
  a.script: file not recognized: File format not recognized
  collect2: error: ld returned 1 exit status

To maintain compatibility with existing linker scripts support quoted
strings in lld as well.

Patch by Lucian Adrian Grijincu.

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

llvm-svn: 353756
2019-02-11 22:01:32 +00:00
Scott Linder 72a0f4e8db [IRReader] Expose getLazyIRModule
Currently there is no way to lazy-load an in-memory IR module without
first writing it to disk. This patch just exposes the existing
implementation of getLazyIRModule.

This is effectively a revert of rL212364

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

llvm-svn: 353755
2019-02-11 22:01:13 +00:00
Matt Arsenault 18ec382698 GlobalISel: Implement moreElementsVector for implicit_def
llvm-svn: 353754
2019-02-11 22:00:39 +00:00
Raphael Isemann f75a9dc1a2 Fixed function name in log statement
llvm-svn: 353753
2019-02-11 21:45:33 +00:00
Jonas Devlieghere 31ad39c51f Use of `@return` is not appropriate for a function with a void return type.
The comment for this declaration causes a warning with -Wdocumentation:
Invalid @return in documentation comment SetCollectingStats() in
SBTarget.h.

llvm-svn: 353752
2019-02-11 21:43:18 +00:00
Rui Ueyama 031fe10927 Convert CRLF. NFC.
llvm-svn: 353751
2019-02-11 21:38:20 +00:00
Matt Arsenault 68fc38ce80 GlobalISel: Fix not calling the observer when legalizing G_EXTRACT
llvm-svn: 353750
2019-02-11 21:33:54 +00:00
Jonathan Peyton 2f744592a0 [OpenMP] Remove accidental commit to config-ix.cmake in r353747
llvm-svn: 353748
2019-02-11 21:09:15 +00:00
Jonathan Peyton 65ebfeecf8 [OpenMP] Fix thread_limits to work properly for teams construct
The thread-limit-var and omp_get_thread_limit API was not perfectly handled for
teams construct. Now, when modified by thread_limit clause, omp_get_thread_limit
reports the correct value. In addition, the value is restored when leaving the
teams construct to what it was in the encountering context.

This is done partly by creating the notion of a Contention Group root (CG root)
that keeps track of the thread at the root of each separate CG, the
thread-limit-var associated with the CG, and associated counter of active
threads within the contention group.

thread-limits are passed from master to worker threads via an entry in the ICV
data structure. When a "contention group switch" occurs, a new CG root record is
made and passed from master to worker. A thread could potentially have several
CG root records if it encounters multiple nested teams constructs (but at the
moment the spec doesn't allow for nested teams, so the most one could have
currently is 2). The master of the teams masters gets the thread-limit clause
value stored to its local ICV structure, and the other teams masters copy it
from the master. The thread-limit is set from that ICV copy and restored to the
ICV copy when entering and leaving the teams construct.

This change also fixes a bug when the top-level teams construct team gets
reused, and OMP_DYNAMIC was true, which can cause the expected size of this team
to be smaller than what was actually allocated. The fix updates the size of the
team after its threads were reserved.

Patch by Terry Wilmarth

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

llvm-svn: 353747
2019-02-11 21:04:23 +00:00
Daniel Sanders 24e0af6906 [globalisel] Correct string emitted by GISelChangeObserver::erasingInstr()
The API indicates that the MI is about to be erased rather than it has been erased.

llvm-svn: 353746
2019-02-11 20:45:19 +00:00
Craig Topper 75eb0af874 [X86] Correct the memory operand for the FLD emitted in FP_TO_INTHelper for 32-bit SSE targets.
We were using DstTy, but that represents the integer type we are converting to which is i64 in this
case. The FLD is part of an intermediate step to get from the SSE registers to the x87 registers.
If the floating point type is f32, the memory operand should reflect a 4 byte access not an 8 byte
access. The store we used to get from SSE to the stack is using the corect size.

While there, consistenly use TheVT in place of Op.getOperand(0).getValueType() throughout the function.

llvm-svn: 353745
2019-02-11 20:38:10 +00:00
Nico Weber 346f1e97a9 Fix a few tests that were missing ':' on CHECK lines and weren't testing anything.
Found by `git grep '\/\/ CHECK-[^: ]* ' clang/test/ | grep -v RUN:`.

Also tweak CodeGenCXX/arm-swiftcall.cpp to still pass now that it checks more.

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

llvm-svn: 353744
2019-02-11 20:33:22 +00:00
Matt Davis 22c21934ce [llvm-cxxfilt] Split and demangle stdin input
Summary:
Originally, llvm-cxxfilt would treat a line as a single mangled item to be demangled.
If a mangled name appears in the middle of that string, that name would not be demangled.

GNU c++filt  splits and demangles every word  in a  string that is piped to it via stdin.
Prior to this patch llvm-cxxfilt would never split strings  piped to it.
This patch replicates the GNU behavior and splits strings that are piped to it via stdin.

This fixes PR39990

Reviewers: compnerd, jhenderson, davide

Reviewed By: compnerd, jhenderson

Subscribers: erik.pilkington, jhenderson, llvm-commits

Tags: #llvm

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

llvm-svn: 353743
2019-02-11 20:30:53 +00:00
Petr Hosek 7c8952197b [CodeGen] Set construction vtable visibility after creating initializer
We must only set the construction vtable visibility after we create the
vtable initializer, otherwise the global value will be treated as
declaration rather than definition and the visibility won't be set.

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

llvm-svn: 353742
2019-02-11 20:13:42 +00:00
Daniel Sanders b31180d0de [globalisel] Restore comment explaining the nits of GISelChangeObserver::createdInstr()
llvm-svn: 353741
2019-02-11 20:05:49 +00:00
Tom Tan 42b2424e4f [COFF, ARM64] Remove definitions for _byteswap library functions
_byteswap_* functions are are implemented in below file as normal function
from libucrt.lib and declared in stdlib.h. Define them in intrin.h triggers
lld error "conflicting comdat type" and "duplicate symbols" which was just
added to LLD (https://reviews.llvm.org/D57324).

C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt\stdlib\byteswap.cpp

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

llvm-svn: 353740
2019-02-11 20:04:02 +00:00
Alina Sbirlea d77edc00a8 [MemorySSA] Remove verifyClobberSanity.
Summary:
This verification may fail after certain transformations due to
BasicAA's fragility. Added a small explanation and a testcase that
triggers the assert in checkClobberSanity (before its removal).
Addresses PR40509.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, llvm-commits, Prazek

Tags: #llvm

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

llvm-svn: 353739
2019-02-11 19:51:21 +00:00
Michael Kruse 77a614a6e1 Refactor setAlreadyUnrolled() and setAlreadyVectorized().
Loop::setAlreadyUnrolled() and
LoopVectorizeHints::setLoopAlreadyUnrolled() both add loop metadata that
stops the same loop from being transformed multiple times. This patch
merges both implementations.

In doing so we fix 3 potential issues:

 * setLoopAlreadyUnrolled() kept the llvm.loop.vectorize/interleave.*
   metadata even though it will not be used anymore. This already caused
   problems such as http://llvm.org/PR40546. Change the behavior to the
   one of setAlreadyUnrolled which deletes this loop metadata.

 * setAlreadyUnrolled() used to create a new LoopID by calling
   MDNode::get with nullptr as the first operand, then replacing it by
   the returned references using replaceOperandWith. It is possible
   that MDNode::get would instead return an existing node (due to
   de-duplication) that then gets modified. To avoid, use a fresh
   TempMDNode that does not get uniqued with anything else before
   replacing it with replaceOperandWith.

 * LoopVectorizeHints::matchesHintMetadataName() only compares the
   suffix of the attribute to set the new value for. That is, when
   called with "enable", would erase attributes such as
   "llvm.loop.unroll.enable", "llvm.loop.vectorize.enable" and
   "llvm.loop.distribute.enable" instead of the one to replace.
   Fortunately, function was only called with "isvectorized".

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

llvm-svn: 353738
2019-02-11 19:45:44 +00:00
Julian Lettner 6142bf2c51 [NFC] Re-enable XFAILed fuzzer test on iOS
llvm-svn: 353737
2019-02-11 19:33:01 +00:00
Sanjay Patel 587fd849f0 [InstCombine] Fix matchRotate bug when one operand is a ConstantExpr shift
This bug seems to be harmless in release builds, but will cause an error in UBSAN
builds or an assertion failure in debug builds.

When it gets to this opcode comparison, it assumes both of the operands are BinaryOperators,
but the prior m_LogicalShift will also match a ConstantExpr. The cast<BinaryOperator> will
assert in a debug build, or reading an invalid value for BinaryOp from memory with
((BinaryOperator*)constantExpr)->getOpcode() will cause an error in a UBSAN build.

The test I added will fail without this change in debug/UBSAN builds, but not in release.

Patch by: @AndrewScheidecker (Andrew Scheidecker)

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

llvm-svn: 353736
2019-02-11 19:26:27 +00:00