platform/upstream/llvm.git
5 years ago[debugserver][CMake] Remove commented out line
Alex Langford [Tue, 15 Jan 2019 22:27:59 +0000 (22:27 +0000)]
[debugserver][CMake] Remove commented out line

This has been commented out since rL300111
(commit d742d081f3a1e7412cc609765139ba32d597ac15). Looks like it was
committed as a commented out line, so I'm removing it.

llvm-svn: 351263

5 years ago[libFuzzer] Remove unstable edge handling
Jonathan Metzman [Tue, 15 Jan 2019 22:12:51 +0000 (22:12 +0000)]
[libFuzzer] Remove unstable edge handling

Summary:
Remove code for handling unstable edges from libFuzzer since
it has not been found useful.

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

llvm-svn: 351262

5 years ago[clang-tidy] add options documentation to readability-identifier-naming checker
Paul Hoad [Tue, 15 Jan 2019 22:06:49 +0000 (22:06 +0000)]
[clang-tidy] add options documentation to readability-identifier-naming checker

Summary:
The documentation for this clang-checker did not explain what the options are. But this checkers only works with at least some options defined.

To discover the options, you have to read the source code. This shouldn't be necessary for users who just have access to the clang-tidy binary.

This revision, explains the options and gives an example.

Patch by MyDeveloperDay.

Reviewers: JonasToth, Eugene.Zelenko

Reviewed By: JonasToth

Subscribers: xazax.hun, Eugene.Zelenko

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

llvm-svn: 351261

5 years agocompiler-rt/test: Add a couple of convenience features for Android.
Peter Collingbourne [Tue, 15 Jan 2019 22:06:48 +0000 (22:06 +0000)]
compiler-rt/test: Add a couple of convenience features for Android.

Add a ANDROID_SERIAL_FOR_TESTING CMake variable. This lets you
run the tests with multiple devices attached without having to set
ANDROID_SERIAL.

Add a mechanism for pushing files to the device. Currently most
sanitizers require llvm-symbolizer and the sanitizer runtime to
be pushed to the device. This lets the sanitizer make this happen
automatically before running the tests by specifying the paths in
the lit.site.cfg file.

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

llvm-svn: 351260

5 years ago[libObject] Tweak expected error output from llvm-ar
Jordan Rupprecht [Tue, 15 Jan 2019 22:03:08 +0000 (22:03 +0000)]
[libObject] Tweak expected error output from llvm-ar

llvm-svn: 351259

5 years agogn build: Add a stage2 host toolchain and make the hwasan runtime buildable on x86_64...
Peter Collingbourne [Tue, 15 Jan 2019 22:02:12 +0000 (22:02 +0000)]
gn build: Add a stage2 host toolchain and make the hwasan runtime buildable on x86_64 Linux.

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

llvm-svn: 351258

5 years ago[profile] Sync up InstrProfData.inc with llvm copy /NFC
Rong Xu [Tue, 15 Jan 2019 21:59:17 +0000 (21:59 +0000)]
[profile] Sync up InstrProfData.inc with llvm copy /NFC

llvm-svn: 351257

5 years ago[llvm-ar] Resubmit recursive thin archive test with fix for full path names and bette...
Jordan Rupprecht [Tue, 15 Jan 2019 21:52:31 +0000 (21:52 +0000)]
[llvm-ar] Resubmit recursive thin archive test with fix for full path names and better error messages

llvm-svn: 351256

5 years agogn build: Add a resource_dir.gni file.
Peter Collingbourne [Tue, 15 Jan 2019 21:44:59 +0000 (21:44 +0000)]
gn build: Add a resource_dir.gni file.

The path to the resource directory will end up being used in several
more places once the support for running check-hwasan lands. This
moves the definition to a central location so that it can be used
from those places.

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

llvm-svn: 351255

5 years ago[X86] Add the GCCBuiltin name back to the deprecated avx512 gather intrinsics until...
Craig Topper [Tue, 15 Jan 2019 21:41:31 +0000 (21:41 +0000)]
[X86] Add the GCCBuiltin name back to the deprecated avx512 gather intrinsics until the clang side patch for the new versions is approved.

llvm-svn: 351254

5 years agoX86DAGToDAGISel::matchBitExtract() with truncation (PR36419)
Roman Lebedev [Tue, 15 Jan 2019 21:31:18 +0000 (21:31 +0000)]
X86DAGToDAGISel::matchBitExtract() with truncation (PR36419)

Summary:
Previously in D54095 i have added support for extraction of `lshr` from `X` if we are to produce `BEXTR`.
That was good, but the fix was partial, there was still [[ https://bugs.llvm.org/show_bug.cgi?id=36419 | PR36419 ]].

That pattern can also appear, roughly, when you have a large (64-bit) storage, and the consume bits from it.
It will not be unexpected if you will be doing further computations in 32-bit width.
And then the current code breaks, as the tests show.

The basic idea/pattern here is following:
1. We have `i64` input
2. We perform `i64` right-shift on it.
3. We `trunc`ate that shifted value
4. We do all further work (masking) in `i32`

Since we see `trunc`ation and not `lshr`, we give up, and stop trying to extract that right-shift.
BUT. The mask is `i32`, therefore we can extend both of the operands of the masking (`and`) to `i64`
and truncate the result after masking: https://rise4fun.com/Alive/K4B
```
Name: @bextr64_32_b1 -> @bextr64_32_b0
  %shiftedval = lshr i64 %val, %numskipbits
  %truncshiftedval = trunc i64 %shiftedval to i32
  %widenumlowbits1 = zext i8 %numlowbits to i32
  %notmask1 = shl nsw i32 -1, %widenumlowbits1
  %mask1 = xor i32 %notmask1, -1
  %res = and i32 %truncshiftedval, %mask1
=>
  %shiftedval = lshr i64 %val, %numskipbits
  %widenumlowbits = zext i8 %numlowbits to i64
  %notmask = shl nsw i64 -1, %widenumlowbits
  %mask = xor i64 %notmask, -1
  %wideres = and i64 %shiftedval, %mask
  %res = trunc i64 %wideres to i32
```

Thus, we are again able to extract that `lshr` into `BEXTR`'s control.

Now, the perf (via `llvm-exegesis`) of the snippet suggests that it is not a good idea:
```
$ cat /tmp/old.s
# bextr64_32_b1
# LLVM-EXEGESIS-LIVEIN RSI
# LLVM-EXEGESIS-LIVEIN EDX
# LLVM-EXEGESIS-LIVEIN RDI
movq %rsi, %rcx
shrq %cl, %rdi
shll $8, %edx
bextrl %edx, %edi, %eax
$ cat /tmp/old.s | ./bin/llvm-exegesis -mode=latency -snippets-file=-
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-1e0082.o
---
mode:            latency
key:
  instructions:
    - 'MOV64rr RCX RSI'
    - 'SHR64rCL RDI RDI'
    - 'SHL32ri EDX EDX i_0x8'
    - 'BEXTR32rr EAX EDI EDX'
  config:          ''
  register_initial_values: []
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: latency, value: 0.6638, per_snippet_value: 2.6552 }
error:           ''
info:            ''
assembled_snippet: 4889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C7C3
...
$ cat /tmp/old.s | ./bin/llvm-exegesis -mode=uops -snippets-file=-
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-43e346.o
---
mode:            uops
key:
  instructions:
    - 'MOV64rr RCX RSI'
    - 'SHR64rCL RDI RDI'
    - 'SHL32ri EDX EDX i_0x8'
    - 'BEXTR32rr EAX EDI EDX'
  config:          ''
  register_initial_values: []
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: PdFPU0, value: 0, per_snippet_value: 0 }
  - { key: PdFPU1, value: 0, per_snippet_value: 0 }
  - { key: PdFPU2, value: 0, per_snippet_value: 0 }
  - { key: PdFPU3, value: 0, per_snippet_value: 0 }
  - { key: NumMicroOps, value: 1.2571, per_snippet_value: 5.0284 }
error:           ''
info:            ''
assembled_snippet: 4889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C74889F148D3EFC1E208C4E268F7C7C3
...
```
vs
```
$ cat /tmp/new.s
# bextr64_32_b1
# LLVM-EXEGESIS-LIVEIN RDX
# LLVM-EXEGESIS-LIVEIN SIL
# LLVM-EXEGESIS-LIVEIN RDI
shlq $8, %rdx
movzbl %sil, %eax
orq %rdx, %rax
bextrq %rax, %rdi, %rax
$ cat /tmp/new.s | ./bin/llvm-exegesis -mode=latency -snippets-file=-
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-8944f1.o
---
mode:            latency
key:
  instructions:
    - 'SHL64ri RDX RDX i_0x8'
    - 'MOVZX32rr8 EAX SIL'
    - 'OR64rr RAX RAX RDX'
    - 'BEXTR64rr RAX RDI RAX'
  config:          ''
  register_initial_values: []
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: latency, value: 0.7454, per_snippet_value: 2.9816 }
error:           ''
info:            ''
assembled_snippet: 48C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C7C3
...
$ cat /tmp/new.s | ./bin/llvm-exegesis -mode=uops -snippets-file=-
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-da403c.o
---
mode:            uops
key:
  instructions:
    - 'SHL64ri RDX RDX i_0x8'
    - 'MOVZX32rr8 EAX SIL'
    - 'OR64rr RAX RAX RDX'
    - 'BEXTR64rr RAX RDI RAX'
  config:          ''
  register_initial_values: []
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: PdFPU0, value: 0, per_snippet_value: 0 }
  - { key: PdFPU1, value: 0, per_snippet_value: 0 }
  - { key: PdFPU2, value: 0, per_snippet_value: 0 }
  - { key: PdFPU3, value: 0, per_snippet_value: 0 }
  - { key: NumMicroOps, value: 1.2571, per_snippet_value: 5.0284 }
error:           ''
info:            ''
assembled_snippet: 48C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C748C1E208400FB6C64809D0C4E2F8F7C7C3
...
```
^ latency increased (worse).

Except //maybe// not really.
Like with all synthetic benchmarks, they //may// be misleading.

Let's take a look on some actual real-world hotpath.
In this case it's 'my' [[ https://github.com/darktable-org/rawspeed | RawSpeed ]]'s `BitStream<>::peekBitsNoFill()`, in [[ https://github.com/darktable-org/rawspeed/blob/e3316dc85127c2c29baa40f998f198a7b278bf36/src/librawspeed/decompressors/VC5Decompressor.cpp#L814 | GoPro VC5 decompressor ]]:
```
raw.pixls.us-unique/GoPro/HERO6 Black$ /usr/src/googlebenchmark/tools/compare.py -a benchmarks ~/rawspeed/build-clangs1-{old,new}/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 GOPR9172.GPR
RUNNING: /home/lebedevri/rawspeed/build-clangs1-old/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 GOPR9172.GPR --benchmark_display_aggregates_only=true --benchmark_out=/tmp/tmplwbKEM
2018-12-22 21:23:03
Running /home/lebedevri/rawspeed/build-clangs1-old/src/utilities/rsbench/rsbench
Run on (8 X 4012.81 MHz CPU s)
CPU Caches:
  L1 Data 16K (x8)
  L1 Instruction 64K (x4)
  L2 Unified 2048K (x4)
  L3 Unified 8192K (x1)
Load Average: 3.41, 2.41, 2.03
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                        Time           CPU Iterations  CPUTime,s CPUTime/WallTime     Pixels Pixels/CPUTime Pixels/WallTime Raws/CPUTime Raws/WallTime WallTime,s
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GOPR9172.GPR/threads:8/real_time_mean           40 ms         40 ms        128   0.322244          7.96974        12M       37.4457M        298.534M      3.12047       24.8778   0.040465
GOPR9172.GPR/threads:8/real_time_median         39 ms         39 ms        128   0.312606          7.99155        12M        38.387M        306.788M      3.19891       25.5656   0.039115
GOPR9172.GPR/threads:8/real_time_stddev          4 ms          3 ms        128  0.0271557         0.130575          0        2.4941M        21.3909M     0.207842       1.78257   3.81081m
RUNNING: /home/lebedevri/rawspeed/build-clangs1-new/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 GOPR9172.GPR --benchmark_display_aggregates_only=true --benchmark_out=/tmp/tmpWAkan9
2018-12-22 21:23:08
Running /home/lebedevri/rawspeed/build-clangs1-new/src/utilities/rsbench/rsbench
Run on (8 X 4013.1 MHz CPU s)
CPU Caches:
  L1 Data 16K (x8)
  L1 Instruction 64K (x4)
  L2 Unified 2048K (x4)
  L3 Unified 8192K (x1)
Load Average: 3.78, 2.50, 2.06
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                        Time           CPU Iterations  CPUTime,s CPUTime/WallTime     Pixels Pixels/CPUTime Pixels/WallTime Raws/CPUTime Raws/WallTime WallTime,s
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GOPR9172.GPR/threads:8/real_time_mean           39 ms         39 ms        128   0.311533          7.97323        12M       38.6828M        308.471M      3.22356        25.706  0.0390928
GOPR9172.GPR/threads:8/real_time_median         38 ms         38 ms        128   0.304231          7.99005        12M       39.4437M        315.527M      3.28698        26.294  0.0380316
GOPR9172.GPR/threads:8/real_time_stddev          3 ms          3 ms        128  0.0229149         0.133814          0       2.26225M        19.1421M     0.188521       1.59517   3.13671m
Comparing /home/lebedevri/rawspeed/build-clangs1-old/src/utilities/rsbench/rsbench to /home/lebedevri/rawspeed/build-clangs1-new/src/utilities/rsbench/rsbench
Benchmark                                                 Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------------------------
GOPR9172.GPR/threads:8/real_time_pvalue                 0.0000          0.0000      U Test, Repetitions: 128 vs 128
GOPR9172.GPR/threads:8/real_time_mean                  -0.0339         -0.0316            40            39            40            39
GOPR9172.GPR/threads:8/real_time_median                -0.0277         -0.0274            39            38            39            38
GOPR9172.GPR/threads:8/real_time_stddev                -0.1769         -0.1267             4             3             3             3
```
I.e. this results in //roughly// -3% improvements in perf.

While this will help [[ https://bugs.llvm.org/show_bug.cgi?id=36419 | PR36419 ]], it won't address it fully.

Reviewers: RKSimon, craig.topper, andreadb, spatel

Reviewed By: craig.topper

Subscribers: courbet, llvm-commits

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

llvm-svn: 351253

5 years agocompiler-rt/test: Clean up Android specific workarounds in lit.common.cfg.
Peter Collingbourne [Tue, 15 Jan 2019 21:27:44 +0000 (21:27 +0000)]
compiler-rt/test: Clean up Android specific workarounds in lit.common.cfg.

-pie -Wl,--enable-new-dtags are no longer needed because
the driver passes them by default as of r316606.

Prepend -fuse-ld=gold instead of appending it so that the linker can
be overridden using COMPILER_RT_TEST_COMPILER_CFLAGS.

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

llvm-svn: 351252

5 years agotreat invoke like call
David Callahan [Tue, 15 Jan 2019 21:26:51 +0000 (21:26 +0000)]
treat invoke like call

Summary:
InvokeInst should be treated like CallInst and
assigned a separate discriminator. This is particularly
import when an Invoke is converted to a Call
during compilation and so can invalidate sample profile
data collected wtih different link time optimizations

Reviewers: twoh, Kader, danielcdh, wmi

Reviewed By: wmi

Subscribers: llvm-commits

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

llvm-svn: 351251

5 years agoSimplify Value::GetValueByteSize()
Adrian Prantl [Tue, 15 Jan 2019 21:26:03 +0000 (21:26 +0000)]
Simplify Value::GetValueByteSize()

llvm-svn: 351250

5 years ago[clang-cl] Alias /Zc:alignedNew[-] to -f[no-]aligned-allocation
Reid Kleckner [Tue, 15 Jan 2019 21:24:55 +0000 (21:24 +0000)]
[clang-cl] Alias /Zc:alignedNew[-] to -f[no-]aligned-allocation

Implements PR40180.

clang-cl has one minor behavior difference with cl with this change.
Clang allows the user to enable the C++17 feature of aligned allocation
without enabling all of C++17, but MSVC will not call the aligned
allocation overloads unless -std:c++17 is passed. While our behavior is
technically incompatible, it would require making driver mode specific
changes to match MSVC precisely, and clang's behavior is useful because
it allows people to experiment with new C++17 features individually.
Therefore, I plan to leave it as is.

llvm-svn: 351249

5 years agogn build: Move target flags from toolchain to a .gni file.
Peter Collingbourne [Tue, 15 Jan 2019 21:24:00 +0000 (21:24 +0000)]
gn build: Move target flags from toolchain to a .gni file.

While here, add a use_lld flag and default it to true when using
clang on non-mac.

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

llvm-svn: 351248

5 years ago[SanitizerCoverage] Don't create comdat for interposable functions.
Matt Morehouse [Tue, 15 Jan 2019 21:21:01 +0000 (21:21 +0000)]
[SanitizerCoverage] Don't create comdat for interposable functions.

Summary:
Comdat groups override weak symbol behavior, allowing the linker to keep
the comdats for weak symbols in favor of comdats for strong symbols.

Fixes the issue described in:
https://bugs.chromium.org/p/chromium/issues/detail?id=918662

Reviewers: eugenis, pcc, rnk

Reviewed By: pcc, rnk

Subscribers: smeenai, rnk, bd1976llvm, hiraditya, llvm-commits

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

llvm-svn: 351247

5 years agogn build: Add build files for compiler-rt/lib/{hwasan,interception,sanitizer_common...
Peter Collingbourne [Tue, 15 Jan 2019 21:08:21 +0000 (21:08 +0000)]
gn build: Add build files for compiler-rt/lib/{hwasan,interception,sanitizer_common,ubsan}.

This allows the hwasan runtime to be built for Android aarch64.

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

llvm-svn: 351246

5 years agoEnable IAS for OpenBSD SPARC.
Brad Smith [Tue, 15 Jan 2019 21:04:36 +0000 (21:04 +0000)]
Enable IAS for OpenBSD SPARC.

llvm-svn: 351245

5 years agoSimplify code
Adrian Prantl [Tue, 15 Jan 2019 21:04:19 +0000 (21:04 +0000)]
Simplify code

llvm-svn: 351244

5 years agoAdd Doxygen comments.
Adrian Prantl [Tue, 15 Jan 2019 21:04:18 +0000 (21:04 +0000)]
Add Doxygen comments.

llvm-svn: 351243

5 years agogn build: Merge r351216, r351228.
Peter Collingbourne [Tue, 15 Jan 2019 21:02:49 +0000 (21:02 +0000)]
gn build: Merge r351216, r351228.

llvm-svn: 351242

5 years agoCodeGen: Remove debug printf unintentionally added in r351228.
Peter Collingbourne [Tue, 15 Jan 2019 20:59:59 +0000 (20:59 +0000)]
CodeGen: Remove debug printf unintentionally added in r351228.

llvm-svn: 351241

5 years ago[SLP] Added test for PR40310, NFC.
Alexey Bataev [Tue, 15 Jan 2019 20:54:44 +0000 (20:54 +0000)]
[SLP] Added test for PR40310, NFC.

llvm-svn: 351240

5 years agoImplement BlockDecl::Capture dump in terms of visitors
Stephen Kelly [Tue, 15 Jan 2019 20:41:37 +0000 (20:41 +0000)]
Implement BlockDecl::Capture dump in terms of visitors

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351239

5 years agollvm-objdump -m -D should disassemble all text segments
Michael Trent [Tue, 15 Jan 2019 20:41:30 +0000 (20:41 +0000)]
llvm-objdump -m -D should disassemble all text segments

Summary:
When running llvm-objdump with the -macho option objdump will by default
disassemble only the __TEXT,__text section (or __TEXT_EXEC,__text when
disassembling MH_KEXT_BUNDLE files). The -disassemble-all option is
treated no diferently than -disassemble.

This change upates llvm-objdump's MachO parsing code to disassemble all
__text sections found in a file when -disassemble-all is specified. This
is useful for disassembling files with more than one __text section, or
when disassembling files whose __text section is not present in __TEXT.

I added a lit test case that verifies "llvm-objdump -m -d" and
"llvm-objdump -m -D" produce the expected results on a reference binary.
I also updated the CommandGuide documentation for llvm-objdump.rst and
verified it renders correctly as man and html.

rdar://42899338

Reviewers: ab, pete, lhames

Reviewed By: lhames

Subscribers: rupprecht, llvm-commits

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

llvm-svn: 351238

5 years agoReplace auto -> llvm::Optional<uint64_t>
Adrian Prantl [Tue, 15 Jan 2019 20:33:58 +0000 (20:33 +0000)]
Replace auto -> llvm::Optional<uint64_t>

This addresses post-commit feedback for https://reviews.llvm.org/D56688

llvm-svn: 351237

5 years agoNFC: Implement OMPClause dump in terms of visitors
Stephen Kelly [Tue, 15 Jan 2019 20:31:31 +0000 (20:31 +0000)]
NFC: Implement OMPClause dump in terms of visitors

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351236

5 years agoImplement CXXCtorInitializer dump in terms of Visitor
Stephen Kelly [Tue, 15 Jan 2019 20:17:33 +0000 (20:17 +0000)]
Implement CXXCtorInitializer dump in terms of Visitor

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351235

5 years ago[X86] Add versions of the avx512 gather intrinsics that take the mask as a vXi1 vecto...
Craig Topper [Tue, 15 Jan 2019 20:12:33 +0000 (20:12 +0000)]
[X86] Add versions of the avx512 gather intrinsics that take the mask as a vXi1 vector instead of a scalar

In keeping with our general direction of having the vXi1 type present in IR, this patch converts the mask argument for avx512 gather to vXi1. This can avoid k-register to GPR to k-register transitions late in codegen.

I left the existing intrinsics behind because they have many out of tree users such as ISPC. They generate their own code and don't go through the autoupgrade path which only works for bitcode and ll parsing. Ideally we will get them to migrate to target independent intrinsics, but it might be easier for them to migrate to these new intrinsics.

I'll work on scatter and gatherpf/scatterpf next.

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

llvm-svn: 351234

5 years ago[MSP430] Recognize '{' as a line separator
Anton Korobeynikov [Tue, 15 Jan 2019 20:10:46 +0000 (20:10 +0000)]
[MSP430] Recognize '{' as a line separator

msp430-as supports multiple assembly statements on the same line
separated by a '{' character.

llvm-svn: 351233

5 years ago[MSVC Compat] Fix typo correction for inclusion directives.
Volodymyr Sapsai [Tue, 15 Jan 2019 20:08:23 +0000 (20:08 +0000)]
[MSVC Compat] Fix typo correction for inclusion directives.

In MSVC compatibility mode we were checking not the typo corrected
filename but the original filename.

Reviewers: christylee, compnerd

Reviewed By: christylee

Subscribers: jkorous, dexonsmith, sammccall, hokein, cfe-commits

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

llvm-svn: 351232

5 years ago[Nios2] Remove Nios2 backend
Craig Topper [Tue, 15 Jan 2019 19:59:19 +0000 (19:59 +0000)]
[Nios2] Remove Nios2 backend

As mentioned here http://lists.llvm.org/pipermail/llvm-dev/2019-January/129121.html This backend is incomplete and has not been maintained in several months.

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

llvm-svn: 351231

5 years ago[Nios2] Remove Nios2 backend
Craig Topper [Tue, 15 Jan 2019 19:58:36 +0000 (19:58 +0000)]
[Nios2] Remove Nios2 backend

As mentioned here http://lists.llvm.org/pipermail/llvm-dev/2019-January/129121.html This backend is incomplete and has not been maintained in several months.

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

llvm-svn: 351230

5 years ago[Tooling] Fix broken compliation databse tests.
Haojian Wu [Tue, 15 Jan 2019 19:51:39 +0000 (19:51 +0000)]
[Tooling] Fix broken compliation databse tests.

I forgot to update the unittest in r351222.

llvm-svn: 351229

5 years ago[MSP430] Provide a toolchain description
Anton Korobeynikov [Tue, 15 Jan 2019 19:44:05 +0000 (19:44 +0000)]
[MSP430] Provide a toolchain description

This is an initial implementation for msp430 toolchain including
-mmcu option support
-mhwmult options support
-integrated-as by default

The toolchain uses msp430-elf-as as a linker and supports msp430-gcc toolchain tree.

Patch by Kristina Bessonova!

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

llvm-svn: 351228

5 years ago[OpenMP] Fix for nested proc_bind affinity bug
Jonathan Peyton [Tue, 15 Jan 2019 19:39:32 +0000 (19:39 +0000)]
[OpenMP] Fix for nested proc_bind affinity bug

Using proc_bind clause on a nested #pragma omp parallel region
with KMP_AFFINITY set causes an assertion error. This assertion occurs because
the place-partition-var is not properly initialized in the nested master threads.
Trying to get an intuitive result with KMP_AFFINITY + proc_bind is difficult
because of how the KMP_AFFINITY gtid-to-place mapping occurs. This
patch creates an initial place list no matter what affinity mechanism is used.
For KMP_AFFINITY, the place-partition-var is initialized to all the places.

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

llvm-svn: 351227

5 years agoFix size_t/off_t mixup in std::filesystem.
Dan Albert [Tue, 15 Jan 2019 19:16:25 +0000 (19:16 +0000)]
Fix size_t/off_t mixup in std::filesystem.

Summary: ftruncate takes an off_t, not a size_t.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351226

5 years agoAdd large file support to create_file for 32-bit.
Dan Albert [Tue, 15 Jan 2019 19:14:15 +0000 (19:14 +0000)]
Add large file support to create_file for 32-bit.

Summary:
The tests need to create files larger than 2GB, but size_t is 32-bit
on a 32-bit system. Make use of explicit off64_t APIs so we can still
use a default off_t for the tests while enabling 64-bit file offsets
for create_file.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351225

5 years ago[OpenMP] Add lock function definitions to fix Bug 40042
Jonathan Peyton [Tue, 15 Jan 2019 19:14:00 +0000 (19:14 +0000)]
[OpenMP] Add lock function definitions to fix Bug 40042

This change fixes the sanity issue reported in Bug 40042.
Lock function definitions for the three lock kinds were added
to disambiguate calls to the lock functions done directly and indirectly.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=40042
Patch by Hansang Bae

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

llvm-svn: 351224

5 years ago[OpenMP][Cmake] Allowed OpenMP testing detect test compiler with same generator
Jonathan Peyton [Tue, 15 Jan 2019 19:08:26 +0000 (19:08 +0000)]
[OpenMP][Cmake] Allowed OpenMP testing detect test compiler with same generator

Fix ninja build detect test compiler failed under windows.

Patch by Peiyuan Song

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

llvm-svn: 351223

5 years ago[Tooling] Make clang-tool find libc++ dir on mac when running on a file without compi...
Haojian Wu [Tue, 15 Jan 2019 19:05:50 +0000 (19:05 +0000)]
[Tooling] Make clang-tool find libc++ dir on mac when running on a file without compilation database.

Summary:
This is a regression of r348365.

When clang-tools run on a file without a complation database (`clang-check /tmp/t.cc`),
we will use fixed compilation database as a fallback. However the actual compiler
path in the fallback complation command is just `clang-tool` which is
insufficient to detect the libc++ dir.

Reviewers: ilya-biryukov, EricWF

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 351222

5 years ago[OpenMP] Fix performance regression in SPEC kdtree test
Jonathan Peyton [Tue, 15 Jan 2019 18:57:24 +0000 (18:57 +0000)]
[OpenMP] Fix performance regression in SPEC kdtree test

Make __ompt_implicit_task_end a static function and remove the inline part.  Remove
pId variable that is unused.  This fixes small regression in SPEC kdtree benchmark.
Also reformat some of __ompt_implicit_task_end.

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

llvm-svn: 351221

5 years ago[libc++] Support different libc++ namespaces in the iterator test
Petr Hosek [Tue, 15 Jan 2019 18:55:55 +0000 (18:55 +0000)]
[libc++] Support different libc++ namespaces in the iterator test

libc++ allows changing the namespace, don't assume __1 in the test
to avoid the test failure if different namespace is being used.

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

llvm-svn: 351220

5 years agoReapply "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"
Nikita Popov [Tue, 15 Jan 2019 18:43:41 +0000 (18:43 +0000)]
Reapply "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"

Related to https://bugs.llvm.org/show_bug.cgi?id=40123.

Rather than scalarizing, expand a vector USUBSAT into UMAX+SUB,
which produces much better code for X86.

Reapplying with updated SLPVectorizer tests.

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

llvm-svn: 351219

5 years agoDo not emit a corrupt symbol table entry for .rela_iplt_{start,end}.
Rui Ueyama [Tue, 15 Jan 2019 18:30:23 +0000 (18:30 +0000)]
Do not emit a corrupt symbol table entry for .rela_iplt_{start,end}.

If .rela.iplt does not exist, we used to emit a corrupt symbol table
that contains two symbols, .rela_iplt_{start,end}, pointing to a
nonexisting section.

This patch fixes the issue by setting section index 0 to the symbols
if .rel.iplt section does not exist.

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

llvm-svn: 351218

5 years ago[Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC.
Brad Smith [Tue, 15 Jan 2019 18:24:03 +0000 (18:24 +0000)]
[Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC.

llvm-svn: 351217

5 years ago[WebAssembly] Fix updating/moving DBG_VALUEs in RegStackify
Yury Delendik [Tue, 15 Jan 2019 18:14:12 +0000 (18:14 +0000)]
[WebAssembly] Fix updating/moving DBG_VALUEs in RegStackify

Summary:
As described in PR40209, there can be issues in DBG_VALUEs handling when multiple defs present in a BB. This patch
adds logic for detection of related to def DBG_VALUEs and localizes register update and movement to found DBG_VALUEs.

Reviewers: aheejin

Subscribers: mgorny, dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 351216

5 years agoSilence compiler warnings
Adrian Prantl [Tue, 15 Jan 2019 18:07:54 +0000 (18:07 +0000)]
Silence compiler warnings

llvm-svn: 351215

5 years agoMake CompilerType::getBitSize() / getByteSize() return an optional result. NFC
Adrian Prantl [Tue, 15 Jan 2019 18:07:52 +0000 (18:07 +0000)]
Make CompilerType::getBitSize() / getByteSize() return an optional result. NFC

The code in LLDB assumes that CompilerType and friends use the size 0
as a sentinel value to signal an error. This works for C++, where no
zero-sized type exists, but in many other programming languages
(including I believe C) types of size zero are possible and even
common. This is a particular pain point in swift-lldb, where extra
code exists to double-check that a type is *really* of size zero and
not an error at various locations.

To remedy this situation, this patch starts by converting
CompilerType::getBitSize() and getByteSize() to return an optional
result. To avoid wasting space, I hand-rolled my own optional data
type assuming that no type is larger than what fits into 63
bits. Follow-up patches would make similar changes to the ValueObject
hierarchy.

rdar://problem/47178964

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

llvm-svn: 351214

5 years ago[WebAssembly] Update release notes
Derek Schuff [Tue, 15 Jan 2019 17:54:42 +0000 (17:54 +0000)]
[WebAssembly] Update release notes

Summary:
Explicitly note that multithreading support is not included in the stable
ABI.

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

llvm-svn: 351213

5 years agoFix cpu-dispatch MV regression caused by r347812
Erich Keane [Tue, 15 Jan 2019 17:51:09 +0000 (17:51 +0000)]
Fix cpu-dispatch MV regression caused by r347812

r347812 permitted forward declarations for cpu-dispatch functions, which
are occassionally useful as exposition in  header files.  However, this inadvertently
permitted this function to become multiversioned after a usage.  This
patch ensures that the "CausesMV" checks are still run in the
forward-declaration case.

Change-Id: Icb6f975a2d068f088b89e3bbe26cf1d24f5a972c
llvm-svn: 351212

5 years agoWe can improve the performance (generally) by memo-izing the action to map a debug...
David Callahan [Tue, 15 Jan 2019 17:45:54 +0000 (17:45 +0000)]
We can improve the performance (generally) by memo-izing the action to map a debug location to its function summary.

Summary:
Here are timings (as reported by "opt -time-passes") for
sample-profile pass for some files holding hot functions from a major
service©r. Average 17% reduction. Delta column is 100*(old-new)/old.

```
Old    New    Delta
0.0537 0.0538 -0.2%
0.8155 0.6522 20.0%
0.0779 0.0751  3.6%
0.0727 0.0913 -25.6%
0.1622 0.1302 19.7%
0.0627 0.0594  5.3%
0.0766 0.0744  2.9%
0.6426 0.4387 31.7%
0.3521 0.2776 21.2%
0.3549 0.2721 23.3%
0.0912 0.0904  0.9%
0.1236 0.1059 14.3%
0.0854 0.0866 -1.4%
0.0757 0.0722  4.6%
0.1293 0.1147 11.3%
0.1354 0.1122 17.1%
0.0767 0.0770 -0.4%
0.1135 0.0968 14.7%
0.0524 0.0608 -16.0%
0.1279 0.1106 13.5%
==========
3.6820 3.0520 17.1% Total
```

Reviewers: twoh, Kader, danielcdh, wmi

Reviewed By: wmi

Subscribers: dblaikie, llvm-commits

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

llvm-svn: 351211

5 years agoRevert "[X86] Make _xgetbv/_xsetbv on non-windows platforms"
Benjamin Kramer [Tue, 15 Jan 2019 17:23:36 +0000 (17:23 +0000)]
Revert "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

This reverts commit r351160. Breaks building v8.

llvm-svn: 351210

5 years agoRevert "Correct the source range returned from preprocessor callbacks."
Benjamin Kramer [Tue, 15 Jan 2019 17:20:05 +0000 (17:20 +0000)]
Revert "Correct the source range returned from preprocessor callbacks."

This reverts commit r350891. Also add a test case that would return an
empty string with r350891.

llvm-svn: 351209

5 years agoRevert "Update clang-tools-extra for r350891 from Clang."
Benjamin Kramer [Tue, 15 Jan 2019 17:20:04 +0000 (17:20 +0000)]
Revert "Update clang-tools-extra for r350891 from Clang."

This reverts commit r350892.

llvm-svn: 351208

5 years ago[SelectionDAG] Check membership of register in class for single
Nirav Dave [Tue, 15 Jan 2019 17:09:23 +0000 (17:09 +0000)]
[SelectionDAG] Check membership of register in class for single
register constraints. NFCI.

Now that X86's ST(7) constraints are fixed this check can be
reinstated.

llvm-svn: 351207

5 years ago[X86] Fix register class for assembly constraints to ST(7). NFCI.
Nirav Dave [Tue, 15 Jan 2019 17:09:14 +0000 (17:09 +0000)]
[X86] Fix register class for assembly constraints to ST(7). NFCI.

Modify getRegForInlineAsmConstraint to return special singleton
register class when a constraint references ST(7) not RFP80 for which
ST(7) is not a member.

llvm-svn: 351206

5 years ago[llvm-readelf] Allow single-letter flags to be merged.
Jordan Rupprecht [Tue, 15 Jan 2019 17:04:40 +0000 (17:04 +0000)]
[llvm-readelf] Allow single-letter flags to be merged.

Summary:
This patch adds support for merged arguments (e.g. -SW == -S -W) for llvm-readelf.

No changes are intended for llvm-readobj. There are a few short flags (-sd, -sr, -st, -dt) that would conflict with grouped single letter flags, and having only some grouped flags might be confusing. So, allow merged flags for readelf compatibility, but force separate args for llvm-readobj. From what I can tell, these two-letter flags are only used with llvm-readobj, not llvm-readelf.

This fixes PR40064.

Reviewers: jhenderson, kristina, echristo, phosek

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 351205

5 years ago[llvm-objcopy] Use SHT_NOTE for added note sections.
Jordan Rupprecht [Tue, 15 Jan 2019 16:57:23 +0000 (16:57 +0000)]
[llvm-objcopy] Use SHT_NOTE for added note sections.

Summary:
Fix llvm-objcopy to add .note sections as SHT_NOTEs. GNU objcopy overrides section flags for special sections. For `.note` sections (with the exception of `.note.GNU-stack`), SHT_NOTE is used.

Many other sections are special cased by libbfd, but `.note` is the only special section I can seem to find being used with objcopy --add-section.

See `.note` in context of the full list of special sections here: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf.c;h=eb3e1828e9c651678b95a1dcbc3b124783d1d2be;hb=HEAD#l2675

Reviewers: jhenderson, alexshap, jakehehrlich, espindola

Reviewed By: jhenderson

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 351204

5 years ago[X86] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero (PR40306)
Simon Pilgrim [Tue, 15 Jan 2019 16:56:55 +0000 (16:56 +0000)]
[X86] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero (PR40306)

If we're shuffling with a zero vector, then we are better off not doing VECTOR_SHUFFLE(UNPCK()) as we lose track of those zero elements.

We were already doing this for SSSE3 targets as we have PSHUFB, but its worth doing for all targets.

llvm-svn: 351203

5 years agogn build: Don't assume valgrind.h exists on Linux
Hans Wennborg [Tue, 15 Jan 2019 16:51:45 +0000 (16:51 +0000)]
gn build: Don't assume valgrind.h exists on Linux

It didn't on my machine, so defaulting it to off seems better.

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

llvm-svn: 351202

5 years ago[X86] Add PR40318 shuffle test case
Simon Pilgrim [Tue, 15 Jan 2019 16:31:10 +0000 (16:31 +0000)]
[X86] Add PR40318 shuffle test case

The other test case is already covered by the PR40306 test case, which was mainly concerned with SSSE3 codegen.

llvm-svn: 351201

5 years agoRemove irrelevant references to legacy git repositories from
James Y Knight [Tue, 15 Jan 2019 16:18:52 +0000 (16:18 +0000)]
Remove irrelevant references to legacy git repositories from
compiler identification lines in test-cases.

(Doing so only because it's then easier to search for references which
are actually important and need fixing.)

llvm-svn: 351200

5 years ago[SLP][X86] Split prefer-256-bit 'AVX256BW' tests from AVX2 checks
Simon Pilgrim [Tue, 15 Jan 2019 16:13:37 +0000 (16:13 +0000)]
[SLP][X86] Split prefer-256-bit 'AVX256BW' tests from AVX2 checks

Fixes SLP test issue with D56636

llvm-svn: 351199

5 years ago[DAGCombiner] reduce buildvec of zexted extracted element to shuffle
Sanjay Patel [Tue, 15 Jan 2019 16:11:05 +0000 (16:11 +0000)]
[DAGCombiner] reduce buildvec of zexted extracted element to shuffle

The motivating case for this is shown in the first regression test. We are
transferring to scalar and back rather than just zero-extending with 'vpmovzxdq'.

That's a special-case for a more general pattern as shown here. In all tests,
we're avoiding the vector-scalar-vector moves in favor of vector ops.

We aren't producing optimal shuffle code in some cases though, so the patch is
limited to reduce regressions.

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

llvm-svn: 351198

5 years ago[OMPT] Second chunk of final OMPT 5.0 interface updates
Joachim Protze [Tue, 15 Jan 2019 15:36:53 +0000 (15:36 +0000)]
[OMPT] Second chunk of final OMPT 5.0 interface updates

The omp-tools.h file is generated from the OpenMP spec to ensure that the interface
is implemented as specified.
The other changes are necessary to update the interface implementation to the
final version as published in 5.0.
The omp-tools.h header was previously called ompt.h, currently a copy under this name
is installed for legacy tools.

Patch partially perpared by @sconvent

Reviewers: AndreyChurbanov, hbae, Hahnfeld

Reviewed By: hbae

Tags: #openmp, #ompt

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

llvm-svn: 351197

5 years agoReduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851
Alexander Kornienko [Tue, 15 Jan 2019 15:34:26 +0000 (15:34 +0000)]
Reduce ASTMatchers stack footprint. Addresses llvm.org/PR38851

The BoundNodesTreeBuilder class is used both directly and indirectly as a local
variable in matchesAncestorOfRecursively, memoizedMatchesAncestorOfRecursively
and other functions that happen to be on long recursive call paths. By reducing
the inline storage size of the SmallVector we dramatically reduce the stack
requirements of ASTMatchers. Running clang-tidy with a large number of checks
enabled on a few arbitrarily chosen files show no performance regression.

llvm-svn: 351196

5 years agoRevert r351138 "[ORC] Move ORC Core symbol map and set types into their own
Lang Hames [Tue, 15 Jan 2019 15:21:13 +0000 (15:21 +0000)]
Revert r351138 "[ORC] Move ORC Core symbol map and set types into their own
header: CoreTypes.h."

This commit broke some bots. Reverting while I investigate.

llvm-svn: 351195

5 years agoUpdate year in license files
Hans Wennborg [Tue, 15 Jan 2019 15:10:32 +0000 (15:10 +0000)]
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

llvm-svn: 351194

5 years ago[SimpleLoopUnswitch] Increment stats counter for unswitching switch instruction
Zaara Syeda [Tue, 15 Jan 2019 15:08:01 +0000 (15:08 +0000)]
[SimpleLoopUnswitch] Increment stats counter for unswitching switch instruction

Increment statistics counter NumSwitches at unswitchNontrivialInvariants() for
unswitching a non-trivial switch instruction. This is to fix a bug that it
increments NumBranches even for the case of switch instruction.
There is no functional change in this patch.

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

llvm-svn: 351193

5 years ago[llvm-obdump] - Fix the help lines for -stop-address and -z.
George Rimar [Tue, 15 Jan 2019 14:03:50 +0000 (14:03 +0000)]
[llvm-obdump] - Fix the help lines for -stop-address and -z.

It was broken by me by mistake in r350823 during addressing the
review comment before committing (changed not the right text line).

llvm-svn: 351192

5 years agoRevert little bad rebasing.
David Carlier [Tue, 15 Jan 2019 13:08:20 +0000 (13:08 +0000)]
Revert little bad rebasing.

llvm-svn: 351191

5 years ago[Sanitizer] Intercept sl_add api on FreeBSD/NetBSD
David Carlier [Tue, 15 Jan 2019 11:21:33 +0000 (11:21 +0000)]
[Sanitizer] Intercept sl_add api on FreeBSD/NetBSD

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 351189

5 years ago[OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t variants...
Roman Lebedev [Tue, 15 Jan 2019 11:20:02 +0000 (11:20 +0000)]
[OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t variants are OpenCL-1.2+, mark them as such

Summary:
Refer to [[ https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=242 | `6.11.13.2 Built-in Image Functions` ]],
and [[ https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=306 | `9.6.8 Image Read and Write Functions` ]] of the OpenCL 1.1 spec.

* There is no mention of `image1d_array_t` and `image2d_array_t` anywhere in the OpenCL 1.1 spec.
* All the `read_image{f,i,ui,h}()` functions, as of OpenCL 1.1 spec, have a second required parameter `sampler_t sampler`

Should have prevented the following regression:
https://redmine.darktable.org/issues/12493

Reviewers: yaxunl, Anastasia, echuraev, asavonic

Reviewed By: Anastasia

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 351188

5 years ago[InstCombine] Don't undo 0 - (X * Y) canonicalization when combining subs.
Florian Hahn [Tue, 15 Jan 2019 11:18:21 +0000 (11:18 +0000)]
[InstCombine] Don't undo 0 - (X * Y) canonicalization when combining subs.

Otherwise instcombine gets stuck in a cycle. The canonicalization was
added in D55961.

This patch fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12400

llvm-svn: 351187

5 years ago[ELF][AArch64] Add missing PLT relocations to isStaticLinkTimeConstant
Peter Smith [Tue, 15 Jan 2019 11:17:03 +0000 (11:17 +0000)]
[ELF][AArch64] Add missing PLT relocations to isStaticLinkTimeConstant

r347650 fixed pr38074 for AArch64 for static linking. It added two new
RelExpr instances R_AARCH64_GOT_PAGE_PC_PLT and R_GOT_PLT. These need to be
added to isStaticLinkTimeConstant so that the address of an ifunc can be
taken when building a shared library.

fixes pr40250

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

llvm-svn: 351186

5 years ago[NFC] Remove some code duplication
Max Kazantsev [Tue, 15 Jan 2019 11:16:14 +0000 (11:16 +0000)]
[NFC] Remove some code duplication

llvm-svn: 351185

5 years ago[compiler-rt] alignment-assumption-blacklist.cpp test apparently passes on android...
Roman Lebedev [Tue, 15 Jan 2019 10:48:51 +0000 (10:48 +0000)]
[compiler-rt] alignment-assumption-blacklist.cpp test apparently passes on android, un-XFAIL it.

llvm-svn: 351184

5 years ago[NFC] Remove obsolete enum RangeCheckKind
Max Kazantsev [Tue, 15 Jan 2019 10:48:45 +0000 (10:48 +0000)]
[NFC] Remove obsolete enum RangeCheckKind

llvm-svn: 351183

5 years ago[NFC][X86] extract-bits.ll: add test with truncation with extra-use.
Roman Lebedev [Tue, 15 Jan 2019 10:36:20 +0000 (10:36 +0000)]
[NFC][X86] extract-bits.ll: add test with truncation with extra-use.

That extra-use *should* prevent D56052 from looking past the trunc.

llvm-svn: 351182

5 years ago[compiler-rt] fuzzer-alignment-assumption.test: fixup the expected column number
Roman Lebedev [Tue, 15 Jan 2019 10:25:14 +0000 (10:25 +0000)]
[compiler-rt] fuzzer-alignment-assumption.test: fixup the expected column number

llvm-svn: 351181

5 years ago[NFC] Decrease if nest
Max Kazantsev [Tue, 15 Jan 2019 10:01:46 +0000 (10:01 +0000)]
[NFC] Decrease if nest

llvm-svn: 351180

5 years ago[NFC] Move some functions to LoopUtils
Max Kazantsev [Tue, 15 Jan 2019 09:51:34 +0000 (09:51 +0000)]
[NFC] Move some functions to LoopUtils

llvm-svn: 351179

5 years ago[compiler-rt][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Tue, 15 Jan 2019 09:44:27 +0000 (09:44 +0000)]
[compiler-rt][UBSan] Sanitization for alignment assumptions.

Summary:
This is the compiler-rt part.
The clang part is D54589.

This is a second commit, the original one was r351106,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Now, i have fundamentally changed the testing approach:
i malloc a few bytes, intentionally mis-align the pointer
(increment it by one), and check that. Also, i have decreased
the expected alignment. This hopefully should be enough to pacify
all the bots. If not, i guess i might just drop the two 'bad' tests.

Reviewers: filcab, vsk, #sanitizers, vitalybuka, rsmith, morehouse

Reviewed By: morehouse

Subscribers: rjmccall, krytarowski, rsmith, kcc, srhines, kubamracek, dberris, llvm-commits

Tags: #sanitizers

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

llvm-svn: 351178

5 years ago[clang][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Tue, 15 Jan 2019 09:44:25 +0000 (09:44 +0000)]
[clang][UBSan] Sanitization for alignment assumptions.

Summary:
UB isn't nice. It's cool and powerful, but not nice.
Having a way to detect it is nice though.
[[ https://wg21.link/p1007r3 | P1007R3: std::assume_aligned ]] / http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1007r2.pdf says:
```
We propose to add this functionality via a library function instead of a core language attribute.
...
If the pointer passed in is not aligned to at least N bytes, calling assume_aligned results in undefined behaviour.
```

This differential teaches clang to sanitize all the various variants of this assume-aligned attribute.

Requires D54588 for LLVM IRBuilder changes.
The compiler-rt part is D54590.

This is a second commit, the original one was r351105,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Reviewers: ABataev, craig.topper, vsk, rsmith, rnk, #sanitizers, erichkeane, filcab, rjmccall

Reviewed By: rjmccall

Subscribers: chandlerc, ldionne, EricWF, mclow.lists, cfe-commits, bkramer

Tags: #sanitizers

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

llvm-svn: 351177

5 years ago[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions
Roman Lebedev [Tue, 15 Jan 2019 09:44:13 +0000 (09:44 +0000)]
[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions

Summary:
Clang calls these functions to produce IR for assume-aligned attributes.
I would like to teach UBSAN to verify these assumptions.
For that, i need to access the final pointer on which the check is performed,
and the actual `icmp` that does the check.

The alternative to this would be to fully re-implement this in clang.

This is a second commit, the original one was r351104,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Reviewers: spatel, dneilson, craig.topper, dblaikie, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 351176

5 years agoNFC: Move Decl node handling to TextNodeDumper
Stephen Kelly [Tue, 15 Jan 2019 09:35:52 +0000 (09:35 +0000)]
NFC: Move Decl node handling to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351175

5 years ago[llvm-objcopy] [COFF] Implement --strip-all[-gnu] for symbols
Martin Storsjo [Tue, 15 Jan 2019 09:34:55 +0000 (09:34 +0000)]
[llvm-objcopy] [COFF] Implement --strip-all[-gnu] for symbols

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

llvm-svn: 351174

5 years ago[llvm-objcopy] [COFF] Remove pointless comment chars from .test files. NFC.
Martin Storsjo [Tue, 15 Jan 2019 09:34:45 +0000 (09:34 +0000)]
[llvm-objcopy] [COFF] Remove pointless comment chars from .test files. NFC.

llvm-svn: 351173

5 years ago[ASTDump] NFC: Move dump of type nodes to NodeDumper
Stephen Kelly [Tue, 15 Jan 2019 09:30:00 +0000 (09:30 +0000)]
[ASTDump] NFC: Move dump of type nodes to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351172

5 years ago[llvm-objdump] - Cleanup the code. NFCI.
George Rimar [Tue, 15 Jan 2019 09:19:18 +0000 (09:19 +0000)]
[llvm-objdump] - Cleanup the code. NFCI.

This is a cosmetic cleanup for the llvm-objdump code.

This patch:
* Renames things to match the official LLVM code style (lower case -> upper case).
* Removes few obviously excessive variables.
* Moves a few lines closer to the place of use, reorders the code a bit to simplify it,
to avoid doing excessive returns and to avoid using 'else` after returns.

I focused only on a llvm-objdump.h/llvm-objdump.cpp files. Few changes in the
MachODump.cpp and COFFDump.cpp are a result of llvm-objdump.h modification.

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

llvm-svn: 351171

5 years ago[clangd] Fix updated file detection logic in indexing
Kadir Cetinkaya [Tue, 15 Jan 2019 09:03:33 +0000 (09:03 +0000)]
[clangd] Fix updated file detection logic in indexing

Summary:
Files without any symbols were never marked as updated during indexing, which resulted in failure while writing shards for these files.

This patch fixes the logic to mark files that are seen for the first time but don't contain any symbols as updated.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 351170

5 years agoExplicitly set C++ standard for `Posix/no-fd.cc` ASan test.
Dan Liew [Tue, 15 Jan 2019 08:54:10 +0000 (08:54 +0000)]
Explicitly set C++ standard for `Posix/no-fd.cc` ASan test.

Summary:
The test uses `nullptr` which can break running the test if the
compiler happens to be using something older than C++11 as the default
language standard. Avoid this by explicitly setting the standard.

rdar://problem/47253542

Reviewers: eugenis, yln, vitalybuka

Subscribers: kubamracek, #sanitizers, llvm-commits

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

llvm-svn: 351169

5 years agogn build: Rename llvm_host_triple to llvm_current_triple and have it use current_...
Peter Collingbourne [Tue, 15 Jan 2019 08:20:29 +0000 (08:20 +0000)]
gn build: Rename llvm_host_triple to llvm_current_triple and have it use current_{cpu,os}.

This makes e.g. ToolChain::isCrossCompiling() in
clang/lib/Driver/ToolChain.cpp return the correct result
if the compiler was cross-compiled. This change also affects
llvm_default_target_triple, so cross-compiled compilers default to
targeting the cross-compilation target, which makes more sense than
the host that the compiler was compiled on.

This change will also be necessary in order for the correct triples
to appear in generated lit files for non-native targets.

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

llvm-svn: 351168

5 years agogn build: Make a couple of improvements to the unix toolchain.
Peter Collingbourne [Tue, 15 Jan 2019 08:14:38 +0000 (08:14 +0000)]
gn build: Make a couple of improvements to the unix toolchain.

Add an asm tool (will be required for building sanitizer_common on
x64) and set a soname for DSOs so that anything that links against
them gets the correct DT_NEEDED.

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

llvm-svn: 351167

5 years agogn build: Switch to using current_os in lib/Support/BUILD.gn.
Peter Collingbourne [Tue, 15 Jan 2019 07:17:03 +0000 (07:17 +0000)]
gn build: Switch to using current_os in lib/Support/BUILD.gn.

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

llvm-svn: 351166

5 years ago[X86] Upgrade some avx512bw shift intrinsics that were removed a while ago. NFC
Craig Topper [Tue, 15 Jan 2019 07:15:20 +0000 (07:15 +0000)]
[X86] Upgrade some avx512bw shift intrinsics that were removed a while ago. NFC

Masking was removed from these intrinsics and I guess we didn't update the tests then.

llvm-svn: 351165

5 years ago[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it
Dan Gohman [Tue, 15 Jan 2019 06:58:16 +0000 (06:58 +0000)]
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it

This adds support for multilib paths for wasm32 targets, following
[Debian's Multiarch conventions], and also adds an experimental OS name in
order to test it.

[Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/

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

llvm-svn: 351164

5 years ago[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it
Dan Gohman [Tue, 15 Jan 2019 06:58:13 +0000 (06:58 +0000)]
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it

This adds support for multilib paths for wasm32 targets, following
[Debian's Multiarch conventions], and also adds an experimental OS name in
order to test it.

[Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/

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

llvm-svn: 351163