platform/upstream/llvm.git
5 years ago[RegisterValue] Rewrite operator!= in terms of operator==. NFCI.
Davide Italiano [Sat, 29 Dec 2018 05:05:23 +0000 (05:05 +0000)]
[RegisterValue] Rewrite operator!= in terms of operator==. NFCI.

llvm-svn: 350149

5 years ago[CompilerType] Simplify operator!=. NFCI.
Davide Italiano [Sat, 29 Dec 2018 05:00:33 +0000 (05:00 +0000)]
[CompilerType] Simplify operator!=. NFCI.

llvm-svn: 350148

5 years ago[CompilerType] Remove dead code. NFCI.
Davide Italiano [Sat, 29 Dec 2018 04:59:07 +0000 (04:59 +0000)]
[CompilerType] Remove dead code. NFCI.

llvm-svn: 350147

5 years ago[SymbolContext] Rewrite operator== to be more concise.
Davide Italiano [Sat, 29 Dec 2018 04:57:00 +0000 (04:57 +0000)]
[SymbolContext] Rewrite operator== to be more concise.

And probably, less error prone. NFCI.

llvm-svn: 350146

5 years agoDrop SE cache early because loop parent can change in LoopSimplifyCFG
Max Kazantsev [Sat, 29 Dec 2018 04:26:22 +0000 (04:26 +0000)]
Drop SE cache early because loop parent can change in LoopSimplifyCFG

llvm-svn: 350145

5 years ago[WebAssembly] Fix comments in ExplicitLocals (NFC)
Heejin Ahn [Sat, 29 Dec 2018 02:42:04 +0000 (02:42 +0000)]
[WebAssembly] Fix comments in ExplicitLocals (NFC)

llvm-svn: 350144

5 years agoAdd vtable anchor to classes.
Richard Trieu [Sat, 29 Dec 2018 02:02:30 +0000 (02:02 +0000)]
Add vtable anchor to classes.

llvm-svn: 350143

5 years agoAdd vtable anchor to classes.
Richard Trieu [Sat, 29 Dec 2018 02:02:13 +0000 (02:02 +0000)]
Add vtable anchor to classes.

llvm-svn: 350142

5 years ago[X86] Don't mark SEXTLOAD v4i8->v4i64 and v8i8->v8i64 as custom under vector widening...
Craig Topper [Sat, 29 Dec 2018 01:17:11 +0000 (01:17 +0000)]
[X86] Don't mark SEXTLOAD v4i8->v4i64 and v8i8->v8i64 as custom under vector widening legalization.

This was tricking us into making these operations and then letting them get scalarized later. But I can't prove that the scalarized version is actually better.

llvm-svn: 350141

5 years agoReenable hard_rss_limit_mb_test.cc for android-26
Kamil Rytarowski [Sat, 29 Dec 2018 00:35:49 +0000 (00:35 +0000)]
Reenable hard_rss_limit_mb_test.cc for android-26

Noted by eugenis@ in D55887.

llvm-svn: 350140

5 years agoAdd support for background thread on NetBSD in ASan
Kamil Rytarowski [Sat, 29 Dec 2018 00:32:07 +0000 (00:32 +0000)]
Add support for background thread on NetBSD in ASan

Summary:
Change the point of calling MaybeStartBackgroudThread() from AsanInitInternal()
that is too early on NetBSD to a constructor (with aid of C++11 lambda construct).

Enable the code for background thread as is for NetBSD.

Rename test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc
to test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cc and allow runs
on NetBSD. This tests passes correctly.

Reviewers: vitalybuka, joerg, eugenis

Reviewed By: eugenis

Subscribers: eugenis, kubamracek, fedor.sergeev, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350139

5 years ago[Sanitizer] Enable getfsent api for Darwin
David Carlier [Sat, 29 Dec 2018 00:17:21 +0000 (00:17 +0000)]
[Sanitizer] Enable getfsent api for Darwin

Reviewers: vitalybuka, kubamracek

Reviewed By: vitalybuka

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

llvm-svn: 350138

5 years ago[OPENMP][NVPTX]Added/fixed debugging messages, NFC.
Alexey Bataev [Fri, 28 Dec 2018 21:36:09 +0000 (21:36 +0000)]
[OPENMP][NVPTX]Added/fixed debugging messages, NFC.

Summary: Added or fixed new/old debugging messages for the better diagnostics.

Reviewers: gtbercea, kkwli0, grokos

Reviewed By: grokos

Subscribers: caomhin, guansong, openmp-commits

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

llvm-svn: 350137

5 years agoIntroduce `LocalAddressSpaceView::LoadWritable(...)` and make the `Load(...)` method...
Dan Liew [Fri, 28 Dec 2018 19:30:51 +0000 (19:30 +0000)]
Introduce `LocalAddressSpaceView::LoadWritable(...)` and make the `Load(...)` method return a const pointer.

Summary:
This is a follow-up to r346956 (https://reviews.llvm.org/D53975).

The purpose of this change to allow implementers of the
`AddressSpaceView` to be able to distinguish between when a caller wants
read-only memory and when a caller wants writable memory. Being able
distinguish these cases allows implementations to optimize for the
different cases and also provides a way to workaround possible platform
restrictions (e.g. the low level platform interface for reading
out-of-process memory may place memory in read-only pages).

For allocator enumeration in almost all cases read-only is sufficient so
we make `Load(...)` take on this new requirement and introduce the
`LoadWritable(...)` variants for cases where memory needs to be
writable.

The behaviour of `LoadWritable(...)` documented in comments are
deliberately very restrictive so that it will be possible in the future
to implement a simple write-cache (i.e. just a map from target address
to a writable region of memory). These restrictions can be loosened in
the future if necessary by implementing a more sophisticated
write-cache.

rdar://problem/45284065

Reviewers: kcc, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 350136

5 years ago[UnrollRuntime] NFC: Updated exiting tests and added more tests
Anna Thomas [Fri, 28 Dec 2018 19:21:50 +0000 (19:21 +0000)]
[UnrollRuntime] NFC: Updated exiting tests and added more tests

Added more tests for multiple exiting blocks to the LatchExit.
Today these cases are not supported. Patch to follow soon.

llvm-svn: 350135

5 years ago[X86] Directly emit X86ISD::PMULUDQ from the ReplaceNodeResults handling of v2i8...
Craig Topper [Fri, 28 Dec 2018 19:19:39 +0000 (19:19 +0000)]
[X86] Directly emit X86ISD::PMULUDQ from the ReplaceNodeResults handling of v2i8/v2i16/v2i32 multiply.

Previously we emitted a multiply and some masking that was supposed to matched to PMULUDQ, but the masking could sometimes be removed before we got a chance to match it. So instead just emit the PMULUDQ directly.

Remove the DAG combine that was added when the ReplaceNodeResults code was originally added. Add a new DAG combine to avoid regressions in shrink_vmul.ll

Some of the shrink_vmul.ll test cases now pick PMULUDQ instead of PMADDWD/PMULLD, but I think this should be an improvement on most CPUs.

I think all of this can go away if/when we switch to -x86-experimental-vector-widening-legalization

llvm-svn: 350134

5 years ago[clang-tidy] Export the abseil duration inverse lookup function, NFC
Hyrum Wright [Fri, 28 Dec 2018 19:04:21 +0000 (19:04 +0000)]
[clang-tidy] Export the abseil duration inverse lookup function, NFC

This allows other tools to use this function.

llvm-svn: 350133

5 years agoSpeculative fix for xray assembler error on MachO since r349976
Reid Kleckner [Fri, 28 Dec 2018 18:53:00 +0000 (18:53 +0000)]
Speculative fix for xray assembler error on MachO since r349976

This .file directive wasn't doing anything on MachO, and now that's
diagnosed as an error.

llvm-svn: 350132

5 years ago[UnrollRuntime] NFC: Add comment and verify LCSSA
Anna Thomas [Fri, 28 Dec 2018 18:52:16 +0000 (18:52 +0000)]
[UnrollRuntime] NFC: Add comment and verify LCSSA

Added -verify-loop-lcssa to test cases.
Updated comments in ConnectProlog.

llvm-svn: 350131

5 years ago[objc-gnustep2] Fix a bug in category generation.
David Chisnall [Fri, 28 Dec 2018 17:44:54 +0000 (17:44 +0000)]
[objc-gnustep2] Fix a bug in category generation.

We were not emitting a protocol definition while generating the category
method list.  This was fine in most cases, because something else in the
library typically referenced any given protocol, but it caused linker
failures if the category was the only reference to a given protocol.

llvm-svn: 350130

5 years ago[OPENMP][NVPTX]Fixed initialization of the data-sharing interface.
Alexey Bataev [Fri, 28 Dec 2018 17:31:06 +0000 (17:31 +0000)]
[OPENMP][NVPTX]Fixed initialization of the data-sharing interface.

Summary:
Avoid using of the atomic loop to wait for the completion of the
data-sharing interface initialization, use __shfl_sync instead for the
communication within the warp to signal other threads in the warp about
completion of the initialization.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, jfb, caomhin, openmp-commits

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

llvm-svn: 350129

5 years ago[OPENMP][NVPTX]Outline assert into noinline function, NFC.
Alexey Bataev [Fri, 28 Dec 2018 17:29:47 +0000 (17:29 +0000)]
[OPENMP][NVPTX]Outline assert into noinline function, NFC.

Summary:
At high optimization level asserts lead to some unexpected results
because of auto-inserted unreachable instructions. This outlining
prevents some of such dangerous optimizations and leads to better
stability.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, caomhin, openmp-commits

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

llvm-svn: 350128

5 years ago[OPENMP]Fix processing of the clauses on target combined directives.
Alexey Bataev [Fri, 28 Dec 2018 17:27:32 +0000 (17:27 +0000)]
[OPENMP]Fix processing of the clauses on target combined directives.

For constants with the predefined data-sharing clauses we may had
troubles with the target combined directives. It may cause compiler
crash in some corner cases.

llvm-svn: 350127

5 years ago[AArch64] Add command-line option for SB
Diogo N. Sampaio [Fri, 28 Dec 2018 17:14:58 +0000 (17:14 +0000)]
[AArch64] Add command-line option for SB

SB (Speculative Barrier) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds a command
line option to enable SB, as it was previously only possible to
enable by selecting -march=armv8.5-a.

This patch also moves to FeatureSB the old FeatureSpecRestrict.

Reviewers: pbarrio, olista01, t.p.northover, LukeCheeseman

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

llvm-svn: 350126

5 years ago[CodeView] Extend the `MemberAttributes` interface with the `isStatic` method
Aleksandr Urakov [Fri, 28 Dec 2018 17:03:24 +0000 (17:03 +0000)]
[CodeView] Extend the `MemberAttributes` interface with the `isStatic` method

Summary:
This patch extends the MemberAttributes interface with the isStatic method.
It is needed for D56126.

Reviewers: zturner, rnk

Reviewed By: zturner

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

llvm-svn: 350125

5 years ago[Sanitizer] arc4random unit test missing case.
David Carlier [Fri, 28 Dec 2018 16:36:05 +0000 (16:36 +0000)]
[Sanitizer] arc4random unit test missing case.

llvm-svn: 350124

5 years ago[Sanitizer] Intercept arc4random_buf / arc4random_addrandom on FreeBSD/NetBSD
David Carlier [Fri, 28 Dec 2018 16:04:28 +0000 (16:04 +0000)]
[Sanitizer] Intercept arc4random_buf / arc4random_addrandom on FreeBSD/NetBSD

- Disabled on purpose on Android and Darwin platform (for now).
- Darwin supports it, would need interception in its specific code before enabling it.
- Linux does not support it but only via third party library.
- Android supports it via bionic however it is known to have issue with older versions of the implementations. Can be enabled by an Android committer later on if necessary once there is more 'certainity'/been more tested.

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 350123

5 years agoFix signed-unsigned comparisons in MinidumpParserTest
Pavel Labath [Fri, 28 Dec 2018 13:34:50 +0000 (13:34 +0000)]
Fix signed-unsigned comparisons in MinidumpParserTest

llvm-svn: 350122

5 years agoRemove unused variable from ClangASTContext
Pavel Labath [Fri, 28 Dec 2018 13:34:44 +0000 (13:34 +0000)]
Remove unused variable from ClangASTContext

llvm-svn: 350121

5 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description.
Dmitry Preobrazhensky [Fri, 28 Dec 2018 11:48:23 +0000 (11:48 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description.

Minor bugfixing and improvements.

See bug 36572: https://bugs.llvm.org/show_bug.cgi?id=36572

llvm-svn: 350120

5 years ago[NFC] Add failing test on LCSSA form preservation of LoopSimplifyCFG
Max Kazantsev [Fri, 28 Dec 2018 10:43:37 +0000 (10:43 +0000)]
[NFC] Add failing test on LCSSA form preservation of LoopSimplifyCFG

llvm-svn: 350119

5 years ago[PowerPC] handle ISD:TRUNCATE in BitPermutationSelector
Hiroshi Inoue [Fri, 28 Dec 2018 08:00:39 +0000 (08:00 +0000)]
[PowerPC] handle ISD:TRUNCATE in BitPermutationSelector

This is the last one in a series of patches to support better code generation for bitfield insert.
BitPermutationSelector already support ISD::ZERO_EXTEND but not TRUNCATE.
This patch adds support for ISD:TRUNCATE in BitPermutationSelector.

For example of this test case,
struct s64b {
  int a:4;
  int b:16;
  int c:24;
};
void bitfieldinsert64b(struct s64b *p, unsigned char v) {
  p->b = v;
}

the selection DAG loos like:

t14: i32,ch = load<(load 4 from %ir.0)> t0, t2, undef:i64
       t18: i32 = and t14, Constant:i32<-1048561>
            t4: i64,ch = CopyFromReg t0, Register:i64 %1
          t22: i64 = AssertZext t4, ValueType:ch:i8
        t23: i32 = truncate t22
      t16: i32 = shl nuw nsw t23, Constant:i32<4>
    t19: i32 = or t18, t16
  t20: ch = store<(store 4 into %ir.0)> t14:1, t19, t2, undef:i64

By handling truncate in the BitPermutationSelector, we can use information from AssertZext when selecting t19 and skip the mask operation corresponding to t18.
So the generated sequences with and without this patch are

without this patch
rlwinm 5, 5, 0, 28, 11 # corresponding to t18
rlwimi 5, 4, 4, 20, 27
with this patch
rlwimi 5, 4, 4, 12, 27

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

llvm-svn: 350118

5 years agoTemporarily disable term folding in LoopSimplifyCFG, add tests
Max Kazantsev [Fri, 28 Dec 2018 06:22:39 +0000 (06:22 +0000)]
Temporarily disable term folding in LoopSimplifyCFG, add tests

llvm-svn: 350117

5 years ago[LoopSimplifyCFG] Delete dead blocks in RPO
Max Kazantsev [Fri, 28 Dec 2018 06:08:51 +0000 (06:08 +0000)]
[LoopSimplifyCFG] Delete dead blocks in RPO

Deletion of dead blocks in arbitrary order may lead to failure
of assertion in `DeleteDeadBlock` that requires that we have
deleted all predecessors before we can delete the current block.
We should instead delete them in RPO order.

llvm-svn: 350116

5 years ago[PowerPC] Remove the implicit use of the register if it is replaced by Imm
QingShan Zhang [Fri, 28 Dec 2018 03:38:09 +0000 (03:38 +0000)]
[PowerPC] Remove the implicit use of the register if it is replaced by Imm
If we are changing the MI operand from Reg to Imm, we need also handle its implicit use if have.

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

llvm-svn: 350115

5 years ago[NFC] clang-format functions related to r350113
Zi Xuan Wu [Fri, 28 Dec 2018 02:45:17 +0000 (02:45 +0000)]
[NFC] clang-format functions related to r350113

llvm-svn: 350114

5 years ago[PowerPC] Fix assert from machine verify pass that atomic pseudo expanding causes...
Zi Xuan Wu [Fri, 28 Dec 2018 02:12:55 +0000 (02:12 +0000)]
[PowerPC] Fix assert from machine verify pass that atomic pseudo expanding causes mismatched register class

For atomic value operand which less than 4 bytes need to be masked.
And the related operation to calculate the newvalue can be done in 32 bit gprc.
So just use gprc for mask and value calculation.

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

llvm-svn: 350113

5 years agoRevert "[asan] Support running without /proc.", +1
Evgeniy Stepanov [Fri, 28 Dec 2018 01:27:18 +0000 (01:27 +0000)]
Revert "[asan] Support running without /proc.", +1

Revert r350104 "[asan] Fix build on windows."
Revert r350101 "[asan] Support running without /proc."

These changes break Mac build, too.

llvm-svn: 350112

5 years ago[PowerPC] fix register class after converting X-FORM instruction to D-FORM instruction
Chen Zheng [Fri, 28 Dec 2018 01:02:35 +0000 (01:02 +0000)]
[PowerPC] fix register class after converting X-FORM instruction to D-FORM instruction
Differential Revision: https://reviews.llvm.org/D55806

llvm-svn: 350111

5 years agoFix a mistake in previous
Kamil Rytarowski [Fri, 28 Dec 2018 00:17:37 +0000 (00:17 +0000)]
Fix a mistake in previous

Assign correct ioctl(2) operation number.

llvm-svn: 350110

5 years ago[CallSite removal] Add and flesh out APIs on the new `CallBase` base class that previ...
Chandler Carruth [Thu, 27 Dec 2018 23:40:17 +0000 (23:40 +0000)]
[CallSite removal] Add and flesh out APIs on the new `CallBase` base class that previously were only available on the `CallSite` wrapper.

Summary:
This will make migrating code easier and generally seems like a good collection
of API improvements.

Some of these APIs seem like more consistent / better naming of existing
ones. I've retained the old names for migration simplicit and am just
adding the new ones in this commit. I'll try to garbage collect these
once CallSite is gone.

Subscribers: sanjoy, mcrosier, hiraditya, llvm-commits

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

llvm-svn: 350109

5 years ago[gn build] Add check-clang target and make it work
Nico Weber [Thu, 27 Dec 2018 23:38:58 +0000 (23:38 +0000)]
[gn build] Add check-clang target and make it work

With this, check-clang runs and passes all of clang's lit tests. It doesn't run
any of its unit tests yet.

Like with check-lld, running just ninja -C out/gn will build all prerequisites
needed to run tests, but it won't run the tests (so that the build becomes
clean after one build). Running ninja -C out/gn check-clang will build
prerequisites if needed and run the tests. The check-clang target never becomes
clean and runs tests every time.

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

llvm-svn: 350108

5 years agoUpdate NetBSD ioctl(2) entries with 8.99.28
Kamil Rytarowski [Thu, 27 Dec 2018 23:35:28 +0000 (23:35 +0000)]
Update NetBSD ioctl(2) entries with 8.99.28

Add SIOCSETHERCAP.

Add commented out NVMM (NetBSD Virtual Machine Monitor) operations
as this interface is still WIP and a subject to change.

llvm-svn: 350107

5 years agoEnable asan_and_llvm_coverage_test.cc for NetBSD
Kamil Rytarowski [Thu, 27 Dec 2018 22:55:13 +0000 (22:55 +0000)]
Enable asan_and_llvm_coverage_test.cc for NetBSD

LLVM profile is now enabled for this target.

llvm-svn: 350106

5 years ago[ELF] A shared object is needed if any of its occurrences is needed
Fangrui Song [Thu, 27 Dec 2018 22:24:45 +0000 (22:24 +0000)]
[ELF] A shared object is needed if any of its occurrences is needed

Summary:
If a DSO appears more than once with and without --as-needed, ld.bfd and gold consider --no-as-needed to takes precedence over --as-needed. lld didn't and this patch makes it do so.

This makes it a bit away from the position-dependent behavior (how
different occurrences of the same DSO interact) and protects us from
some mysterious runtime errors: if some interceptor libraries add their
own --no-as-needed dependencies (e.g. librt.so), and the user
application specifies -Wl,--as-needed -lrt , the absence of the
DT_NEEDED entry would make dlsym(RTLD_NEXT, "clock_gettime") return NULL
and would break at runtime.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 350105

5 years ago[asan] Fix build on windows.
Evgeniy Stepanov [Thu, 27 Dec 2018 22:16:28 +0000 (22:16 +0000)]
[asan] Fix build on windows.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 350104

5 years agoEnable posix regex interceptors on linux.
Evgeniy Stepanov [Thu, 27 Dec 2018 21:47:26 +0000 (21:47 +0000)]
Enable posix regex interceptors on linux.

Summary: They happen to work out of the box.

Reviewers: rtrieu, vitalybuka

Subscribers: kubamracek, fedor.sergeev, krytarowski, llvm-commits

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

llvm-svn: 350103

5 years agoReimplement Thread Static Data MSan routines with TLS
Kamil Rytarowski [Thu, 27 Dec 2018 21:43:46 +0000 (21:43 +0000)]
Reimplement Thread Static Data MSan routines with TLS

Summary:
Thread Static Data cannot be used in early init on NetBSD
and FreeBSD. Reuse the MSan TSD API for compatibility with
existing code with an alternative implementation using Thread
Local Storage.

New version uses Thread Local Storage to store a pointer
with thread specific data. The destructor from TSD has been
replaced with a TLS destrucutor that is called upon thread
exit.

Reviewers: joerg, vitalybuka, jfb

Reviewed By: vitalybuka

Subscribers: emaste, jfb, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

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

llvm-svn: 350102

5 years ago[asan] Support running without /proc.
Evgeniy Stepanov [Thu, 27 Dec 2018 21:31:52 +0000 (21:31 +0000)]
[asan] Support running without /proc.

Summary:
This patch lets ASan run when /proc is not accessible (ex. not mounted
yet). It includes a special test-only flag that emulates this condition
in an unpriviledged process.

This only matters on Linux, where /proc is necessary to enumerate
virtual memory mappings.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 350101

5 years agogetfsent, unit test.
David Carlier [Thu, 27 Dec 2018 21:26:03 +0000 (21:26 +0000)]
getfsent, unit test.

llvm-svn: 350100

5 years ago[Sanitizer] Add fstab api to FreeBSD/Linux
David Carlier [Thu, 27 Dec 2018 21:25:24 +0000 (21:25 +0000)]
[Sanitizer] Add fstab api to FreeBSD/Linux

Interception of /etc/fstab function parsers.

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 350099

5 years ago[sanitizer] Avoid memset call in tsan
Jordan Rupprecht [Thu, 27 Dec 2018 20:29:10 +0000 (20:29 +0000)]
[sanitizer] Avoid memset call in tsan

Summary: Assigning an array of bools to {false, false, false} can, in certain build configurations, lead to a memset call. Use internal_memset to avoid this.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 350098

5 years agoAdjust NetBSD/sha2.cc to be portable to more environments
Kamil Rytarowski [Thu, 27 Dec 2018 17:04:00 +0000 (17:04 +0000)]
Adjust NetBSD/sha2.cc to be portable to more environments

Summary:
By an accident part of the tests contained hardcoded checksums
for external files that will differ between setups.

Reviewers: mgorny

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350097

5 years agoAdjust NetBSD/md2.cc to be portable to more environments
Kamil Rytarowski [Thu, 27 Dec 2018 17:03:21 +0000 (17:03 +0000)]
Adjust NetBSD/md2.cc to be portable to more environments

Summary:
By an accident part of the tests contained hardcoded checksums
for external files that will differ between setups.

Reviewers: mgorny

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350096

5 years agoAdjust NetBSD/md[45].cc to be portable to more environments
Kamil Rytarowski [Thu, 27 Dec 2018 17:02:16 +0000 (17:02 +0000)]
Adjust NetBSD/md[45].cc to be portable to more environments

Summary:
By an accident part of the tests contained hardcoded checksums
for external files that will differ between setups.

Reviewers: mgorny

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350095

5 years agoReduce indentation in ObjectFilePECOFF::CreateSections via an early return
Pavel Labath [Thu, 27 Dec 2018 15:16:44 +0000 (15:16 +0000)]
Reduce indentation in ObjectFilePECOFF::CreateSections via an early return

llvm-svn: 350094

5 years agoFix tests for python 3.7
Pavel Labath [Thu, 27 Dec 2018 15:16:37 +0000 (15:16 +0000)]
Fix tests for python 3.7

python 3.7 removes re._pattern_type. Fix the one place where we were
depending on the type of regular expressions to compute the type
dynamically.

llvm-svn: 350093

5 years ago[objc-gnustep] Fix a copy-and-paste error.
David Chisnall [Thu, 27 Dec 2018 14:44:36 +0000 (14:44 +0000)]
[objc-gnustep] Fix a copy-and-paste error.

We were emitting the null class symbol in the wrong section, which meant
that programs that contained no Objective-C classes would fail to link.

llvm-svn: 350092

5 years agoFix assertion failure in NativeProcessProtocolTest
Pavel Labath [Thu, 27 Dec 2018 13:45:55 +0000 (13:45 +0000)]
Fix assertion failure in NativeProcessProtocolTest

The assertion fired (with a debug visual studio STL) because we tried to
dereference the end of a vector (although it was only to take its
address again and form an end iterator). Rewrite this logic to avoid the
questionable code.

llvm-svn: 350091

5 years ago[Sanitizer] Enable FTS api on FreeBSD
David Carlier [Thu, 27 Dec 2018 12:56:54 +0000 (12:56 +0000)]
[Sanitizer] Enable FTS api on FreeBSD

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 350090

5 years agoFix "default argument for lambda parameter" (-Wpedantic) warning
Pavel Labath [Thu, 27 Dec 2018 09:44:32 +0000 (09:44 +0000)]
Fix "default argument for lambda parameter" (-Wpedantic) warning

llvm-svn: 350089

5 years agoDelete lldb_utility::Range
Pavel Labath [Thu, 27 Dec 2018 09:44:27 +0000 (09:44 +0000)]
Delete lldb_utility::Range

This class is unused, and there is already a lldb_private::Range
(defined in lldb/Core/RangeMap.h), which has similar functionality.

llvm-svn: 350088

5 years agolldb-test ir-memory-map: Use IntervalMap::contains
Pavel Labath [Thu, 27 Dec 2018 09:32:04 +0000 (09:32 +0000)]
lldb-test ir-memory-map: Use IntervalMap::contains

Summary:
Simplify the code by using the contains implementation in IntervalMap.

There is a slight change of behavior here: We now treat an allocation of
size 0, as if it was size 1. This guarantees that the returned addresses
will be unique, whereas previously we would allow the allocation
function to return the same zero-sized region multiple times, as long as
it is not null, and not in the middle of an existing interval (but the
situation when we were placing an larger interval over a zero-sized one
was not detected).

I think this behavior makes more sense, as that is pretty much the same
guarantee as offered by malloc (except that is permitted to also return
nullptr).

Reviewers: vsk

Subscribers: lldb-commits

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

llvm-svn: 350087

5 years agoDWARF: Fix a bug in array size computation
Pavel Labath [Thu, 27 Dec 2018 09:25:34 +0000 (09:25 +0000)]
DWARF: Fix a bug in array size computation

Summary:
r346165 introduced a bug, where we would fail to parse the size of an
array if that size happened to match an existing die offset.

The logic was:
if (DWARFDIE count = die.GetReferencedDie(DW_AT_count))
  num_elements = compute_vla_size(count);
else
  num_elements = die.GetUsigned(DW_AT_count); // a fixed-size array

The problem with this logic was that GetReferencedDie did not take the
form class of the attribute into account, and would happily return a die
reference for any form, if its value happened to match some die.

As this behavior is inconsistent with how llvm's DWARFFormValue class
operates, I chose to fix the problem by making our version of this class
match the llvm behavior. For this to work, I had to add an explicit form
class check to the .apple_XXX tables parsing code, because they do
(incorrectly?) use data forms as die references.

Reviewers: aprantl, clayborg

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 350086

5 years agoDo not rely on that subject of ErrorAllocTypeMismatch is a heap address.
Martin Liska [Thu, 27 Dec 2018 08:39:13 +0000 (08:39 +0000)]
Do not rely on that subject of ErrorAllocTypeMismatch is a heap address.

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

llvm-svn: 350085

5 years ago[X86] Remove check that avoids creating PMULDQ with illegal types. Rely on SplitOpsAn...
Craig Topper [Thu, 27 Dec 2018 03:37:04 +0000 (03:37 +0000)]
[X86] Remove check that avoids creating PMULDQ with illegal types. Rely on SplitOpsAndApply to legalize it.

Create PMULDQ/PMULUDQ as long as the number of elements is a power of 2.

This seems to give some improvements in our ability to use SimplifyDemandedBits.

llvm-svn: 350084

5 years agoRevert "[msan] Disable tail call optimization in msan rtl."
Evgeniy Stepanov [Thu, 27 Dec 2018 03:30:42 +0000 (03:30 +0000)]
Revert "[msan] Disable tail call optimization in msan rtl."

This reverts commit r350080, which breaks
* gcc as the host compiler
* some tests on ppc64

llvm-svn: 350083

5 years ago[X86] Factor the core code out of LowerSETCC into a helper that can create CMP/BT...
Craig Topper [Thu, 27 Dec 2018 01:50:40 +0000 (01:50 +0000)]
[X86] Factor the core code out of LowerSETCC into a helper that can create CMP/BT/PTEST/KORTEST etc. without making an X86ISD::SETCC node. NFCI

Make each of the helper functions only return their comparison node and the condition code. Leave X86ISD::SETCC creation to the LowerSETCC function itself.

Looking into whether we can use this code directly in BRCOND and SELECT lowering instead of going through LowerSETCC which creates an X86ISD::SETCC node we need to look through.

llvm-svn: 350082

5 years ago[X86] Merge getBitTestCondition into LowerAndToBT. Don't create X86ISD::SETCC node...
Craig Topper [Thu, 27 Dec 2018 01:50:38 +0000 (01:50 +0000)]
[X86] Merge getBitTestCondition into LowerAndToBT. Don't create X86ISD::SETCC node in the merged function. NFCI

Only one of the 3 callers of LowerAndToBT need the SETCC node. Two of them have to look through it to find the operands they really need. Instead create it after the one call that needs it.

LowerAndToBT now returns both the BT node and the X86 specific condition code separately.

llvm-svn: 350081

5 years ago[msan] Disable tail call optimization in msan rtl.
Evgeniy Stepanov [Thu, 27 Dec 2018 00:21:20 +0000 (00:21 +0000)]
[msan] Disable tail call optimization in msan rtl.

This should give us better error stack traces on the bots, in
particular, for https://bugs.llvm.org/show_bug.cgi?id=40162

llvm-svn: 350080

5 years ago[WebAssembly] Added basic support for if/else/end_if in MC layer.
Wouter van Oortmerssen [Wed, 26 Dec 2018 22:55:26 +0000 (22:55 +0000)]
[WebAssembly] Added basic support for if/else/end_if in MC layer.

Summary:
These instructions are currently unused in our backend, but for
completeness it is good to support them, so they can be used with
the assembler in hand-written code.

Tests are very basic, signature support missing much like other blocks.

Reviewers: dschuff, aheejin

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

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

llvm-svn: 350079

5 years ago[WebAssembly] Make assembler check for proper nesting of control flow.
Wouter van Oortmerssen [Wed, 26 Dec 2018 22:46:18 +0000 (22:46 +0000)]
[WebAssembly] Make assembler check for proper nesting of control flow.

Summary:
It does so using a simple nesting stack, and gives clear errors upon
violation. This is unique to wasm, since most CPUs do not have
any nested constructs.

Had to add an end of file check to the general assembler for this.

Note: if/else/end instructions are not currently supported in our
tablegen defs, so these tests will be enabled in a follow-up.
They already pass the nesting check.

Reviewers: dschuff, aheejin

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

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

llvm-svn: 350078

5 years agomanpages: Update the URL for https
Sylvestre Ledru [Wed, 26 Dec 2018 22:34:44 +0000 (22:34 +0000)]
manpages: Update the URL for https

llvm-svn: 350077

5 years ago[WebAssembly] Delete an unnecessary line in RegStackify
Heejin Ahn [Wed, 26 Dec 2018 22:33:35 +0000 (22:33 +0000)]
[WebAssembly] Delete an unnecessary line in RegStackify

`OneUseInst` is set outside of the loop before and `OneUse` does not
change throughout the loop, so this line is not necessary.

llvm-svn: 350076

5 years ago[WebAssembly] Fix typos in comments in RegStackify (NFC)
Heejin Ahn [Wed, 26 Dec 2018 22:27:46 +0000 (22:27 +0000)]
[WebAssembly] Fix typos in comments in RegStackify (NFC)

llvm-svn: 350075

5 years ago[LoopIdiomRecognize] Add CTTZ support
Craig Topper [Wed, 26 Dec 2018 21:59:48 +0000 (21:59 +0000)]
[LoopIdiomRecognize] Add CTTZ support

Summary:
Existing LIR recognizes CTLZ where shifting input variable right until it is zero. (Shift-Until-Zero idiom)

This commit:
1. Augments Shift-Until-Zero idiom to recognize CTTZ where input variable is shifted left.
2. Prepare for BitScan idiom recognition.

Patch by Yuanfang Chen (tabloid.adroit)

Reviewers: craig.topper, evstupac

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 350074

5 years ago[codeview] Check if this 'this' type of a method is a pointer
Reid Kleckner [Wed, 26 Dec 2018 21:52:17 +0000 (21:52 +0000)]
[codeview] Check if this 'this' type of a method is a pointer

Fixes crash reported after r347354 for frontends that don't always emit
'this' pointers for methods. Now we will silently produce debug info
that makes functions like this look like static methods, which seems
reasonable.

llvm-svn: 350073

5 years ago[clang-cl] Treat inputs as C++ with /E, like MSVC
Reid Kleckner [Wed, 26 Dec 2018 21:04:08 +0000 (21:04 +0000)]
[clang-cl] Treat inputs as C++ with /E, like MSVC

midl invokes the compiler on .idl files with /E. Before this change, we
would treat unrecognized inputs as object files. Now we pre-process to
stdout as expected. I checked that MSVC defines __cplusplus when invoked
this way, so treating the input as C++ seems like the right thing to do.

After this change, I was able to run midl like this with clang-cl:
$ midl -cpp_cmd clang-cl.exe foo.idl

Things worked for the example IDL file in the Microsoft documentation,
but beyond that, I don't know if this will work well.

Fixes PR40140

llvm-svn: 350072

5 years ago[MS] Mangle return adjusting thunks with the public access specifier
Reid Kleckner [Wed, 26 Dec 2018 20:07:52 +0000 (20:07 +0000)]
[MS] Mangle return adjusting thunks with the public access specifier

MSVC does this, so we should too.

Fixes PR40138

llvm-svn: 350071

5 years agoUse error() instead of fatal() to report an invalid address range.
Rui Ueyama [Wed, 26 Dec 2018 19:15:04 +0000 (19:15 +0000)]
Use error() instead of fatal() to report an invalid address range.

In this patch we also use toString() to stringize a section.

llvm-svn: 350070

5 years ago[NVPTX] Allow libcalls that are defined in the current module.
Justin Lebar [Wed, 26 Dec 2018 19:12:31 +0000 (19:12 +0000)]
[NVPTX] Allow libcalls that are defined in the current module.

The patch adds a possibility to make library calls on NVPTX.

An important thing about library functions - they must be defined within
the current module. This basically should guarantee that we produce a
valid PTX assembly (without calls to not defined functions). The one who
wants to use the libcalls is probably will have to link against
compiler-rt or any other implementation.

Currently, it's completely impossible to make library calls because of
error LLVM ERROR: Cannot select: i32 = ExternalSymbol '...'. But we can
lower ExternalSymbol to TargetExternalSymbol and verify if the function
definition is available.

Also, there was an issue with a DAG during legalisation. When we expand
instruction into libcall, the inner call-chain isn't being "integrated"
into outer chain. Since the last "data-flow" (call retval load) node is
located in call-chain earlier than CALLSEQ_END node, the latter becomes
a leaf and therefore a dead node (and is being removed quite fast).
Proposed here solution relies on another data-flow pseudo nodes
(ProxyReg) which purpose is only to keep CALLSEQ_END at legalisation and
instruction selection phases - we remove the pseudo instructions before
register scheduling phase.

Patch by Denys Zariaiev!

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

llvm-svn: 350069

5 years agoIgnore ConstantExpr in IgnoreParens
Reid Kleckner [Wed, 26 Dec 2018 17:44:40 +0000 (17:44 +0000)]
Ignore ConstantExpr in IgnoreParens

Summary:
This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more
helpers ignore it. For most clients, this ensures that these helpers
behave the same with and without C++17 enabled, which is what appears to
introduce these new expression nodes.

Fixes PR39881

Reviewers: void, rsmith

Subscribers: cfe-commits

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

llvm-svn: 350068

5 years agoPass a concrete triple for two OpenMP tests that depend on TLS
Nico Weber [Wed, 26 Dec 2018 16:06:26 +0000 (16:06 +0000)]
Pass a concrete triple for two OpenMP tests that depend on TLS

Not all %itanium_abi_triple values support TLS. Makes
OpenMP/declare_reduction_codegen.cpp, OpenMP/parallel_copyin_codegen.cpp for
%itanium_abi_triples without TLS support.

Alternatively we could pass -fnoopenmp-use-tls and tweak some of the CHECK
lines, but this seems a bit simpler.

Fixes PR40156.

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

llvm-svn: 350067

5 years ago[AMDGPU] Regenerate i64 shift tests.
Simon Pilgrim [Wed, 26 Dec 2018 12:09:10 +0000 (12:09 +0000)]
[AMDGPU] Regenerate i64 shift tests.

To show codegen diff due to a future SimplifyDemandedBits patch.

llvm-svn: 350065

5 years ago[NFC] Use utility function for guards detection
Max Kazantsev [Wed, 26 Dec 2018 08:22:25 +0000 (08:22 +0000)]
[NFC] Use utility function for guards detection

llvm-svn: 350064

5 years ago[MIPS GlobalISel] Select G_SELECT
Petar Avramovic [Tue, 25 Dec 2018 14:42:30 +0000 (14:42 +0000)]
[MIPS GlobalISel] Select G_SELECT

Add widen scalar for type index 1 (i1 condition) for G_SELECT.
Select G_SELECT for pointer, s32(integer) and smaller low level
types on MIPS32.

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

llvm-svn: 350063

5 years ago[NFC] Reuse variables instead of re-calling getParent
Max Kazantsev [Tue, 25 Dec 2018 07:20:06 +0000 (07:20 +0000)]
[NFC] Reuse variables instead of re-calling getParent

llvm-svn: 350062

5 years ago[PowerPC] Fix the bug of ISD::ADDE to set its second return type to glue
Kang Zhang [Tue, 25 Dec 2018 03:29:51 +0000 (03:29 +0000)]
[PowerPC] Fix the bug of ISD::ADDE to set its second return type to glue

Summary:
This patch is to fix the bug imported by rL341634.
In above submit , the the return type of ISD::ADDE is
14224: SDVTList VTs = DAG.getVTList(MVT::i64, MVT::i64),
but in fact, the second return type of ISD::ADDE should be
MVT::Glue not MVT::i64.

Reviewed By: hfinkel

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

llvm-svn: 350061

5 years ago[gn build] Make NOSORT line actually work
Nico Weber [Mon, 24 Dec 2018 23:06:29 +0000 (23:06 +0000)]
[gn build] Make NOSORT line actually work

GN wants the NOSORT line to be the first line of a comment block, not the last
line.

I sent https://gn-review.googlesource.com/c/gn/+/3560 to support having it in
the last line too, but since it will be a while until everyone has that change
even if it's expected, use the form that works today.

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

llvm-svn: 350060

5 years ago[X86] Use GetDemandedBits to simplify the operands of PMULDQ/PMULUDQ.
Craig Topper [Mon, 24 Dec 2018 19:40:20 +0000 (19:40 +0000)]
[X86] Use GetDemandedBits to simplify the operands of PMULDQ/PMULUDQ.

This is an alternative to what I attempted in D56057.

GetDemandedBits is a special version of SimplifyDemandedBits that allows simplifications even when the operand has other uses. GetDemandedBits will only do simplifications that allow a node to be bypassed. It won't create new nodes or alter any of the other users.

I had to add support for bypassing SIGN_EXTEND_INREG to GetDemandedBits.

Based on a patch that Simon Pilgrim sent me in email.

Fixes PR40142.

llvm-svn: 350059

5 years ago[X86] Add test cases for PR40142. NFC
Craig Topper [Mon, 24 Dec 2018 19:40:17 +0000 (19:40 +0000)]
[X86] Add test cases for PR40142. NFC

llvm-svn: 350058

5 years ago[analyzer] [NFC] Clean up the mess of constructing argument effects in RetainCountChecker
George Karpenkov [Mon, 24 Dec 2018 18:45:18 +0000 (18:45 +0000)]
[analyzer] [NFC] Clean up the mess of constructing argument effects in RetainCountChecker

Previously, argument effects were stored in a method variable, which was
effectively global.
The global state was reset at each (hopefully) entrance point to the
summary construction,
and every function could modify it.

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

llvm-svn: 350057

5 years ago[clang-tidy] add IgnoreMacros option to readability-uppercase-literal-suffix
Miklos Vajna [Mon, 24 Dec 2018 17:47:32 +0000 (17:47 +0000)]
[clang-tidy] add IgnoreMacros option to readability-uppercase-literal-suffix

And also enable it by default to be consistent with e.g.
modernize-use-using.

This helps e.g. when running this check on client code where the macro
is provided by the system, so there is no easy way to modify it.

Reviewed By: JonasToth, lebedev.ri

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

llvm-svn: 350056

5 years ago[HWASAN] Instrument memorty intrinsics by default
Eugene Leviant [Mon, 24 Dec 2018 16:02:48 +0000 (16:02 +0000)]
[HWASAN] Instrument memorty intrinsics by default

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

llvm-svn: 350055

5 years ago[gn build] Add build files for clang/tools/{c-arcmt-test,c-index-test} and their...
Nico Weber [Mon, 24 Dec 2018 15:45:04 +0000 (15:45 +0000)]
[gn build] Add build files for clang/tools/{c-arcmt-test,c-index-test} and their dependency clang/tools/libclang

libclang is somewhat incomplete. It's just enough to get check-clang to pass,
but that requires it to be pretty complete. The biggest thing is that it's not
built as a shared library on Linux. The libclang/BUILD.gn file has a comment
with details on what else is missing.

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

llvm-svn: 350054

5 years agoReleaseNotes: X86 Target: bdver2 sched model was added (D52779)
Roman Lebedev [Mon, 24 Dec 2018 12:12:26 +0000 (12:12 +0000)]
ReleaseNotes: X86 Target: bdver2 sched model was added (D52779)

llvm-svn: 350053

5 years agoRevert rL350048 and rL350050
Max Kazantsev [Mon, 24 Dec 2018 10:30:04 +0000 (10:30 +0000)]
Revert rL350048 and rL350050

These patches have broken almost all buildbots on test
DebugInfo/X86/addr_comments.ll. Reverting to green.

llvm-svn: 350052

5 years ago[LLD][ELF] - Cleanup gdb-index-dwarf5-low-high.s. NFC.
George Rimar [Mon, 24 Dec 2018 10:18:07 +0000 (10:18 +0000)]
[LLD][ELF] - Cleanup gdb-index-dwarf5-low-high.s. NFC.

Remove tabs and .debug_macinfo sections.

llvm-svn: 350051

5 years agoFix build - follow-up to r350048 which broke headerless (v4) address pool
David Blaikie [Mon, 24 Dec 2018 07:56:40 +0000 (07:56 +0000)]
Fix build - follow-up to r350048 which broke headerless (v4) address pool

llvm-svn: 350050

5 years ago[LoopSimplifyCFG] Delete dead exiting edges
Max Kazantsev [Mon, 24 Dec 2018 07:41:33 +0000 (07:41 +0000)]
[LoopSimplifyCFG] Delete dead exiting edges

This patch teaches LoopSimplifyCFG to remove dead exiting edges
from loops.

Differential Revision: https://reviews.llvm.org/D54025
Reviewed By: fedor.sergeev

llvm-svn: 350049