platform/upstream/llvm.git
5 years ago[X86] Add test case for D58805. NFC
Craig Topper [Fri, 1 Mar 2019 21:02:34 +0000 (21:02 +0000)]
[X86] Add test case for D58805. NFC

This demonstrates dead store elimination removing a store that may alias a gather that uses null as its base.

llvm-svn: 355227

5 years ago[DWARF] Make -g with empty assembler source work better.
Paul Robinson [Fri, 1 Mar 2019 20:58:04 +0000 (20:58 +0000)]
[DWARF] Make -g with empty assembler source work better.

This was sometimes causing clang or llvm-mc to crash, and in other
cases could emit a bogus DWARF line-table header. I did an interim
patch in r352541; this patch should be a cleaner and more complete
fix, and retains the test.

Addresses PR40538.

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

llvm-svn: 355226

5 years ago[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.
Evgeniy Stepanov [Fri, 1 Mar 2019 20:54:16 +0000 (20:54 +0000)]
[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.

They return void, unlike memset/memcpy/memmove.

llvm-svn: 355225

5 years ago[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV...
Craig Topper [Fri, 1 Mar 2019 20:18:38 +0000 (20:18 +0000)]
[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary.

Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts.

By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up.

This removes something like 40,000 bytes from the X86 isel table.

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

llvm-svn: 355224

5 years ago[ValueTracking] Known bits support for unsigned saturating add/sub
Nikita Popov [Fri, 1 Mar 2019 20:07:04 +0000 (20:07 +0000)]
[ValueTracking] Known bits support for unsigned saturating add/sub

We have two sources of known bits:

1. For adds leading ones of either operand are preserved. For sub
leading zeros of LHS and leading ones of RHS become leading zeros in
the result.

2. The saturating math is a select between add/sub and an all-ones/
zero value. As such we can carry out the add/sub known bits
calculation, and only preseve the known one/zero bits respectively.

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

llvm-svn: 355223

5 years ago[InstCombine] Extend saturating idempotent atomicrmw transform to FP
Philip Reames [Fri, 1 Mar 2019 19:50:36 +0000 (19:50 +0000)]
[InstCombine] Extend saturating idempotent atomicrmw transform to FP

I'm assuming that the nan propogation logic for InstructonSimplify's handling of fadd and fsub is correct, and applying the same to atomicrmw.

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

llvm-svn: 355222

5 years ago[InstCombine] move add after umin/umax
Sanjay Patel [Fri, 1 Mar 2019 19:42:40 +0000 (19:42 +0000)]
[InstCombine] move add after umin/umax

In the motivating cases from PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613
...moving the add enables us to narrow the
min/max which eliminates zext/trunc which
enables signficantly better vectorization.
But that bug is still not completely fixed.

https://rise4fun.com/Alive/5KQ

  Name: umax
  Pre: C1 u>= C0
  %a = add nuw i8 %x, C0
  %cond = icmp ugt i8 %a, C1
  %r = select i1 %cond, i8 %a, i8 C1
  =>
  %c2 = icmp ugt i8 %x, C1-C0
  %u2 = select i1 %c2, i8 %x, i8 C1-C0
  %r = add nuw i8 %u2, C0

  Name: umin
  Pre: C1 u>= C0
  %a = add nuw i32 %x, C0
  %cond = icmp ult i32 %a, C1
  %r = select i1 %cond, i32 %a, i32 C1
  =>
  %c2 = icmp ult i32 %x, C1-C0
  %u2 = select i1 %c2, i32 %x, i32 C1-C0
  %r = add nuw i32 %u2, C0

llvm-svn: 355221

5 years ago[InstCombine] add tests for umin/umax narrowing (PR14613); NFC
Sanjay Patel [Fri, 1 Mar 2019 19:42:34 +0000 (19:42 +0000)]
[InstCombine] add tests for umin/umax narrowing (PR14613); NFC

llvm-svn: 355220

5 years agoRevert "[MIPS GlobalISel] Fix mul operands"
Vlad Tsyrklevich [Fri, 1 Mar 2019 18:58:22 +0000 (18:58 +0000)]
Revert "[MIPS GlobalISel] Fix mul operands"

This reverts commit r355178, it is causing ASan failures on the
sanitizer bots.

llvm-svn: 355219

5 years agoELF: Change FileSize back to a uint64_t.
Peter Collingbourne [Fri, 1 Mar 2019 18:53:41 +0000 (18:53 +0000)]
ELF: Change FileSize back to a uint64_t.

This lets us detect file size overflows when creating a 64-bit binary on
a 32-bit machine.

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

llvm-svn: 355218

5 years ago[LICM] Infer proper alignment from loads during scalar promotion
Philip Reames [Fri, 1 Mar 2019 18:45:05 +0000 (18:45 +0000)]
[LICM] Infer proper alignment from loads during scalar promotion

This patch fixes an issue where we would compute an unnecessarily small alignment during scalar promotion when no store is not to be guaranteed to execute, but we've proven load speculation safety. Since speculating a load requires proving the existing alignment is valid at the new location (see Loads.cpp), we can use the alignment fact from the load.

For non-atomics, this is a performance problem. For atomics, this is a correctness issue, though an *incredibly* rare one to see in practice. For atomics, we might not be able to lower an improperly aligned load or store (i.e. i32 align 1). If such an instruction makes it all the way to codegen, we *may* fail to codegen the operation, or we may simply generate a slow call to a library function. The part that makes this super hard to see in practice is that the memory location actually *is* well aligned, and instcombine knows that. So, to see a failure, you have to have a) hit the bug in LICM, b) somehow hit a depth limit in InstCombine/ValueTracking to avoid fixing the alignment, and c) then have generated an instruction which fails codegen rather than simply emitting a slow libcall. All around, pretty hard to hit.

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

llvm-svn: 355217

5 years ago[PGO] Remove the default parameter in ProfileSummary API. NFC
Rong Xu [Fri, 1 Mar 2019 18:36:24 +0000 (18:36 +0000)]
[PGO] Remove the default parameter in ProfileSummary API. NFC

Remove the default parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.

llvm-svn: 355216

5 years ago[Tests] More missing atomicrmw combines
Philip Reames [Fri, 1 Mar 2019 18:24:05 +0000 (18:24 +0000)]
[Tests] More missing atomicrmw combines

llvm-svn: 355215

5 years ago[msan] Add an interceptor for ttyname().
Evgeniy Stepanov [Fri, 1 Mar 2019 18:22:44 +0000 (18:22 +0000)]
[msan] Add an interceptor for ttyname().

llvm-svn: 355214

5 years agoResubmit r354706 with a fix for process launch.
Jim Ingham [Fri, 1 Mar 2019 18:13:38 +0000 (18:13 +0000)]
Resubmit r354706 with a fix for process launch.

When the debugger is run in sync mode, you need to
be able to tell whether a hijacked resume is for some
special purpose (like waiting for the SIGSTOP on attach)
or just to perform a synchronous resume.  Target::Launch was doing
that wrong, and that caused stop-hooks on process launch
in source files to behave incorrectly.

<rdar://problem/48115661>

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

llvm-svn: 355213

5 years ago[Tests] Add tests for missed optimizations of saturating and idempotent FP atomicrmws
Philip Reames [Fri, 1 Mar 2019 18:10:37 +0000 (18:10 +0000)]
[Tests] Add tests for missed optimizations of saturating and idempotent FP atomicrmws

llvm-svn: 355212

5 years ago[lld][test] Fix tests. llvm-readobj now emits symbol section names.
Matt Davis [Fri, 1 Mar 2019 18:01:41 +0000 (18:01 +0000)]
[lld][test] Fix tests. llvm-readobj now emits symbol section names.

This is the result of patch 99e9c4cad08164b9c0ca565ab9ad48ce132e98e5
See the related patch https://reviews.llvm.org/D58796

llvm-svn: 355211

5 years ago[InstCombine] Extend "idempotent" atomicrmw optimizations to floating point
Philip Reames [Fri, 1 Mar 2019 18:00:07 +0000 (18:00 +0000)]
[InstCombine] Extend "idempotent" atomicrmw optimizations to floating point

An idempotent atomicrmw is one that does not change memory in the process of execution.  We have already added handling for the various integer operations; this patch extends the same handling to floating point operations which were recently added to IR.

Note: At the moment, we canonicalize idempotent fsub to fadd when ordering requirements prevent us from using a load.  As discussed in the review, I will be replacing this with canonicalizing both floating point ops to integer ops in the near future.

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

llvm-svn: 355210

5 years ago[PGO] Use the explicit parameter in ProfileSummary API. NFC
Rong Xu [Fri, 1 Mar 2019 17:50:20 +0000 (17:50 +0000)]
[PGO] Use the explicit parameter in ProfileSummary API. NFC

Use the explicit parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.

llvm-svn: 355209

5 years agoRevert "[WebAssembly] Lower SIMD shifts since they are fixed in V8"
Thomas Lively [Fri, 1 Mar 2019 17:43:55 +0000 (17:43 +0000)]
Revert "[WebAssembly] Lower SIMD shifts since they are fixed in V8"

They weren't fixed in V8. Oops.

llvm-svn: 355208

5 years ago[llvm-readobj] Display section names for STT_SECTION symbols.
Matt Davis [Fri, 1 Mar 2019 17:31:32 +0000 (17:31 +0000)]
[llvm-readobj] Display section names for STT_SECTION symbols.

Summary:
This patch will obtain the section name for symbols that refer to a section.  Prior to this patch the Name field for STT_SECTIONs was blank, now it is populated.

Before:
```
Symbol table '.symtab' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
     5: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND sym
```

With this patch:
```
Symbol table '.symtab' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 .text
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
     5: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND sym
```

This fixes PR40788

Reviewers: jhenderson, rupprecht, espindola

Reviewed By: rupprecht

Subscribers: emaste, javed.absar, arichardson, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 355207

5 years ago[InstCombine] add tests for add+umin/umax canonicalization; NFC
Sanjay Patel [Fri, 1 Mar 2019 17:29:10 +0000 (17:29 +0000)]
[InstCombine] add tests for add+umin/umax canonicalization; NFC

Fixing this should solve the biggest part of the vector problems seen in:
https://bugs.llvm.org/show_bug.cgi?id=14613

llvm-svn: 355206

5 years agoHide two unused debugging methods, NFCI.
Jonas Hahnfeld [Fri, 1 Mar 2019 17:15:21 +0000 (17:15 +0000)]
Hide two unused debugging methods, NFCI.

GCC correctly moans that PlainCFGBuilder::isExternalDef(llvm::Value*) and
StackSafetyDataFlowAnalysis::verifyFixedPoint() are defined but not used
in Release builds. Hide them behind 'ifndef NDEBUG'.

llvm-svn: 355205

5 years agoReland "[compiler-rt] Intercept the bcmp() function."
Clement Courbet [Fri, 1 Mar 2019 16:42:08 +0000 (16:42 +0000)]
Reland "[compiler-rt] Intercept the bcmp() function."

Fix test issues on darwin: The REQUIRES for the test should be the same as the
guard for whether we intercept bcmp.

llvm-svn: 355204

5 years ago[scudo][standalone] Fix tests makefile
Kostya Kortchinsky [Fri, 1 Mar 2019 15:46:23 +0000 (15:46 +0000)]
[scudo][standalone] Fix tests makefile

Summary:
A missing `STATIC` entailed some annoying to debug failures wrt 32 vs 64
binaries. Additionally I noticed I was using the wrong variable (the Scudo
one as opposed to the Scudo Standalone one).

See https://reviews.llvm.org/D58184#1412417 and below for discussion.

Reviewers: vitalybuka, eugenis, brzycki

Reviewed By: vitalybuka, brzycki

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

Tags: #llvm, #sanitizers

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

llvm-svn: 355203

5 years agoTry to fix NetBSD buildbot breakage introduced in D57463.
Manman Ren [Fri, 1 Mar 2019 15:25:24 +0000 (15:25 +0000)]
Try to fix NetBSD buildbot breakage introduced in D57463.

By including the header file in the source.

llvm-svn: 355202

5 years ago[ARM] Fix FP16 stack loads/stores for Thumb2 with frame pointer
Oliver Stannard [Fri, 1 Mar 2019 14:20:28 +0000 (14:20 +0000)]
[ARM] Fix FP16 stack loads/stores for Thumb2 with frame pointer

The new addressing mode added for the v8.2A FP16 instructions uses bit 8 of the
immediate to encode the sign of the offset, like the other FP loads/stores, so
need to be treated the same way.

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

llvm-svn: 355201

5 years ago[clangd] Enable SuggestMissingIncludes by default.
Eric Liu [Fri, 1 Mar 2019 14:17:55 +0000 (14:17 +0000)]
[clangd] Enable SuggestMissingIncludes by default.

Summary: This seems to work stably now. Turn on by default.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 355200

5 years ago[ARM] Consider undefined-on-NaN conditions in checkVSELConstraints
Oliver Stannard [Fri, 1 Mar 2019 13:58:25 +0000 (13:58 +0000)]
[ARM] Consider undefined-on-NaN conditions in checkVSELConstraints

This function was not checking for the condition code variants which are
undefined if either input is NaN, so we were missing selection of the VSEL
instruction in some cases when using -fno-honor-nans or -ffast-math.

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

llvm-svn: 355199

5 years ago[X86] Regenerate legalize test files
Simon Pilgrim [Fri, 1 Mar 2019 13:13:40 +0000 (13:13 +0000)]
[X86] Regenerate legalize test files

Noticed while getting update_mir_test_checks.py to work on python3

llvm-svn: 355198

5 years ago[Thumb] Add some integer abs testcases for different typesizes.
Simon Pilgrim [Fri, 1 Mar 2019 12:08:50 +0000 (12:08 +0000)]
[Thumb] Add some integer abs testcases for different typesizes.

Committed on behalf of @ikulagin (Ivan Kulagin)

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

llvm-svn: 355197

5 years ago[LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.
George Rimar [Fri, 1 Mar 2019 10:58:45 +0000 (10:58 +0000)]
[LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.

This change makes 3 tests to use yaml instead of binaries.

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

llvm-svn: 355196

5 years ago[ELF][ARM] Fix clang-armv7-linux-build-cache builds of LLD [NFC]
Peter Smith [Fri, 1 Mar 2019 10:52:25 +0000 (10:52 +0000)]
[ELF][ARM] Fix clang-armv7-linux-build-cache builds of LLD [NFC]

r355153 introduced a build failure on a build bot that uses clang natively
on an armv7-a machine. This a temporary fix to use size_t rather than
uint64_t.

llvm-svn: 355195

5 years ago[LLD][ELF] - Convert invalid/undefined-local-symbol-in-dso.test to use YAML
George Rimar [Fri, 1 Mar 2019 10:37:51 +0000 (10:37 +0000)]
[LLD][ELF] - Convert invalid/undefined-local-symbol-in-dso.test to use YAML

This removes a binary from the inputs and reduces the test case.

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

llvm-svn: 355194

5 years ago[yaml2obj] - Allow setting custom sh_info for RawContentSection sections.
George Rimar [Fri, 1 Mar 2019 10:18:16 +0000 (10:18 +0000)]
[yaml2obj] - Allow setting custom sh_info for RawContentSection sections.

This is for tweaking SHT_SYMTAB sections.
Their sh_info contains the (number of symbols + 1) usually.
But for creating invalid inputs for test cases it would be convenient
to allow explicitly override this field from YAML.

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

llvm-svn: 355193

5 years ago Attempt to fix buildbot after r354972 [#2]. NFCI.
Alexey Lapshin [Fri, 1 Mar 2019 10:15:18 +0000 (10:15 +0000)]
Attempt to fix buildbot after r354972 [#2]. NFCI.

llvm-svn: 355192

5 years ago[ARM GlobalISel] Support G_CTLZ for Thumb2
Diana Picus [Fri, 1 Mar 2019 10:12:28 +0000 (10:12 +0000)]
[ARM GlobalISel] Support G_CTLZ for Thumb2

Same as ARM mode but with different opcode.

llvm-svn: 355191

5 years ago[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer...
Pierre Gousseau [Fri, 1 Mar 2019 10:05:15 +0000 (10:05 +0000)]
[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer checks, NFC.

enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks.
This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare".

This is a recommit of r354873 but with a fix for unqualified lookup error in lldb cmake build bot.

Fixes: https://llvm.org/PR39425

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

llvm-svn: 355190

5 years ago[ARM GlobalISel] Check target flags in test. NFCI
Diana Picus [Fri, 1 Mar 2019 10:01:22 +0000 (10:01 +0000)]
[ARM GlobalISel] Check target flags in test. NFCI

There was a time when we couldn't dump target-specific flags such as
arm-sbrel etc, so the tests didn't check for them. We can now be more
specific in our tests.

llvm-svn: 355189

5 years agoFix file headers. NFC
Fangrui Song [Fri, 1 Mar 2019 09:52:53 +0000 (09:52 +0000)]
Fix file headers. NFC

llvm-svn: 355188

5 years ago[Tablegen] Add support for the !mul operator.
Nicola Zaghen [Fri, 1 Mar 2019 09:46:29 +0000 (09:46 +0000)]
[Tablegen] Add support for the !mul operator.

This is a small addition to arithmetic operations that improves
expressiveness of the language.

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

llvm-svn: 355187

5 years ago[ARM] Add armv8a triple to test check updaters
Oliver Stannard [Fri, 1 Mar 2019 09:26:21 +0000 (09:26 +0000)]
[ARM] Add armv8a triple to test check updaters

llvm-svn: 355186

5 years ago[CommandLine] Allow grouping options which can have values.
Igor Kudrin [Fri, 1 Mar 2019 09:22:42 +0000 (09:22 +0000)]
[CommandLine] Allow grouping options which can have values.

This patch allows all forms of values for options to be used at the end
of a group. With the fix, it is possible to follow the way GNU binutils
tools handle grouping options better. For example, the -j option can be
used with objdump in any of the following ways:

$ objdump -d -j .text a.o
$ objdump -d -j.text a.o
$ objdump -dj .text a.o
$ objdump -dj.text a.o

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

llvm-svn: 355185

5 years ago[CommandLine] Do not crash if an option has both ValueRequired and Grouping.
Igor Kudrin [Fri, 1 Mar 2019 09:20:56 +0000 (09:20 +0000)]
[CommandLine] Do not crash if an option has both ValueRequired and Grouping.

If an option, which requires a value, has a `cl::Grouping` formatting
modifier, it works well as far as it is used at the end of a group,
or as a separate argument. However, if the option appears accidentally
in the middle of a group, the program just crashes. This patch prints
an error message instead.

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

llvm-svn: 355184

5 years ago[llvm-readobj]Add test showing behaviour of thin archive member path printing
James Henderson [Fri, 1 Mar 2019 09:12:38 +0000 (09:12 +0000)]
[llvm-readobj]Add test showing behaviour of thin archive member path printing

This was a test requested in https://reviews.llvm.org/D58677.

Reviewed by: rupprecht, grimar, Higuoxing

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

llvm-svn: 355183

5 years ago[clang-format] [NFC] clang-format the Format library
Paul Hoad [Fri, 1 Mar 2019 09:09:54 +0000 (09:09 +0000)]
[clang-format] [NFC] clang-format the Format library

Previously revisions commited non-clang-formatted changes to the Format library, this means submitting any revision e.g. {D55170} can cause additional whitespace changes to potentially be included in a revision.

Commit a non functional change using latest build Windows clang-format r351376 with no other changes, to remove these differences

All FormatTests
pass [==========] 652 tests from 20 test cases ran.

llvm-svn: 355182

5 years agoCodeGen: Fix PR40605 by splitting constant struct initializers
Alexander Potapenko [Fri, 1 Mar 2019 09:00:41 +0000 (09:00 +0000)]
CodeGen: Fix PR40605 by splitting constant struct initializers

When emitting initializers for local structures for code built with
-ftrivial-auto-var-init, replace constant structures with sequences of
stores.

This appears to greatly help removing dead initialization stores to those
locals that are later overwritten by other data.
This also removes a lot of .rodata constants (see PR40605), replacing most
of them with immediate values (for Linux kernel the .rodata size is
reduced by ~1.9%)

llvm-svn: 355181

5 years ago[sanitizers] Explicitly use GetModuleFileNameW with wchar_t
Martin Storsjo [Fri, 1 Mar 2019 08:08:11 +0000 (08:08 +0000)]
[sanitizers] Explicitly use GetModuleFileNameW with wchar_t

Alternatively we could define the string as TCHAR.

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

llvm-svn: 355180

5 years ago[AMDGPU] Mark ds instructions as meybeAtomic
Stanislav Mekhanoshin [Fri, 1 Mar 2019 07:59:17 +0000 (07:59 +0000)]
[AMDGPU] Mark ds instructions as meybeAtomic

These were not recognized as potential atomics by memory legalizer.
The test was working not because legalizer did a right thing, but
because it has skipped all these instructions. When I have fixed
DS desciption test started to fail because region address has
changed from 4 to 2 a while ago.

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

llvm-svn: 355179

5 years ago[MIPS GlobalISel] Fix mul operands
Petar Avramovic [Fri, 1 Mar 2019 07:35:57 +0000 (07:35 +0000)]
[MIPS GlobalISel] Fix mul operands

Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.

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

llvm-svn: 355178

5 years ago[MIPS GlobalISel] Select G_UMULH
Petar Avramovic [Fri, 1 Mar 2019 07:25:44 +0000 (07:25 +0000)]
[MIPS GlobalISel] Select G_UMULH

Legalize G_UMULO and select G_UMULH for MIPS32.

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

llvm-svn: 355177

5 years agoFix file headers. NFC
Fangrui Song [Fri, 1 Mar 2019 06:49:51 +0000 (06:49 +0000)]
Fix file headers. NFC

llvm-svn: 355176

5 years ago[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
Akira Hatanaka [Fri, 1 Mar 2019 06:43:20 +0000 (06:43 +0000)]
[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
declaring an unavailable method in the subclass's extension that
overrides the designated initializer in the base class.

r243676 made changes to allow declaring the unavailable method in the
subclass interface to silence the warning. This commit additionally
allows declaring the unavailable method in the class extension.

rdar://problem/42731306

llvm-svn: 355175

5 years ago[ConstantHoisting] Call cleanup() in ConstantHoistingPass::runImpl to avoid dangling...
Fangrui Song [Fri, 1 Mar 2019 05:27:01 +0000 (05:27 +0000)]
[ConstantHoisting] Call cleanup() in ConstantHoistingPass::runImpl to avoid dangling elements in ConstIntInfoVec for new PM

Summary:
ConstIntInfoVec contains elements extracted from the previous function.
In new PM, releaseMemory() is not called and the dangling elements can
cause segfault in findConstantInsertionPoint.

Rename releaseMemory() to cleanup() to deliver the idea that it is
mandatory and call cleanup() in ConstantHoistingPass::runImpl to fix
this.

Reviewers: ormris, zzheng, dmgreen, wmi

Reviewed By: ormris, wmi

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355174

5 years ago[ELF] Explain some options in ld.lld.1
Fangrui Song [Fri, 1 Mar 2019 04:49:42 +0000 (04:49 +0000)]
[ELF] Explain some options in ld.lld.1

Reviewers: ruiu, grimar

Reviewed By: ruiu

Subscribers: srhines, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355173

5 years ago[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API
Julian Lettner [Fri, 1 Mar 2019 04:03:38 +0000 (04:03 +0000)]
[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API

Retrying without replacing call sites in sanitizer_common (which might
not have a symbol definition).

Add new Unwind API. This is the final envisioned API with the correct
abstraction level. It hides/slow fast unwinder selection from the caller
and doesn't take any arguments that would leak that abstraction (i.e.,
arguments like stack_top/stack_bottom).

GetStackTrace will become an implementation detail (private method) of
the BufferedStackTrace class.

Reviewers: vitalybuka

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

> llvm-svn: 355168

llvm-svn: 355172

5 years agoRevert "[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API"
Julian Lettner [Fri, 1 Mar 2019 03:35:05 +0000 (03:35 +0000)]
Revert "[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API"

This reverts commit 6112f37e758ebf2405955e091a745f5003c1f562.

llvm-svn: 355171

5 years agoUpdate com.apple.diagnosticd.diagnostic entitlement
Jason Molenda [Fri, 1 Mar 2019 03:34:51 +0000 (03:34 +0000)]
Update com.apple.diagnosticd.diagnostic entitlement
name to the newer com.apple.private.logging.diagnostic.

<rdar://problem/47183116>

llvm-svn: 355170

5 years agoIncrease timeout in Symbols::DownloadObjectAndSymbolFile
Jason Molenda [Fri, 1 Mar 2019 03:24:59 +0000 (03:24 +0000)]
Increase timeout in Symbols::DownloadObjectAndSymbolFile
from 30 seconds to 120 seconds.  We've seen cases where
this symbol lookup can exceed 30 seconds for people
working remotely.

<rdar://problem/48460476>

llvm-svn: 355169

5 years ago[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API
Julian Lettner [Fri, 1 Mar 2019 03:08:34 +0000 (03:08 +0000)]
[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API

Add new Unwind API. This is the final envisioned API with the correct
abstraction level. It hides/slow fast unwinder selection from the caller
and doesn't take any arguments that would leak that abstraction (i.e.,
arguments like stack_top/stack_bottom).

GetStackTrace will become an implementation detail (private method) of
the BufferedStackTrace class.

Reviewers: vitalybuka

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

llvm-svn: 355168

5 years ago[Subtarget] Remove static global constructor call from the tablegened subtarget featu...
Craig Topper [Fri, 1 Mar 2019 02:19:26 +0000 (02:19 +0000)]
[Subtarget] Remove static global constructor call from the tablegened subtarget feature tables

Subtarget features are stored in a std::bitset that has been subclassed. There is a special constructor to allow the tablegen files to provide a list of bits to initialize the std::bitset to. This constructor isn't constexpr and std::bitset doesn't support many constexpr operations either. This results in a static global constructor being used to initialize the feature bitsets in these files at startup.

To fix this I've introduced a new FeatureBitArray class that holds three 64-bit values representing the initial bit values and taught tablegen to emit hex constants for them based on the feature enum values. This makes the tablegen files less readable than they were before. I can add the list of features back as a comment if we think that's important.

I've added a method to convert from this class into the std::bitset subclass we had before. I considered making the new FeatureBitArray class just implement the std::bitset interface we need instead, but thought I'd see how others felts about that first.

I've simplified the interfaces to SetImpliedBits and ClearImpliedBits a little minimize the number of times we need to convert to the bitset.

This removes about 27K from my local release+asserts build of llc.

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

llvm-svn: 355167

5 years ago[CodeGen] Fix calling llvm.var.annotation outside of a basic block.
Volodymyr Sapsai [Fri, 1 Mar 2019 02:15:39 +0000 (02:15 +0000)]
[CodeGen] Fix calling llvm.var.annotation outside of a basic block.

When we have an annotated local variable after a function returns, we
generate IR that fails verification with the error

> Instruction referencing instruction not embedded in a basic block!

And it means that bitcast referencing alloca doesn't have a parent basic
block.

Fix by checking if we are at an unreachable point and skip emitting
annotations. This approach is similar to the way we emit variable
initializer and debug info.

rdar://problem/46200420

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: aprantl, jkorous, dexonsmith, cfe-commits

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

llvm-svn: 355166

5 years ago[hwasan] Disable vfork code when building w/o interceptors.
Evgeniy Stepanov [Fri, 1 Mar 2019 02:06:58 +0000 (02:06 +0000)]
[hwasan] Disable vfork code when building w/o interceptors.

Don't define vfork when OMPILER_RT_HWASAN_WITH_INTERCEPTORS=OFF.

llvm-svn: 355165

5 years ago[sanitizer] Build everything whereever possible with -z text.
Evgeniy Stepanov [Fri, 1 Mar 2019 01:45:01 +0000 (01:45 +0000)]
[sanitizer] Build everything whereever possible with -z text.

Reviewers: pcc, phosek

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355164

5 years ago[WebAssembly] Lower SIMD shifts since they are fixed in V8
Thomas Lively [Fri, 1 Mar 2019 01:38:54 +0000 (01:38 +0000)]
[WebAssembly] Lower SIMD shifts since they are fixed in V8

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 355163

5 years ago[libc++] Fix forgotten fclose() in unit test
Louis Dionne [Fri, 1 Mar 2019 01:32:44 +0000 (01:32 +0000)]
[libc++] Fix forgotten fclose() in unit test

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

llvm-svn: 355162

5 years ago[pstl] Fix missing parallel policy guards
Louis Dionne [Fri, 1 Mar 2019 01:26:35 +0000 (01:26 +0000)]
[pstl] Fix missing parallel policy guards

Thanks to @jerryct for the patch.
Differential Revision: https://reviews.llvm.org/D57638

llvm-svn: 355161

5 years ago[libc++] Increase portability of xalloc test
Louis Dionne [Fri, 1 Mar 2019 00:51:54 +0000 (00:51 +0000)]
[libc++] Increase portability of xalloc test

Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

llvm-svn: 355160

5 years agoAMDGPU/GlobalISel: Implement select for G_INSERT
Tom Stellard [Fri, 1 Mar 2019 00:50:26 +0000 (00:50 +0000)]
AMDGPU/GlobalISel: Implement select for G_INSERT

Re-commit r344310.

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 355159

5 years ago[clang-format][TableGen] Don't add spaces around items in square braces.
Jordan Rupprecht [Fri, 1 Mar 2019 00:12:18 +0000 (00:12 +0000)]
[clang-format][TableGen] Don't add spaces around items in square braces.

Summary:
clang-formatting wants to add spaces around items in square braces, e.g. [1, 2] -> [ 1, 2 ]. Based on a quick check [1], it seems like most cases are using the [1, 2] format, so make that the consistent one.

[1] in llvm `.td` files, the regex `\[[^ ]` (bracket followed by not-a-space) shows up ~400 times, but `\[\s[^ ]` (bracket followed by one space and one not-a-space) shows up ~40 times => ~90% uses this format.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 355158

5 years ago[WebAssembly] Fix crash when @llvm.global_dtors is external
Thomas Lively [Fri, 1 Mar 2019 00:12:13 +0000 (00:12 +0000)]
[WebAssembly] Fix crash when @llvm.global_dtors is external

Reviewers: aheejin

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

Tags: #llvm

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

llvm-svn: 355157

5 years agoAMDGPU/GlobalISel: Implement select for G_EXTRACT
Tom Stellard [Thu, 28 Feb 2019 23:37:48 +0000 (23:37 +0000)]
AMDGPU/GlobalISel: Implement select for G_EXTRACT

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 355156

5 years agoSymbols.cpp in unittest moved too.
Jason Molenda [Thu, 28 Feb 2019 23:37:28 +0000 (23:37 +0000)]
Symbols.cpp in unittest moved too.

llvm-svn: 355155

5 years ago[PPC] Secure PLT only has meaning for PIC
Joerg Sonnenberger [Thu, 28 Feb 2019 23:33:09 +0000 (23:33 +0000)]
[PPC] Secure PLT only has meaning for PIC

llvm-svn: 355154

5 years agoELF: Write .eh_frame_hdr explicitly after writing .eh_frame.
Peter Collingbourne [Thu, 28 Feb 2019 23:11:35 +0000 (23:11 +0000)]
ELF: Write .eh_frame_hdr explicitly after writing .eh_frame.

This lets us remove the special case from Writer::writeSections(), and also
fixes a bug where .eh_frame_hdr isn't necessarily written in the correct
order if a linker script moves .eh_frame and .eh_frame_hdr into the same
output section.

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

llvm-svn: 355153

5 years ago[sancov] Instrument reachable blocks that end in unreachable
Reid Kleckner [Thu, 28 Feb 2019 22:54:30 +0000 (22:54 +0000)]
[sancov] Instrument reachable blocks that end in unreachable

Summary:
These sorts of blocks often contain calls to noreturn functions, like
longjmp, throw, or trap. If they don't end the program, they are
"interesting" from the perspective of sanitizer coverage, so we should
instrument them. This was discussed in https://reviews.llvm.org/D57982.

Reviewers: kcc, vitalybuka

Subscribers: llvm-commits, craig.topper, efriedma, morehouse, hiraditya

Tags: #llvm

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

llvm-svn: 355152

5 years agollvm-readobj: Try the DWARF CFI dumper on all machines.
Peter Collingbourne [Thu, 28 Feb 2019 22:42:55 +0000 (22:42 +0000)]
llvm-readobj: Try the DWARF CFI dumper on all machines.

There's no reason to limit the DWARF CFI dumper to EM_386 and EM_X86_64;
ELF files could contain DWARF CFI on almost any platform (even 32-bit ARM;
NetBSD uses DWARF CFI on that platform). So start using the DWARF CFI dumper
unconditionally so that we can dump .eh_frame sections on the remaining ELF
platforms as well as in NetBSD binaries.

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

llvm-svn: 355151

5 years agoUpdate testcase since llvm-dwarfdump got more accurate in r355148.
Adrian Prantl [Thu, 28 Feb 2019 22:26:00 +0000 (22:26 +0000)]
Update testcase since llvm-dwarfdump got more accurate in r355148.

llvm-svn: 355150

5 years ago[CMake] Make liblldb depend on clang-headers
Alex Langford [Thu, 28 Feb 2019 22:24:18 +0000 (22:24 +0000)]
[CMake] Make liblldb depend on clang-headers

Summary:
The clang headers are useful when dealing with clang modules. There is also a
way to get to the clang headers from the SB API so it would be nice if they were
also available when we just build lldb.

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

llvm-svn: 355149

5 years agodsymutil support for DW_OP_convert
Adrian Prantl [Thu, 28 Feb 2019 22:12:32 +0000 (22:12 +0000)]
dsymutil support for DW_OP_convert

Add support for cloning DWARF expressions that contain base type DIE
references in dsymutil.

<rdar://problem/48167812>

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

llvm-svn: 355148

5 years agogn build: Merge r355133.
Peter Collingbourne [Thu, 28 Feb 2019 22:12:09 +0000 (22:12 +0000)]
gn build: Merge r355133.

llvm-svn: 355147

5 years agogn build: Merge r355035
Nico Weber [Thu, 28 Feb 2019 22:08:18 +0000 (22:08 +0000)]
gn build: Merge r355035

llvm-svn: 355146

5 years agogn build: Merge r355024
Nico Weber [Thu, 28 Feb 2019 22:07:37 +0000 (22:07 +0000)]
gn build: Merge r355024

llvm-svn: 355145

5 years agocfi: Rename source file from cc to cpp
Nico Weber [Thu, 28 Feb 2019 22:03:41 +0000 (22:03 +0000)]
cfi: Rename source file from cc to cpp

See discussion on https://reviews.llvm.org/D58620 for the review.

llvm-svn: 355144

5 years ago[CMake][LibFuzzer] Match symbol visibility setting between LibFuzzer object files...
Dan Liew [Thu, 28 Feb 2019 21:57:58 +0000 (21:57 +0000)]
[CMake][LibFuzzer] Match symbol visibility setting between LibFuzzer object files and unit tests.

Summary:
This fixes inconsistent symbol visibility. This shows up as a linker
warning if r336238 (43f633564e338a6dde83d49a48e5bfcbfdce292c) is
reverted.

```
ld: warning: direct access in function 'fuzzer::CleanseCrashInput(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, fuzzer::FuzzingOptions const&)' from file '/Volumes/data/dev/llvm/upstream/master/builds/projects/compiler-rt/lib/fuzzer/tests/libRTFuzzerTest.x86_64.a(FuzzerDriver.cpp.o)' to global weak symbol 'fuzzer::Command::ignoreRemainingArgs()::kIgnoreRemaining' from file 'FuzzerTestObjects.FuzzerUnittest.cpp.x86_64.o' means the weak symbol cannot be overridden
 at runtime. This was likely caused by different translation units being compiled with different visibility settings.
```

r336238 just hid the issue rather than fixing the real issue. On macOS
and other platforms we usually compile with `-fvisibility=hidden` but
the unit tests were compiled without this flag.

Reviewers: george.karpenkov, kubamracek, kcc, yln

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 355143

5 years ago[CMake][libunwind] Define add_target_flags which is missing
Petr Hosek [Thu, 28 Feb 2019 21:38:59 +0000 (21:38 +0000)]
[CMake][libunwind] Define add_target_flags which is missing

It's use was introduced in r353084 but its definition is missing.

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

llvm-svn: 355142

5 years ago[COFF] Add address-taken import thunks to the fid table
Reid Kleckner [Thu, 28 Feb 2019 21:05:41 +0000 (21:05 +0000)]
[COFF] Add address-taken import thunks to the fid table

Summary: Fixes PR39799

Reviewers: dmajor, hans

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355141

5 years ago[OpenMP][OMPT] Distinguish different barrier kinds
Jonathan Peyton [Thu, 28 Feb 2019 20:55:39 +0000 (20:55 +0000)]
[OpenMP][OMPT] Distinguish different barrier kinds

This change makes the runtime decide the intended use of each barrier
invocation, for the OMPT synchronization tool callbacks.  The OpenMP 5.0
specification defines four possible barrier kinds -- implicit, explicit,
implementation, and just normal barrier.

Patch by Hansang Bae

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

llvm-svn: 355140

5 years agoTrying to fix bot breakage due to symbols not defined for WINDOWS!
Manman Ren [Thu, 28 Feb 2019 20:48:19 +0000 (20:48 +0000)]
Trying to fix bot breakage due to symbols not defined for WINDOWS!

Follow up to r355133

llvm-svn: 355139

5 years ago[OpenMP 5.0] Deprecate nest-var and associated features
Jonathan Peyton [Thu, 28 Feb 2019 20:47:21 +0000 (20:47 +0000)]
[OpenMP 5.0] Deprecate nest-var and associated features

Nest-var, OMP_NESTED, omp_set_nested()., and omp_get_nested() have been
deprecated in the 5.0 spec. Initial nesting info is now derived from
OMP_MAX_ACTIVE_LEVELS, OMP_NUM_THREADS, and OMP_PROC_BIND.

This patch deprecates the internal ICV that corresponds to nest-var, and
replaces it with the max-active-levels-var ICV to determine nesting. The
change still allows for use of OMP_NESTED (according to 5.0 changes),
omp_get_nested, and omp_set_nested, which have had deprecation messages
added to them. The change allows certain settings of OMP_NUM_THREADS,
OMP_PROC_BIND, and OMP_MAX_ACTIVE_LEVELS to turn on nesting, but
OMP_NESTED=0 will still force nesting to be off.

The runtime now prints informative messages about deprecation of
OMP_NESTED, omp_set_nested(), and omp_get_nested(), when those
environment variables or routines are used. It also prints deprecated
message in output for KMP_SETTINGS and OMP_DISPLAY_ENV for OMP_NESTED.
This patch also fixes OMP_DISPLAY_ENV output for OMP_TARGET_OFFLOAD.

Patch by Terry Wilmarth

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

llvm-svn: 355138

5 years ago[hwasan] Fix vfork handling with large stack limit.
Evgeniy Stepanov [Thu, 28 Feb 2019 20:43:24 +0000 (20:43 +0000)]
[hwasan] Fix vfork handling with large stack limit.

Remove the maximum stack cleanup size check. With ulimit -s unlimited
main thread stack can be very large, but we don't really have a choice
other than cleaning all of it. It should be reasonably fast - hwasan
cleans large shadow ranges with a single madvise call.

This change fixes check-hwasan after ulimit -s unlimited.

llvm-svn: 355137

5 years ago[AArch64] [Windows] Don't skip constructing UnwindHelp.
Eli Friedman [Thu, 28 Feb 2019 20:38:45 +0000 (20:38 +0000)]
[AArch64] [Windows] Don't skip constructing UnwindHelp.

In certain cases, the first non-frame-setup instruction in a function is
a branch.  For example, it could be a cbz on an argument.  Make sure we
correctly allocate the UnwindHelp, and find an appropriate register to
use to initialize it.

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

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

llvm-svn: 355136

5 years ago[AArch64] [Windows] Fix llvm-readobj -unwind output with many epilogs.
Eli Friedman [Thu, 28 Feb 2019 20:33:22 +0000 (20:33 +0000)]
[AArch64] [Windows] Fix llvm-readobj -unwind output with many epilogs.

The number of epilog scopes may not fit into a uint8_t.

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

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

llvm-svn: 355135

5 years ago[AArch64] Improve FP16 vector convert from short instructions.
Abderrazek Zaafrani [Thu, 28 Feb 2019 20:21:46 +0000 (20:21 +0000)]
[AArch64] Improve FP16 vector convert from short instructions.
https://reviews.llvm.org/D58563

llvm-svn: 355134

5 years agoAdd a module pass for order file instrumentation
Manman Ren [Thu, 28 Feb 2019 20:13:38 +0000 (20:13 +0000)]
Add a module pass for order file instrumentation

The basic idea of the pass is to use a circular buffer to log the execution ordering of the functions. We only log the function when it is first executed. We use a 8-byte hash to log the function symbol name.

In this pass, we add three global variables:
(1) an order file buffer: a circular buffer at its own llvm section.
(2) a bitmap for each module: one byte for each function to say if the function is already executed.
(3) a global index to the order file buffer.

At the function prologue, if the function has not been executed (by checking the bitmap), log the function hash, then atomically increase the index.

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

llvm-svn: 355133

5 years ago[clang-tidy] add OverrideMacro to modernize-use-override check
Paul Hoad [Thu, 28 Feb 2019 20:00:48 +0000 (20:00 +0000)]
[clang-tidy] add OverrideMacro to modernize-use-override check

Summary:
The usefulness of **modernize-use-override** can be reduced if you have to live in an environment where you support multiple compilers, some of which sadly are not yet fully C++11 compliant

some codebases have to use override as a macro OVERRIDE e.g.

```
// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
```

This allows code to be compiled with C++11 compliant compilers and get warnings and errors that clang, MSVC,gcc can give, while still allowing other legacy pre C++11 compilers to compile the code. This can be an important step towards modernizing C++ code whilst living in a legacy codebase.

When it comes to clang tidy, the use of the **modernize-use-override** is one of the most useful checks, but the messages reported are inaccurate for that codebase if the standard approach is to use the macros OVERRIDE and/or FINAL.

When combined with fix-its that introduce the C++11 override keyword, they become fatal, resulting in the modernize-use-override check being turned off to prevent the introduction of such errors.

This revision, allows the possibility for the replacement **override **to be a macro instead, Allowing the clang-tidy check to be run on  both pre and post C++11 code, and allowing fix-its to be applied.

Reviewers: alexfh, JonasToth, hokein, Eugene.Zelenko, aaron.ballman

Reviewed By: alexfh, JonasToth

Subscribers: lewmpk, malcolm.parsons, jdoerfert, xazax.hun, cfe-commits, llvm-commits

Tags: #clang-tools-extra

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

llvm-svn: 355132

5 years ago[PGO] Context sensitive PGO (part 2)
Rong Xu [Thu, 28 Feb 2019 19:55:07 +0000 (19:55 +0000)]
[PGO] Context sensitive PGO (part 2)

Part 2 of CSPGO changes (mostly related to ProfileSummary).
Note that I use a default parameter in setProfileSummary() and getSummary().
This is to break the dependency in clang. I will make the parameter explicit
after changing clang in a separated patch.

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

llvm-svn: 355131

5 years ago[x86] scalarize extract element 0 of FP math
Sanjay Patel [Thu, 28 Feb 2019 19:47:04 +0000 (19:47 +0000)]
[x86] scalarize extract element 0 of FP math

This is another step towards ensuring that we produce the optimal code for reductions,
but there are other potential benefits as seen in the tests diffs:

  1. Memory loads may get scalarized resulting in more efficient code.
  2. Memory stores may get scalarized resulting in more efficient code.
  3. Complex ops like fdiv/sqrt get scalarized which may be faster instructions depending on uarch.
  4. Even simple ops like addss/subss/mulss/roundss may result in faster operation/less frequency throttling when scalarized depending on uarch.

The TODO comment suggests 1 or more follow-ups for opcodes that can currently result in regressions.

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

llvm-svn: 355130

5 years agoRevert "Revert "[sanitizers] Restore internal_readlink for x32""
H.J. Lu [Thu, 28 Feb 2019 19:34:01 +0000 (19:34 +0000)]
Revert "Revert "[sanitizers] Restore internal_readlink for x32""

This reverts revision 354601 and disables ReadBinaryNameCached check on
Windows since Windows has no working ReadBinaryName.

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

llvm-svn: 355129

5 years ago[Sanitizer] lit test config: Respect existing parallelism_group
Julian Lettner [Thu, 28 Feb 2019 19:26:53 +0000 (19:26 +0000)]
[Sanitizer] lit test config: Respect existing parallelism_group

llvm-svn: 355128