Commit Graph

299007 Commits

Author SHA1 Message Date
Andrew Savonichev 1a5623489b Merge two attribute diagnostics into one
Summary:
Merged the recently added `err_attribute_argument_negative` diagnostic
with existing `err_attribute_requires_positive_integer` diagnostic:
the former allows only strictly positive integer, while the latter
also allows zero.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 342367
2018-09-17 10:39:46 +00:00
James Henderson e29e40854b Reland r342233: [ThinLTO] Allow setting of maximum cache size with 64-bit number
The original was reverted due to an apparent build-bot test failure,
but it looks like this is just a flaky test.

Also added a C-interface function for large values, and updated
llvm-lto's --thinlto-cache-max-size-bytes switch to take a type larger
than int.

The maximum cache size in terms of bytes is a 64-bit number. However,
the methods to set it only took unsigned previously, which meant that
the maximum cache size could not be specified above 4GB. That's quite
small compared to the output of some projects, so it makes sense to
provide the ability to set larger values in that field.

We also needed a C-interface function that provides a greater range
than the existing thinlto_codegen_set_cache_size_bytes, which also only
takes an unsigned, so this change also adds
hinlto_codegen_set_cache_size_megabytes.

Reviewed by: mehdi_amini, tejohnson, steven_wu

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

llvm-svn: 342366
2018-09-17 10:21:26 +00:00
Mikhail Maltsev c704f4d561 [Analyzer] Define and use diff_plist in tests, NFC
This patch defines a new substitution and uses it to reduce
duplication in the Clang Analyzer test cases.

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

llvm-svn: 342365
2018-09-17 10:19:46 +00:00
Alexander Shaposhnikov 1de445c71c [llvm-objcopy] Add missing alias for --strip-all-gnu
This diff adds -S as an alias for --strip-all-gnu 
(for compatibility with binutils' objcopy).

Patch by Dmitry Golovin!

Test plan: make check-all

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

llvm-svn: 342364
2018-09-17 09:45:12 +00:00
Ilya Biryukov 370eff85b9 [clang-Format] Fix indentation of member call after block
Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  })
      .as();
});
```

after patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  }).as();
});
```

Patch by Anders Karlsson (ank)!

Reviewers: klimek

Reviewed By: klimek

Subscribers: danilaml, acoomans, klimek, cfe-commits

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

llvm-svn: 342363
2018-09-17 07:46:20 +00:00
Eric Liu a57afd091f [clangd] Get rid of AST matchers in SymbolCollector. NFC
Reviewers: ilya-biryukov, kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 342362
2018-09-17 07:43:49 +00:00
Fangrui Song cac6d21731 Fix typo
llvm-svn: 342361
2018-09-17 07:40:42 +00:00
Max Kazantsev 5fe3620261 [NFC] Turn unsigned counters into boolean flags
llvm-svn: 342360
2018-09-17 06:33:29 +00:00
Sylvestre Ledru ae48d78054 scan-build: Add support of the option --exclude like in scan-build-py
Summary:
To exclude thirdparty code.

To test:
With /tmp/foo.c
  
```
void test() {
    int x;
    x = 1; // warn
}  
```

```
$ scan-build --exclude non-existing/  --exclude /tmp/ -v gcc -c foo.c                                                                                                                                                                                   

scan-build: Using '/usr/lib/llvm-7/bin/clang' for static analysis
scan-build: Emitting reports for this run to '/tmp/scan-build-2018-09-16-214531-8410-1'.
foo.c:3:3: warning: Value stored to 'x' is never read
  x = 1; // warn
  ^   ~
1 warning generated.
scan-build: File '/tmp/foo.c' deleted: part of an ignored directory.
scan-build: 0 bugs found.
```

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: whisperity, cfe-commits

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

llvm-svn: 342359
2018-09-17 06:31:46 +00:00
Petr Hosek 00f51c0904 [Lexer] Add xray_instrument feature
This can be used to detect whether the code is being built with XRay
instrumentation using the __has_feature(xray_instrument) predicate.

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

llvm-svn: 342358
2018-09-17 05:25:47 +00:00
Petr Hosek 040ab65c53 [sanitizer_common] Fuchsia now supports .preinit_array
Support for .preinit_array has been implemented in Fuchsia's libc,
add Fuchsia to the list of platforms that support this feature.

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

llvm-svn: 342357
2018-09-17 05:22:26 +00:00
Dean Michael Berris 1a23d3bbce [XRay] Simplify FDR buffer management
Summary:
This change makes XRay FDR mode use a single backing store for the
buffer queue, and have indexes into that backing store instead. We also
remove the reliance on the internal allocator implementation in the FDR
mode logging implementation.

In the process of making this change we found an inconsistency with the
way we're returning buffers to the queue, and how we're setting the
extents. We take the chance to simplify the way we're managing the
extents of each buffer. It turns out we do not need the indirection for
the extents, so we co-host the atomic 64-bit int with the buffer object.
It also seems that we've not been returning the buffers for the thread
running the flush functionality when writing out the files, so we can
run into a situation where we could be missing data.

We consolidate all the allocation routines now into xray_allocator.h,
where we used to have routines defined in xray_buffer_queue.cc.

Reviewers: mboerger, eizan

Subscribers: jfb, llvm-commits

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

llvm-svn: 342356
2018-09-17 03:09:01 +00:00
Dean Michael Berris d5577aea07 [XRay] Fix FDR initialization
Follow-up to D51606.

llvm-svn: 342355
2018-09-17 02:49:17 +00:00
Kristina Brooks 46c6d3fe75 [DebugInfo] Fix build when std::vector::iterator is a pointer
std::vector::iterator type may be a pointer, then
iterator::value_type fails to compile since iterator is not a class,
namespace, or enumeration.

Patch by orivej (Orivej Desh)

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

llvm-svn: 342354
2018-09-16 22:21:59 +00:00
Shuai Wang aaaa310de2 [NFC] Minor refactoring to setup the stage for supporting pointers in ExprMutationAnalyzer
llvm-svn: 342353
2018-09-16 21:09:50 +00:00
Simon Pilgrim cffa206423 [X86][SSE] Always enable ISD::SRL -> ISD::MULHU for v8i16
For constant non-uniform cases we'll never introduce more and/andn/or selects than already occur in generic pre-SSE41 ISD::SRL lowering.

llvm-svn: 342352
2018-09-16 20:28:38 +00:00
Sylvestre Ledru 9e3818af26 scan-build: remove trailing whitespaces
llvm-svn: 342351
2018-09-16 19:51:16 +00:00
Sylvestre Ledru 757a1fae34 Also manages clang-X as tool for scan-build
Summary:
This will make
scan-build-7 clang-7 -c foo.c &> /dev/null

Reviewers: jroelofs

Subscribers: kristina, cfe-commits

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

llvm-svn: 342350
2018-09-16 19:36:59 +00:00
Simon Pilgrim ea069ffd44 [X86][AVX] Enable ISD::SRL -> ISD::MULHU for v16i16
Now that rL340913 has landed with improved v16i16 selects as shuffles.

llvm-svn: 342349
2018-09-16 19:20:47 +00:00
Sanjay Patel 3eaf500a6d [DAGCombiner] try to convert pow(x, 1/3) to cbrt(x)
This is a follow-up suggested in D51630 and originally proposed as an IR transform in D49040.

Copying the motivational statement by @evandro from that patch:
"This transformation helps some benchmarks in SPEC CPU2000 and CPU2006, such as 188.ammp, 
447.dealII, 453.povray, and especially 300.twolf, as well as some proprietary benchmarks. 
Otherwise, no regressions on x86-64 or A64."

I'm proposing to add only the minimum support for a DAG node here. Since we don't have an 
LLVM IR intrinsic for cbrt, and there are no other DAG ways to create a FCBRT node yet, I 
don't think we need to worry about DAG builder, legalization, a strict variant, etc. We 
should be able to expand as needed when adding more functionality/transforms. For reference, 
these are transform suggestions currently listed in SimplifyLibCalls.cpp:

//   * cbrt(expN(X))  -> expN(x/3)
//   * cbrt(sqrt(x))  -> pow(x,1/6)
//   * cbrt(cbrt(x))  -> pow(x,1/9)

Also, given that we bail out on long double for now, there should not be any logical 
differences between platforms (unless there's some platform out there that has pow()
but not cbrt()).

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

llvm-svn: 342348
2018-09-16 16:50:26 +00:00
Sanjay Patel bfee5a9b42 [x86] fix uses check in broadcast transform (PR38949)
https://bugs.llvm.org/show_bug.cgi?id=38949

It's not clear to me that we even need a one-use check in this fold.
Ie, 2 independent loads might be better than a load+dependent shuffle.

Note that the existing re-use tests are not affected. We actually do form a
broadcast node in those tests now because there's no extra use of the 
insert_subvector node in those cases. But something later in isel pattern 
matching decides that it is not worth using a broadcast for the full load in 
those tests:

Legalized selection DAG: %bb.0 'test_broadcast_2f64_4f64_reuse:'
  t7: v2f64,ch = load<(load 16 from %ir.p0)> t0, t2, undef:i64
      t4: i64,ch = CopyFromReg t0, Register:i64 %1
    t10: ch = store<(store 16 into %ir.p1)> t7:1, t7, t4, undef:i64
      t18: v4f64 = insert_subvector undef:v4f64, t7, Constant:i64<0>
    t20: v4f64 = insert_subvector t18, t7, Constant:i64<2>

Becomes:
  t7: v2f64,ch = load<(load 16 from %ir.p0)> t0, t2, undef:i64
      t4: i64,ch = CopyFromReg t0, Register:i64 %1
    t10: ch = store<(store 16 into %ir.p1)> t7:1, t7, t4, undef:i64
    t21: v4f64 = X86ISD::SUBV_BROADCAST t7

ISEL: Starting selection on root node: t21: v4f64 = X86ISD::SUBV_BROADCAST t7
...
  Created node: t27: v4f64 = INSERT_SUBREG IMPLICIT_DEF:v4f64, t7, TargetConstant:i32<7>
  Morphed node: t21: v4f64 = VINSERTF128rr t27, t7, TargetConstant:i8<1>

llvm-svn: 342347
2018-09-16 15:41:56 +00:00
Sanjay Patel 3e095174b0 [x86] add failure to splat test (PR38949); NFC
llvm-svn: 342346
2018-09-16 14:59:04 +00:00
Roman Lebedev 6356864e6d [NFC][InstCombine] One more test pattern for comparisons with low-bit-mask.
https://rise4fun.com/Alive/UGzE <- non-canonical, but has extra uses.

https://bugs.llvm.org/show_bug.cgi?id=38123

llvm-svn: 342345
2018-09-16 12:51:09 +00:00
Simon Pilgrim 5ea1b32631 Fix -Wdangling-else gcc warning. NFCI.
llvm-svn: 342344
2018-09-16 12:30:41 +00:00
Roman Lebedev 3fb9414d02 [NFC][InstCombine] Some more tests for comparisons with low-bit-mask.
https://bugs.llvm.org/show_bug.cgi?id=38123
https://bugs.llvm.org/show_bug.cgi?id=38708

llvm-svn: 342343
2018-09-16 08:05:06 +00:00
Fangrui Song 3e0a54e9da [ELF] Use llvm::toLower instead of libc call tolower
tolower() has some overhead because current locale is considered (though in lld the default "C" locale is used which does not matter too much). llvm::toLower is more efficient as it compiles to a compare and a conditional jump, as opposed to a libc call if tolower is used.

Disregarding locale also matches gdb's behavior (gdb/minsyms.h):

    #define SYMBOL_HASH_NEXT(hash, c)			\
      ((hash) * 67 + TOLOWER ((unsigned char) (c)) - 113)

where TOLOWER (include/safe-ctype.h) is a macro that uses a lookup table under the hood which is similar to llvm::toLower.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 342342
2018-09-15 23:59:13 +00:00
Jan Vesely 70c5f9dff8 configure: Rework support for gfx9+ devices that were added post LLVM 3.9
v2: Fix reference to Vega12/20 enabling commit

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 342341
2018-09-15 22:02:01 +00:00
Shuai Wang cef621d094 [NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistent
especially considering future changes.

llvm-svn: 342340
2018-09-15 21:38:18 +00:00
Fangrui Song 37a72098ae [llvm-readobj] Make some commonly used short options visibile in -help
For people who use llvm-readelf as a replacement of GNU readelf, they would like to see -d -r ... listed in llvm-readelf -help. It also helps understanding the confusing -s (which is unfortunately different in semantics).

Reviewers: phosek, ruiu, echristo

Reviewed By: ruiu, echristo

Subscribers: llvm-commits

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

llvm-svn: 342339
2018-09-15 21:27:46 +00:00
Jan Vesely a1981c757b .travis: Add llvm-7 build
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 342338
2018-09-15 20:00:37 +00:00
Jan Vesely bb93407831 .travis: Use source whitelist alias for llvm-6 repository
Fixes issue with unauthenticated packages.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry

llvm-svn: 342337
2018-09-15 20:00:12 +00:00
Nico Weber b09a8c9bd9 Revert r342148 (and follow-on fix attempts r342154, r342180, r342182, r342193)
Many bots buildling with make have been broken for several days, e.g.
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13

llvm-svn: 342336
2018-09-15 19:04:27 +00:00
Craig Topper 2da7381678 [InstCombine] Support (sub (sext x), (sext y)) --> (sext (sub x, y)) and (sub (zext x), (zext y)) --> (zext (sub x, y))
Summary:
If the sub doesn't overflow in the original type we can move it above the sext/zext.

This is similar to what we do for add. The overflow checking for sub is currently weaker than add, so the test cases are constructed for what is supported.

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342335
2018-09-15 18:54:10 +00:00
Nico Weber 0bd2d304e6 lld-link: Set PDB GUID to hash of PDB contents instead of to a random byte sequence.
Previously, lld-link would use a random byte sequence as the PDB GUID. Instead,
use a hash of the PDB file contents.

To not disturb llvm-pdbutil pdb2yaml, the hash generation is an opt-in feature
on InfoStreamBuilder and ldb/COFF/PDB.cpp always sets it.

Since writing the PDB computes this ID which also goes in the exe, the PDB
writing code now must be called before writeBuildId(). writeBuildId() for that
reason is no longer included in the "Code Layout" timer.

Since the PDB GUID is now a function of the PDB contents, the PDB Age is always
set to 1. There was a long comment above loadExistingBuildId (now gone) about
how not changing the GUID and only incrementing the age was important, but
according to the discussion in PR35914 that comment was incorrect.

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

llvm-svn: 342334
2018-09-15 18:37:22 +00:00
Nico Weber 205ca68b8d Give InfoStreamBuilder an opt-in method to write a hash of the PDB as GUID.
Naively computing the hash after the PDB data has been generated is in practice
as fast as other approaches I tried. I also tried online-computing the hash as
parts of the PDB were written out (https://reviews.llvm.org/D51887; that's also
where all the measuring data is) and computing the hash in parallel
(https://reviews.llvm.org/D51957). This approach here is simplest, without
being slower.

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

llvm-svn: 342333
2018-09-15 18:35:51 +00:00
Nico Weber da15acbd68 lld-link: print demangled symbol names for "undefined symbol" diagnostics
For this, add a few toString() calls when printing the "undefined symbol"
diagnostics; toString() already does demangling on Windows hosts.

Also make lld::demangleMSVC() (called by toString(Symbol*)) call LLVM's
microsoftDemangle() instead of UnDecorateSymbolName() so that it works on
non-Windows hosts – this makes both updating tests easier and provides a better
user experience for people doing cross-links.

This doesn't yet do the right thing for symbols starting with __imp_, but that
can be improved in a follow-up.

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

llvm-svn: 342332
2018-09-15 18:27:09 +00:00
Nico Weber da01b342b2 Merge Demangle change in r342330 to libcxxabi.
Differential Revision: https://reviews.llvm.org/D52104

llvm-svn: 342331
2018-09-15 18:25:49 +00:00
Nico Weber 1359d654e3 Update microsoftDemangle() to work more like itaniumDemangle().
* Use same method of initializing the output stream and its buffer
* Allow a nullptr Status pointer
* Don't print the mangled name on demangling error
* Write to N (if it is non-nullptr)

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

llvm-svn: 342330
2018-09-15 18:24:20 +00:00
Alexander Polyakov 1641556593 [lldb-mi] Correct regex in the symbol-list-lines test
Summary:
The test failed in case of compiling a test suite with
gcc (checked versions are 5.2.0 and 7.3.0) because it
adds one more line entry comparing to clang. It doesn't
break the test's logic, so I just added a regex that matches
this case.

Reviewers: tatyana-krasnukha, aprantl, clayborg

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 342329
2018-09-15 17:05:20 +00:00
Simon Pilgrim fc4c26485c [X86][SSE] Fix insertps load combine test name
The existing test was called extract_lane_insertps_5123 but it was in fact doing a <6,1,2,3> shuffle. I've fixed the name and added the <5,1,2,3> test case as well.

llvm-svn: 342328
2018-09-15 16:57:04 +00:00
Craig Topper fe0b973fbf [X86] Remove an fp->int->fp domain crossing in LowerUINT_TO_FP_i64.
Summary: This unfortunately adds a move, but isn't that better than going to the int domain and back?

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 342327
2018-09-15 16:23:35 +00:00
Craig Topper 273f755da3 [X86] Fold (movmsk (setne (and X, (1 << C)), 0)) -> (movmsk (X << C))
Summary:
MOVMSK only care about the sign bit so we don't need the setcc to fill the whole element with 0s/1s. We can just shift the bit we're looking for into the sign bit. This saves a constant pool load.

Inspired by PR38840.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 342326
2018-09-15 16:23:33 +00:00
Fedor Sergeev 751341905d [NFC] minor cleanup in PassManagerInternal.h
A few changes found necessary for upcoming PassInstrumentation patch:
  - name() methods made const
  - properly forward arguments in AnalysisPassModel::run

Separated out of the main D47858 patch.

llvm-svn: 342325
2018-09-15 14:56:12 +00:00
Sanjay Patel 296d35a5e9 [InstCombine][x86] try harder to convert blendv intrinsic to generic IR (PR38814)
Missing optimizations with blendv are shown in:
https://bugs.llvm.org/show_bug.cgi?id=38814

If this works, it's an easier and more powerful solution than adding pattern matching 
for a few special cases in the backend. The potential danger with this transform in IR
is that the condition value can get separated from the select, and the backend might 
not be able to make a blendv out of it again. I don't think that's too likely, but 
I've kept this patch minimal with a 'TODO', so we can test that theory in the wild 
before expanding the transform.

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

llvm-svn: 342324
2018-09-15 14:25:44 +00:00
Simon Pilgrim 7bfe87181d Fix line endings. NFCI.
llvm-svn: 342323
2018-09-15 14:20:53 +00:00
Kelvin Li be286f5f15 [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)
Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h 
and ASTWriter.h and move implementation to ASTReader.cpp and 
ASTWriter.cpp. This change helps generalize the serialization of
OpenMP clauses and will be used in the future implementation of new 
OpenMP directives (e.g. requires).

Patch by Patrick Lyster

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

llvm-svn: 342322
2018-09-15 13:54:15 +00:00
Roman Lebedev 1b7fc87020 [InstCombine] Inefficient pattern for high-bits checking 3 (PR38708)
Summary:
It is sometimes important to check that some newly-computed value
is non-negative and only n bits wide (where n is a variable.)
There are many ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

The last (as far i know?) pattern, non-canonical due to the extra use.
https://godbolt.org/z/aCMsPk
https://rise4fun.com/Alive/I6f

https://bugs.llvm.org/show_bug.cgi?id=38708

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342321
2018-09-15 12:04:13 +00:00
Petr Hosek 9e8b4de3b3 [XRay] Remove the unused variable
This broke the fdr-single-thread test after FDRLoggingOptions struct
has been removed in r342318.

llvm-svn: 342320
2018-09-15 06:25:17 +00:00
Vedant Kumar 1b02dad9f2 [CodeGenPrepare] Preserve debug locs in OptimizeExtractBits
CodeGenPrepare has a transform that sinks {lshr, trunc} pairs to make it
easier for the backend to emit fancy extract-bits instructions (e.g UBFX).

Teach it to preserve debug locations and salvage debug values.

llvm-svn: 342319
2018-09-15 04:08:52 +00:00
Petr Hosek d197ebf3ed [XRay] Remove the deprecated __xray_log_init API
This API has been deprecated three months ago and shouldn't be used
anymore, all clients should migrate to the new string based API.

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

llvm-svn: 342318
2018-09-15 02:55:42 +00:00