platform/upstream/llvm.git
6 years ago[Windows] Simplify WindowsSupport.h
Reid Kleckner [Tue, 6 Nov 2018 23:39:59 +0000 (23:39 +0000)]
[Windows] Simplify WindowsSupport.h

Sink Windows version detection code from WindowsSupport.h to Path.inc.
These functions don't need to be inlined. I randomly picked Process.inc
for the Windows version helpers, since that's the most related file.

Sink MakeErrMsg to Program.inc since it's the main client.

Move those functions into the llvm namespace, and delete the scoped
handle copy and assignment operators.

Reviewers: zturner, aganea

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

llvm-svn: 346280

6 years ago[fuzzer] Read files as binary
Jonathan Metzman [Tue, 6 Nov 2018 23:25:25 +0000 (23:25 +0000)]
[fuzzer] Read files as binary

Summary: Read corpus files as binary to avoid automatic conversions

Reviewers: Dor1s, morehouse

Reviewed By: Dor1s, morehouse

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

llvm-svn: 346279

6 years agoAdd MSVCUndecoratedNameParser.cpp.
Jason Molenda [Tue, 6 Nov 2018 23:01:42 +0000 (23:01 +0000)]
Add MSVCUndecoratedNameParser.cpp.

llvm-svn: 346278

6 years ago[FileCheck] Try to fix windows bots broken by r346272
Joel E. Denny [Tue, 6 Nov 2018 22:42:10 +0000 (22:42 +0000)]
[FileCheck] Try to fix windows bots broken by r346272

llvm-svn: 346277

6 years ago[Darwin] Export new weak external symbols when compiling with coverage
Vedant Kumar [Tue, 6 Nov 2018 22:25:00 +0000 (22:25 +0000)]
[Darwin] Export new weak external symbols when compiling with coverage

Some weak external symbols were added to the profile runtime in D49953,
and on Darwin, these need to be exported for tapi verification purposes.

I've tightened the test so that future breakages can be caught earlier.

rdar://45831054

llvm-svn: 346276

6 years ago[MachineOutliner][NFC] Remove OccurrenceCount from SuffixTreeNode
Jessica Paquette [Tue, 6 Nov 2018 22:23:13 +0000 (22:23 +0000)]
[MachineOutliner][NFC] Remove OccurrenceCount from SuffixTreeNode

After changing the way we find candidates in r346269, this is no longer used.

llvm-svn: 346275

6 years ago[MachineOutliner][NFC] Remove IsInTree from SuffixTreeNode
Jessica Paquette [Tue, 6 Nov 2018 22:21:11 +0000 (22:21 +0000)]
[MachineOutliner][NFC] Remove IsInTree from SuffixTreeNode

After changing the way we find repeated substrings in r346269, this
field is no longer used by anything, so it can be removed.

llvm-svn: 346274

6 years ago[PATCH] [AArch64] Refactor helper functions (NFC)
Evandro Menezes [Tue, 6 Nov 2018 22:17:14 +0000 (22:17 +0000)]
[PATCH] [AArch64] Refactor helper functions (NFC)

Refactor helper functions in AArch64InstrInfo to be static methods.

llvm-svn: 346273

6 years ago[FileCheck] Parse command-line options from FILECHECK_OPTS
Joel E. Denny [Tue, 6 Nov 2018 22:07:03 +0000 (22:07 +0000)]
[FileCheck] Parse command-line options from FILECHECK_OPTS

This feature makes it easy to tune FileCheck diagnostic output when
running the test suite via ninja, a bot, or an IDE.  For example:

```
$ FILECHECK_OPTS='-color -v -dump-input-on-failure' \
  LIT_FILTER='OpenMP/for_codegen.cpp' ninja check-clang \
  | less -R
```

Reviewed By: probinson

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

llvm-svn: 346272

6 years agoSet config.lit_tools_dir, which is needed by lit.llvm.initialize.
Reid Kleckner [Tue, 6 Nov 2018 21:54:27 +0000 (21:54 +0000)]
Set config.lit_tools_dir, which is needed by lit.llvm.initialize.

llvm-svn: 346271

6 years ago[sanitizer] Return headed to fix build after r346258
Vitaly Buka [Tue, 6 Nov 2018 21:49:53 +0000 (21:49 +0000)]
[sanitizer] Return headed to fix build after r346258

llvm-svn: 346270

6 years ago[MachineOutliner][NFC] Add findRepeatedSubstrings to SuffixTree, kill LeafVector
Jessica Paquette [Tue, 6 Nov 2018 21:46:41 +0000 (21:46 +0000)]
[MachineOutliner][NFC] Add findRepeatedSubstrings to SuffixTree, kill LeafVector

Instead of iterating over the leaves to find repeated substrings, and walking
collecting leaf children when we don't necessarily need them, let's just
calculate what we need and iterate over that.

By doing this, we don't have to save every leaf. It's easier to read the code
too and understand what's going on.

The goal here, at the end of the day, is to set up to allow us to do something
like

for (RepeatedSubstring &RS : ST) {
 ... do stuff with RS ...
}

Which would let us perform the cost model stuff and the repeated substring
query at the same time.

llvm-svn: 346269

6 years agoSilence deprecation warning for GetVersionEx with clang-cl
Reid Kleckner [Tue, 6 Nov 2018 21:40:32 +0000 (21:40 +0000)]
Silence deprecation warning for GetVersionEx with clang-cl

llvm-svn: 346268

6 years agoAMDGPU: Add an option -disable-promote-alloca-to-lds
Yaxun Liu [Tue, 6 Nov 2018 21:28:17 +0000 (21:28 +0000)]
AMDGPU: Add an option -disable-promote-alloca-to-lds

Add this option for debugging and providing workaround.

By default it is off so no behavior change in backend.

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

llvm-svn: 346267

6 years agoDon't use std::next() on an input iterator; NFC.
Aaron Ballman [Tue, 6 Nov 2018 21:12:44 +0000 (21:12 +0000)]
Don't use std::next() on an input iterator; NFC.

Instead, advance the old-fashioned way, as std::next() cannot be used on an input iterator until C++17.

llvm-svn: 346266

6 years ago[MS] Zero out ECX in __cpuid in intrin.h
Reid Kleckner [Tue, 6 Nov 2018 20:45:26 +0000 (20:45 +0000)]
[MS] Zero out ECX in __cpuid in intrin.h

Summary:
Some CPUID leafs depend on the value of ECX as well as EAX, but we left
it uninitialized.

Originally reported as https://crbug.com/901547

Reviewers: craig.topper, hans

Subscribers: cfe-commits

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

llvm-svn: 346265

6 years ago[dfsan] Fix build after r346262
Benjamin Kramer [Tue, 6 Nov 2018 20:42:19 +0000 (20:42 +0000)]
[dfsan] Fix build after r346262

compiler-rt/lib/dfsan/dfsan.cc:426:3: error: call to 'InitializePlatformEarly' is ambiguous
  InitializePlatformEarly();
  ^~~~~~~~~~~~~~~~~~~~~~~
compiler-rt/lib/dfsan/../sanitizer_common/sanitizer_common.h:901:6: note: candidate function
void InitializePlatformEarly();
     ^
compiler-rt/lib/dfsan/dfsan.cc:391:13: note: candidate function
static void InitializePlatformEarly() {
            ^

llvm-svn: 346264

6 years agoAMDGPU/Docs: Fix the processor table
Konstantin Zhuravlyov [Tue, 6 Nov 2018 20:23:53 +0000 (20:23 +0000)]
AMDGPU/Docs: Fix the processor table

llvm-svn: 346263

6 years ago[sanitizer] Use "fast mmap" kernel flag for shadow memory on macOS 10.13.4+
Kuba Mracek [Tue, 6 Nov 2018 19:55:19 +0000 (19:55 +0000)]
[sanitizer] Use "fast mmap" kernel flag for shadow memory on macOS 10.13.4+

This speeds up process startup and teardown and also reduces lock contention when running multiple ASanified/TSanified processes simultaneously. Should greatly improve lit testing time.

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

llvm-svn: 346262

6 years ago[ThinLTO] Split NotEligibleToImport into legality and inlinability flags
Teresa Johnson [Tue, 6 Nov 2018 19:41:35 +0000 (19:41 +0000)]
[ThinLTO] Split NotEligibleToImport into legality and inlinability flags

Summary:
The NotEligibleToImport flag on the GlobalValueSummary was set if it
isn't legal to import (e.g. because it references unpromotable locals)
and when it can't be inlined (in which case importing is pointless).

I split out the inlinable piece into a separate flag on the
FunctionSummary (doesn't make sense for aliases or global variables),
because in the future we may want to import for reasons other than
inlining.

Reviewers: davidxl

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits

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

llvm-svn: 346261

6 years ago[lld][NFC] Use explicit --symbols instead of -t in tests using llvm-readelf.
Jordan Rupprecht [Tue, 6 Nov 2018 19:34:22 +0000 (19:34 +0000)]
[lld][NFC] Use explicit --symbols instead of -t in tests using llvm-readelf.

llvm-svn: 346260

6 years ago[X86] Add custom promotion of v2i8/v2i16 fp_to_sint to avoid over promotion to v2i64...
Craig Topper [Tue, 6 Nov 2018 19:24:21 +0000 (19:24 +0000)]
[X86] Add custom promotion of v2i8/v2i16 fp_to_sint to avoid over promotion to v2i64 which would force scalarization.

llvm-svn: 346259

6 years ago[sanitizer] Fix nolibc unittests broken by r346215
Vitaly Buka [Tue, 6 Nov 2018 19:23:22 +0000 (19:23 +0000)]
[sanitizer] Fix nolibc unittests broken by r346215

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

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

llvm-svn: 346258

6 years ago[sanitizer] Add char **GetEnviron() on all other platforms
Vitaly Buka [Tue, 6 Nov 2018 19:23:12 +0000 (19:23 +0000)]
[sanitizer] Add char **GetEnviron() on all other platforms

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 346257

6 years ago[CodeExtractor] Do not extract calls to eh_typeid_for (PR39545)
Vedant Kumar [Tue, 6 Nov 2018 19:06:08 +0000 (19:06 +0000)]
[CodeExtractor] Do not extract calls to eh_typeid_for (PR39545)

The lowering for a call to eh_typeid_for changes when it's moved from
one function to another.

There are several proposals for fixing this issue in llvm.org/PR39545.
Until some solution is in place, do not allow CodeExtractor to extract
calls to eh_typeid_for, as that results in serious miscompilations.

llvm-svn: 346256

6 years ago[CodeExtractor] Erase use-without-def debug intrinsics in parent func
Vedant Kumar [Tue, 6 Nov 2018 19:05:53 +0000 (19:05 +0000)]
[CodeExtractor] Erase use-without-def debug intrinsics in parent func

When CodeExtractor moves instructions to a new function, debug
intrinsics referring to those instructions within the parent function
become invalid.

This results in the same verifier failure which motivated r344545, about
function-local metadata being used in the wrong function.

llvm-svn: 346255

6 years agoLivePhysRegs/IfConversion: Change some types from unsigned to MCPhysReg; NFC
Matthias Braun [Tue, 6 Nov 2018 19:00:11 +0000 (19:00 +0000)]
LivePhysRegs/IfConversion: Change some types from unsigned to MCPhysReg; NFC

Change the type in a couple of lists and sets that only store physical
registers from unsigned to MCPhysRegs. The later is only 16bits and
saves us a bit of memory.

llvm-svn: 346254

6 years ago[AArch64][GlobalISel] Simplify and autogenerate the legalizer tests
Volkan Keles [Tue, 6 Nov 2018 18:59:18 +0000 (18:59 +0000)]
[AArch64][GlobalISel] Simplify and autogenerate the legalizer tests

llvm-svn: 346253

6 years ago[utils] Update SmallVector lldb formatter for r337514
Justin Bogner [Tue, 6 Nov 2018 18:52:30 +0000 (18:52 +0000)]
[utils] Update SmallVector lldb formatter for r337514

SmallVector was changed to store a begin and a size rather than a
begin and an end a while back. Update the formatter to look at the
correct members.

llvm-svn: 346252

6 years agoReland r346166: [GlobalISel] Refactor the artifact combiner a bit by using MIPatternMatch
Volkan Keles [Tue, 6 Nov 2018 18:31:25 +0000 (18:31 +0000)]
Reland r346166: [GlobalISel] Refactor the artifact combiner a bit by using MIPatternMatch

It was causing a crash because we were trying to get the definition
of a target register. Fixed the issue by adding a check and added
a test case for that.

llvm-svn: 346251

6 years agoDisable calls to *_finite and other glibc-only functions on Musl.
Eli Friedman [Tue, 6 Nov 2018 18:23:32 +0000 (18:23 +0000)]
Disable calls to *_finite and other glibc-only functions on Musl.

Non-GNU environments don't have __finite_*, so treat them as
unavailable.

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

llvm-svn: 346250

6 years ago[WebAssembly] Address review comments from r346248 [NFC]
Derek Schuff [Tue, 6 Nov 2018 18:02:39 +0000 (18:02 +0000)]
[WebAssembly] Address review comments from r346248 [NFC]

llvm-svn: 346249

6 years ago[WebAssembly] Support creation and import of shared memories
Derek Schuff [Tue, 6 Nov 2018 17:59:32 +0000 (17:59 +0000)]
[WebAssembly] Support creation and import of shared memories

Used for WebAssembly threads proposal. Add a flag --shared-memory
which sets the IS_SHARED bit in WasmLimits

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

llvm-svn: 346248

6 years ago[ObjectFile] Prefer reinterpret_cast<>
Davide Italiano [Tue, 6 Nov 2018 17:42:14 +0000 (17:42 +0000)]
[ObjectFile] Prefer reinterpret_cast<>

llvm-svn: 346247

6 years ago[WebAssembly] Add shared memory support to limits field
Derek Schuff [Tue, 6 Nov 2018 17:27:25 +0000 (17:27 +0000)]
[WebAssembly] Add shared memory support to limits field

Support the IS_SHARED bit in the memory limits flag word.
The compiler does not create object files with memory definitions,
but the field is used by the linker.

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

llvm-svn: 346246

6 years ago[InstCombine] allow vector types for fcmp+fpext fold
Sanjay Patel [Tue, 6 Nov 2018 17:20:20 +0000 (17:20 +0000)]
[InstCombine] allow vector types for fcmp+fpext fold

llvm-svn: 346245

6 years ago[ObjectFileELF] Fix misaligned read/writes caught by UBSan.
Davide Italiano [Tue, 6 Nov 2018 17:11:34 +0000 (17:11 +0000)]
[ObjectFileELF] Fix misaligned read/writes caught by UBSan.

llvm-svn: 346244

6 years ago[InstCombine] add vector test for fcmp+fpext; NFC
Sanjay Patel [Tue, 6 Nov 2018 17:06:58 +0000 (17:06 +0000)]
[InstCombine] add vector test for fcmp+fpext; NFC

llvm-svn: 346243

6 years ago[InstCombine] propagate fast-math-flags when folding fcmp+fpext, part 2
Sanjay Patel [Tue, 6 Nov 2018 16:45:27 +0000 (16:45 +0000)]
[InstCombine] propagate fast-math-flags when folding fcmp+fpext, part 2

llvm-svn: 346242

6 years ago[InstCombine] rearrange code for fcmp+fpext; NFCI
Sanjay Patel [Tue, 6 Nov 2018 16:37:35 +0000 (16:37 +0000)]
[InstCombine] rearrange code for fcmp+fpext; NFCI

llvm-svn: 346241

6 years ago[InstCombine] propagate fast-math-flags when folding fcmp+fpext
Sanjay Patel [Tue, 6 Nov 2018 16:23:03 +0000 (16:23 +0000)]
[InstCombine] propagate fast-math-flags when folding fcmp+fpext

llvm-svn: 346240

6 years ago[InstCombine] adjust tests to show dropping FMF; NFC
Sanjay Patel [Tue, 6 Nov 2018 16:07:39 +0000 (16:07 +0000)]
[InstCombine] adjust tests to show dropping FMF; NFC

llvm-svn: 346239

6 years ago[InstCombine] propagate fast-math-flags when folding fcmp+fneg, part 2
Sanjay Patel [Tue, 6 Nov 2018 15:58:57 +0000 (15:58 +0000)]
[InstCombine] propagate fast-math-flags when folding fcmp+fneg, part 2

llvm-svn: 346238

6 years ago[benchmark] Disable exceptions in Microsoft STL
Elizabeth Andrews [Tue, 6 Nov 2018 15:57:59 +0000 (15:57 +0000)]
[benchmark] Disable exceptions in Microsoft STL

This patch disables exceptions in Microsoft STL when exception
handling is not enabled in Benchmark project. It fixes Windows
builds that were failing due to C4530 warnings thrown by MS STL.

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

llvm-svn: 346237

6 years ago[InstCombine] adjust tests to show dropping FMF; NFC
Sanjay Patel [Tue, 6 Nov 2018 15:57:52 +0000 (15:57 +0000)]
[InstCombine] adjust tests to show dropping FMF; NFC

Also, remove some stale FIXME comments ( rL346234 ).

llvm-svn: 346236

6 years ago[InstCombine] reduce code; NFC
Sanjay Patel [Tue, 6 Nov 2018 15:53:58 +0000 (15:53 +0000)]
[InstCombine] reduce code; NFC

llvm-svn: 346235

6 years ago[InstCombine] propagate fast-math-flags when folding fcmp+fneg
Sanjay Patel [Tue, 6 Nov 2018 15:49:45 +0000 (15:49 +0000)]
[InstCombine] propagate fast-math-flags when folding fcmp+fneg

This is another part of solving PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475

This might be enough to fix that particular issue, but as noted
with the FIXME, we're still dropping FMF on other folds around here.

llvm-svn: 346234

6 years agoCPlusPlusLanguage: Use new demangler API to implement type substitution
Pavel Labath [Tue, 6 Nov 2018 15:41:37 +0000 (15:41 +0000)]
CPlusPlusLanguage: Use new demangler API to implement type substitution

Summary:
Now that llvm demangler supports more generic customization, we can
implement type substitution directly on top of this API. This will allow
us to remove the specialized hooks which were added to the demangler to
support this use case.

Reviewers: sgraenitz, erik.pilkington, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 346233

6 years ago[InstCombine] add tests for FMF propagation failure; NFC
Sanjay Patel [Tue, 6 Nov 2018 15:21:44 +0000 (15:21 +0000)]
[InstCombine] add tests for FMF propagation failure; NFC

llvm-svn: 346232

6 years ago[CMake] Fix generation of exported targets in build directory
Philip Pfaffe [Tue, 6 Nov 2018 15:18:17 +0000 (15:18 +0000)]
[CMake] Fix generation of exported targets in build directory

CMake generates the exports file wrongly if the CMAKE_BUILD_TYPE is
unset for multi-configuration generators.

The generated file lib/cmake/polly/PollyExports-all.cmake then contains:

set_target_properties(LLVMPolly PROPERTIES
              IMPORTED_LOCATION_ my_build_dir/lib/LLVMPolly.so)
set_target_properties(Polly PROPERTIES
              IMPORTED_LOCATION_ my_build_dir/lib/libPolly.a)

This patch conditionalizes the underscore.

Patch by: Marcin Copik

Differential Revision: D53376

llvm-svn: 346231

6 years ago[mips] Support sigrie instruction
Simon Atanasyan [Tue, 6 Nov 2018 14:37:24 +0000 (14:37 +0000)]
[mips] Support sigrie instruction

The `sigrie` instruction signals a Reserved Instruction Exception.
This patch adds support for assembling / disassembling the instruction.

Differential Revision: http://reviews.llvm.org/D53861

llvm-svn: 346230

6 years agoAdapt UBSan integer truncation tests to NetBSD
Kamil Rytarowski [Tue, 6 Nov 2018 14:18:05 +0000 (14:18 +0000)]
Adapt UBSan integer truncation tests to NetBSD

Summary:
The NetBSD headers use internal indirect type for
standard *int*_t  definitions. The internal type is unrolled
inside the sanitizer into e.g. __int32_t from int32_t.

This symbol mangling causes pattern mismatch in
the interger truncation tests as they expect exact
types such as 'int32_t'.

Change the pattern rules so every acceptable internal
form of *int*_t will be accepted flawlessly.

Reviewers: lebedev.ri, vitalybuka, joerg

Reviewed By: lebedev.ri

Subscribers: kubamracek, dmgreen, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 346228

6 years ago[llvm-exegesis] Ignore X86 pseudo instructions.
Clement Courbet [Tue, 6 Nov 2018 14:11:58 +0000 (14:11 +0000)]
[llvm-exegesis] Ignore X86 pseudo instructions.

Summary: They do not lower to actual MCInsts and have no scheduling info.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

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

llvm-svn: 346227

6 years ago[X86][NFC] Fix comment.
Clement Courbet [Tue, 6 Nov 2018 13:48:56 +0000 (13:48 +0000)]
[X86][NFC] Fix comment.

llvm-svn: 346226

6 years ago[InstCombine] Ensure nested shifts are in range (OSS-Fuzz #9880)
Simon Pilgrim [Tue, 6 Nov 2018 11:28:22 +0000 (11:28 +0000)]
[InstCombine] Ensure nested shifts are in range (OSS-Fuzz #9880)

llvm-svn: 346225

6 years ago[clangd] Deduplicate query scopes.
Eric Liu [Tue, 6 Nov 2018 11:17:40 +0000 (11:17 +0000)]
[clangd] Deduplicate query scopes.

Summary:
For example, when anonymous namespace is present, duplicated namespaces might be
generated for the enclosing namespace.

Reviewers: ilya-biryukov

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

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

llvm-svn: 346224

6 years ago[clangd] Get rid of QueryScopes.empty() == AnyScope special case.
Eric Liu [Tue, 6 Nov 2018 11:08:17 +0000 (11:08 +0000)]
[clangd] Get rid of QueryScopes.empty() == AnyScope special case.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 346223

6 years agoPrioritize the constructor call of __local_xray_dyninit()
Kamil Rytarowski [Tue, 6 Nov 2018 10:59:21 +0000 (10:59 +0000)]
Prioritize the constructor call of __local_xray_dyninit()

Summary:
For platforms without preinit support (such as NetBSD/amd64) the
initialization routine __xray_init() was called in non-deterministic order
compared to other constructors. This caused breakage failures
as xray routines attempted to execute code with assumption of
being initialized, which was no always true.

Use GCC/Clang extension to set maximal priority to the constructor
calling __xray_init(). This code switches away from C++ lambda form,
as it did not allow to specify this compiler extension.

Reviewers: dberris, joerg

Reviewed By: dberris

Subscribers: llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 346222

6 years ago[clangd] auto-index stores symbols per-file instead of per-TU.
Eric Liu [Tue, 6 Nov 2018 10:55:21 +0000 (10:55 +0000)]
[clangd] auto-index stores symbols per-file instead of per-TU.

Summary:
This allows us to deduplicate header symbols across TUs. File digests
are collects when collecting symbols/refs. And the index store deduplicates
file symbols based on the file digest.

Reviewers: sammccall, hokein

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 346221

6 years agoAdd parens to silence warning
Benjamin Kramer [Tue, 6 Nov 2018 10:13:37 +0000 (10:13 +0000)]
Add parens to silence warning

MSVCUndecoratedNameParser.cpp:25:36: warning: '&&' within '||' [-Wlogical-op-parentheses]

llvm-svn: 346220

6 years ago[clang-tidy] run() doesn't update the SourceManager.
Sam McCall [Tue, 6 Nov 2018 09:28:23 +0000 (09:28 +0000)]
[clang-tidy] run() doesn't update the SourceManager.

Summary:
By now the context's SourceManager is now initialized everywhere that
ClangTidyCheck::registerMatcher() is called, so the call from run() seems
entirely redundant, and indeed all the tests pass.

This solves a problem with embedding clang-tidy: if using a DiagnosticsEngine
which already has file state, re-setting its SourceManager (to the same value)
causes an assertion.
(There are other ways to solve this problem, but this is the simplest).

Reviewers: hokein, alexfh

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 346219

6 years ago[Support] Fix `warning: unknown pragma ignored` for mingw target
Martin Storsjo [Tue, 6 Nov 2018 09:08:20 +0000 (09:08 +0000)]
[Support] Fix `warning: unknown pragma ignored` for mingw target

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

llvm-svn: 346218

6 years ago[NFC] Turn collectTransitivePredecessors into a static function
Max Kazantsev [Tue, 6 Nov 2018 09:07:03 +0000 (09:07 +0000)]
[NFC] Turn collectTransitivePredecessors into a static function

llvm-svn: 346217

6 years agoT was unused on assertion disabled builds.
Kadir Cetinkaya [Tue, 6 Nov 2018 08:59:25 +0000 (08:59 +0000)]
T was unused on assertion disabled builds.

llvm-svn: 346216

6 years ago[sanitizer] Use AT_EXECFN in ReExec() if available
Benjamin Kramer [Tue, 6 Nov 2018 08:53:38 +0000 (08:53 +0000)]
[sanitizer] Use AT_EXECFN in ReExec() if available

execve("/proc/self/exe") will not work if the binary relies on
$EXEC_ORIGIN in an rpath. Query AT_EXECFN instead, which will give the
same string that the current binary was exec'd with.

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

llvm-svn: 346215

6 years ago[XRay] Update XRayRecord to support Custom/Typed Events
Dean Michael Berris [Tue, 6 Nov 2018 08:51:37 +0000 (08:51 +0000)]
[XRay] Update XRayRecord to support Custom/Typed Events

Summary:
This change cuts across LLVM and compiler-rt to add support for
rendering custom events in the XRayRecord type, to allow for including
user-provided annotations in the output YAML (as raw bytes).

This work enables us to add custom event and typed event records into
the `llvm::xray::Trace` type for user-provided events. This can then be
programmatically handled through the C++ API and can be included in some
of the tooling as well. For now we support printing the raw data we
encounter in the custom events in the converted output.

Future work will allow us to start interpreting these custom and typed
events through a yet-to-be-defined API for extending the trace analysis
library.

Reviewers: mboerger

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 346214

6 years ago[PDB] Introduce `MSVCUndecoratedNameParser`
Aleksandr Urakov [Tue, 6 Nov 2018 08:02:55 +0000 (08:02 +0000)]
[PDB] Introduce `MSVCUndecoratedNameParser`

This patch introduces the simple MSVCUndecoratedNameParser. It is needed for
parsing names of PDB symbols corresponding to template instantiations. For
example, for the name `operator<<A>'::`2'::B::operator> we can't just split the
name with :: (as it is implemented for now) to retrieve its scopes. This parser
processes such names in a more correct way.

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

llvm-svn: 346213

6 years agoCast to uint64_t instead of to unsigned.
Akira Hatanaka [Tue, 6 Nov 2018 07:12:28 +0000 (07:12 +0000)]
Cast to uint64_t instead of to unsigned.

This is a follow-up to r346211.

llvm-svn: 346212

6 years agoos_log: Allow specifying mask type in format string.
Akira Hatanaka [Tue, 6 Nov 2018 07:05:14 +0000 (07:05 +0000)]
os_log: Allow specifying mask type in format string.

A mask type is a 1 to 8-byte string that follows the "mask." annotation
in the format string. This enables obfuscating data in the event the
provided privacy level isn't enabled.

rdar://problem/36756282

llvm-svn: 346211

6 years agoos_log: Add a new privacy annotation "sensitive".
Akira Hatanaka [Tue, 6 Nov 2018 06:26:17 +0000 (06:26 +0000)]
os_log: Add a new privacy annotation "sensitive".

This is a stricter privacy annotation than "private", which will be used
for data that shouldn’t be logged to disk. For backward compatibility,
the "private" bit is set too.

rdar://problem/36755912

llvm-svn: 346210

6 years agoos_log: Minor code cleanups. NFC.
Akira Hatanaka [Tue, 6 Nov 2018 05:41:33 +0000 (05:41 +0000)]
os_log: Minor code cleanups. NFC.

Also, add a new test case and fix an incorrect comment.

llvm-svn: 346209

6 years ago[COFF, ARM64] Implement InterlockedDecrement*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:07:43 +0000 (05:07 +0000)]
[COFF, ARM64] Implement InterlockedDecrement*_* builtins

This is eight in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54068
llvm-svn: 346208

6 years ago[COFF, ARM64] Implement InterlockedIncrement*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:05:32 +0000 (05:05 +0000)]
[COFF, ARM64] Implement InterlockedIncrement*_* builtins

This is seventh in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54067
llvm-svn: 346207

6 years ago[COFF, ARM64] Implement InterlockedAnd*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:03:13 +0000 (05:03 +0000)]
[COFF, ARM64] Implement InterlockedAnd*_* builtins

This is sixth in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54066
llvm-svn: 346206

6 years ago[COFF, ARM64] Implement InterlockedXor*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 04:55:20 +0000 (04:55 +0000)]
[COFF, ARM64] Implement InterlockedXor*_* builtins

This is fifth in a series of patches to move intrinsic definitions out of intrin.h.

Note: This was reviewed and approved in D54065 but somehow that diff was messed
up. Committing this again with the proper diff.

llvm-svn: 346205

6 years ago[LICM] Remove too conservative IsMustExecute variable
Max Kazantsev [Tue, 6 Nov 2018 04:17:40 +0000 (04:17 +0000)]
[LICM] Remove too conservative IsMustExecute variable

LICM relies on variable `MustExecute` which is conservatively set to `false`
in all non-headers. It is used when we decide whether or not we want to hoist
an instruction or a guard.

For the guards, it might be too conservative to use this variable, we can
instead use a more precise logic from LoopSafetyInfo. Currently it is only NFC
because `IsMemoryNotModified` is also conservatively set to `false` for all
non-headers, and we cannot hoist guards from non-header blocks. However once we
give up using `IsMemoryNotModified` and use a smarter check instead, this will
allow us to hoist guards from all mustexecute non-header blocks.

Differential Revision: https://reviews.llvm.org/D50888
Reveiwed By: fedor.sergeev

llvm-svn: 346204

6 years agoAArch64: Cleanup CCMP code; NFC
Matthias Braun [Tue, 6 Nov 2018 03:15:22 +0000 (03:15 +0000)]
AArch64: Cleanup CCMP code; NFC

Cleanup CCMP pattern matching code in preparation for review/bugfix:
- Rename `isConjunctionDisjunctionTree()` to `canEmitConjunction()`
  (it won't accept arbitrary disjunctions and is really about whether we
   can transform the subtree into a conjunction that we can emit).
- Rename `emitConjunctionDisjunctionTree()` to `emitConjunction()`

llvm-svn: 346203

6 years agoIt's a test commit, which is my first commit and also add my name to CREDITS.TXT
Zi Xuan Wu [Tue, 6 Nov 2018 03:07:03 +0000 (03:07 +0000)]
It's a test commit, which is my first commit and also add my name to CREDITS.TXT

llvm-svn: 346202

6 years ago[LICM] Use ICFLoopSafetyInfo in LICM
Max Kazantsev [Tue, 6 Nov 2018 02:44:49 +0000 (02:44 +0000)]
[LICM] Use ICFLoopSafetyInfo in LICM

This patch makes LICM use `ICFLoopSafetyInfo` that is a smarter version
of LoopSafetyInfo that leverages power of Implicit Control Flow Tracking
to keep track of throwing instructions and give less pessimistic answers
to queries related to throws.

The ICFLoopSafetyInfo itself has been introduced in rL344601. This patch
enables it in LICM only.

Differential Revision: https://reviews.llvm.org/D50377
Reviewed By: apilipenko

llvm-svn: 346201

6 years ago[CodeGenCXX] XFAIL test for ASAN on Darwin.
Volodymyr Sapsai [Tue, 6 Nov 2018 02:16:28 +0000 (02:16 +0000)]
[CodeGenCXX] XFAIL test for ASAN on Darwin.

The test hits stack overflow trying to instantiate recursive templates.
It is observed with ASAN and not with a regular build because ASAN
increases stack frame size.

rdar://problem/45009892

Reviewers: george.karpenkov, lebedev.ri

Reviewed By: george.karpenkov

Subscribers: dexonsmith, rjmccall, cfe-commits

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

llvm-svn: 346200

6 years ago[NFC] Add motivating test case for revert in rL346198
Max Kazantsev [Tue, 6 Nov 2018 02:12:44 +0000 (02:12 +0000)]
[NFC] Add motivating test case for revert in rL346198

llvm-svn: 346199

6 years agoRevert "[IndVars] Smart hard uses detection"
Max Kazantsev [Tue, 6 Nov 2018 02:02:05 +0000 (02:02 +0000)]
Revert "[IndVars] Smart hard uses detection"

This reverts commit 2f425e9c7946b9d74e64ebbfa33c1caa36914402.

It seems that the check that we still should do the transform if we
know the result is constant is missing in this code. So the logic that
has been deleted by this change is still sometimes accidentally useful.
I revert the change to see what can be done about it. The motivating
case is the following:

@Y = global [400 x i16] zeroinitializer, align 1

define i16 @foo() {
entry:
  br label %for.body

for.body:                                         ; preds = %entry, %for.body
  %i = phi i16 [ 0, %entry ], [ %inc, %for.body ]

  %arrayidx = getelementptr inbounds [400 x i16], [400 x i16]* @Y, i16 0, i16 %i
  store i16 0, i16* %arrayidx, align 1
  %inc = add nuw nsw i16 %i, 1
  %cmp = icmp ult i16 %inc, 400
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.body
  %inc.lcssa = phi i16 [ %inc, %for.body ]
  ret i16 %inc.lcssa
}

We should be able to figure out that the result is constant, but the patch
breaks it.

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

llvm-svn: 346198

6 years ago[LLVM-C] Fix Windows Build of Core
Robert Widmann [Tue, 6 Nov 2018 01:54:12 +0000 (01:54 +0000)]
[LLVM-C] Fix Windows Build of Core

strndup doesn't exist outside of GNU-land and modern macOSes.  Use
strdup instead as c_str() is guaranteed to be NUL-terminated.

llvm-svn: 346197

6 years agoDisable XRay test fork_basic_logging for NetBSD
Kamil Rytarowski [Tue, 6 Nov 2018 01:53:54 +0000 (01:53 +0000)]
Disable XRay test fork_basic_logging for NetBSD

This code has not been ported so far.

llvm-svn: 346196

6 years ago[LLVM-C] Improve Intrinsics Bindings
Robert Widmann [Tue, 6 Nov 2018 01:38:14 +0000 (01:38 +0000)]
[LLVM-C] Improve Intrinsics Bindings

Summary:
Improve the intrinsic bindings with operations for

- Retrieving and automatically inserting the declaration of an intrinsic by ID
- Retrieving the name of a non-overloaded intrinsic by ID
- Retrieving the name of an overloaded intrinsic by ID and overloaded parameter types

Improve the echo test to copy non-overloaded intrinsics by ID.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 346195

6 years agoFollow Windows' approach for NetBSD in AlarmCallback()
Kamil Rytarowski [Tue, 6 Nov 2018 01:28:01 +0000 (01:28 +0000)]
Follow Windows' approach for NetBSD in AlarmCallback()

NetBSD's current behavior needs to ignore check for
InFuzzingThread() in Fuzzer::AlarmCallback().

llvm-svn: 346194

6 years ago[libFuzzer] Disable value-profile-cmp.test and fuzzer-oom.test on ARM64
George Karpenkov [Tue, 6 Nov 2018 01:15:51 +0000 (01:15 +0000)]
[libFuzzer] Disable value-profile-cmp.test and fuzzer-oom.test on ARM64

value-profile-cmp was always flaky, and OOM fails to work in some environments.
counters.test fails when vectorization is enabled, and it is more likely
to kick in when compiling for ARM.

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

llvm-svn: 346193

6 years agoRevert "[COFF, ARM64] Implement InterlockedXor*_* builtins"
Mandeep Singh Grang [Tue, 6 Nov 2018 01:14:24 +0000 (01:14 +0000)]
Revert "[COFF, ARM64] Implement InterlockedXor*_* builtins"

This reverts commit cc3d3cd0fbeb88412d332354c261ff139c4ede6b.

llvm-svn: 346192

6 years ago[COFF, ARM64] Implement InterlockedXor*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 01:12:29 +0000 (01:12 +0000)]
[COFF, ARM64] Implement InterlockedXor*_* builtins

Summary: This is fifth in a series of patches to move intrinsic definitions out of intrin.h.

Reviewers: rnk, efriedma, mstorsjo, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

llvm-svn: 346191

6 years ago[COFF, ARM64] Implement InterlockedOr*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 01:11:25 +0000 (01:11 +0000)]
[COFF, ARM64] Implement InterlockedOr*_* builtins

This is fourth in a series of patches to move intrinsic definitions out of intrin.h.

llvm-svn: 346190

6 years ago[COFF, ARM64] Implement InterlockedCompareExchange*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 00:36:48 +0000 (00:36 +0000)]
[COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

Summary: This is third in a series of patches to move intrinsic definitions out of intrin.h.

Reviewers: rnk, efriedma, mstorsjo, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

llvm-svn: 346189

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 6 Nov 2018 00:31:27 +0000 (00:31 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 346188

6 years agoRevert "[WebAssembly] Fixup `main` signature by default"
Sam Clegg [Tue, 6 Nov 2018 00:31:02 +0000 (00:31 +0000)]
Revert "[WebAssembly] Fixup `main` signature by default"

This reverts rL345880.  It caused some test failures on the
webassembly waterfall.  e.g. binaryen2.test_mainenv fails due
the fact that `envp` ends up being undef rather than 0.

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

llvm-svn: 346187

6 years ago[TestVLA] Fix a python decorator.
Davide Italiano [Tue, 6 Nov 2018 00:18:17 +0000 (00:18 +0000)]
[TestVLA] Fix a python decorator.

llvm-svn: 346186

6 years agoSpecify REQUIRES: default_triple in two debuginfo tests
Justin Bogner [Tue, 6 Nov 2018 00:16:32 +0000 (00:16 +0000)]
Specify REQUIRES: default_triple in two debuginfo tests

These were failing when specifying LLVM_DEFAULT_TARGET_TRIPLE=''

llvm-svn: 346185

6 years agoTargetMachine: Move lib/CodeGen specific callbacks to LLVMTargetMachine; NFC
Matthias Braun [Mon, 5 Nov 2018 23:49:15 +0000 (23:49 +0000)]
TargetMachine: Move lib/CodeGen specific callbacks to LLVMTargetMachine; NFC

llvm-svn: 346184

6 years agoMachineFunction: Store more specific reference to LLVMTargetMachine; NFC
Matthias Braun [Mon, 5 Nov 2018 23:49:14 +0000 (23:49 +0000)]
MachineFunction: Store more specific reference to LLVMTargetMachine; NFC

MachineFunction can only be used in code using lib/CodeGen, hence we
can keep a more specific reference to LLVMTargetMachine rather than just
TargetMachine around.

Do the same for references in ScheduleDAG and RegUsageInfoCollector.

llvm-svn: 346183

6 years agoMachineModuleInfo: Store more specific reference to LLVMTargetMachine; NFC
Matthias Braun [Mon, 5 Nov 2018 23:49:13 +0000 (23:49 +0000)]
MachineModuleInfo: Store more specific reference to LLVMTargetMachine; NFC

MachineModuleInfo can only be used in code using lib/CodeGen, hence we
can keep a more specific reference to LLVMTargetMachine rather than just
TargetMachine around.

llvm-svn: 346182

6 years ago[DWARF] Support types CU list in .gdb_index dumping
Fangrui Song [Mon, 5 Nov 2018 23:27:53 +0000 (23:27 +0000)]
[DWARF] Support types CU list in .gdb_index dumping

Some executables have non-empty types CU list and -gdb-index would report "<error reporting>" before.

llvm-svn: 346181

6 years ago[TargetLowering] Change TargetLoweringBase::getPreferredVectorAction to take an MVT...
Craig Topper [Mon, 5 Nov 2018 23:26:13 +0000 (23:26 +0000)]
[TargetLowering] Change TargetLoweringBase::getPreferredVectorAction to take an MVT instead of an EVT. NFC

The main caller of this already has an MVT and several targets called getSimpleVT inside without checking isSimple. This makes the simpleness explicit.

llvm-svn: 346180