platform/upstream/llvm.git
4 years agoTry to heal bots more after r367551
Nico Weber [Thu, 1 Aug 2019 13:10:43 +0000 (13:10 +0000)]
Try to heal bots more after r367551

llvm-svn: 367555

4 years agoAdd llvm-dwarfdump to the list of test dependencies
Pavel Labath [Thu, 1 Aug 2019 12:50:25 +0000 (12:50 +0000)]
Add llvm-dwarfdump to the list of test dependencies

It is used by SymbolFile/DWARF/debug-types-dwo-cross-reference.cpp

llvm-svn: 367554

4 years ago[RISCV] Add Custom Parser for Atomic Memory Operands
Sam Elliott [Thu, 1 Aug 2019 12:42:31 +0000 (12:42 +0000)]
[RISCV] Add Custom Parser for Atomic Memory Operands

Summary:
GCC Accepts both (reg) and 0(reg) for atomic instruction memory
operands. These instructions do not allow for an offset in their
encoding, so in the latter case, the 0 is silently dropped.

Due to how we have structured the RISCVAsmParser, the easiest way to add
support for parsing this offset is to add a custom AsmOperand and
parser. This parser drops all the parens, and just keeps the register.

This commit also adds a custom printer for these operands, which matches
the GCC canonical printer, printing both `(a0)` and `0(a0)` as `(a0)`.

Reviewers: asb, lewis-revill

Reviewed By: asb

Subscribers: s.egerton, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, llvm-commits

Tags: #llvm

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

llvm-svn: 367553

4 years agoTry to heal bots after r367551
Nico Weber [Thu, 1 Aug 2019 12:42:28 +0000 (12:42 +0000)]
Try to heal bots after r367551

llvm-svn: 367552

4 years agocompiler-rt: Rename .cc file in lib/{dfsan,stats,ubsan_minimal} to .cpp
Nico Weber [Thu, 1 Aug 2019 12:41:23 +0000 (12:41 +0000)]
compiler-rt: Rename .cc file in lib/{dfsan,stats,ubsan_minimal} to .cpp

Like r367463, but for dfsan, stats, ubsan_minimal.

llvm-svn: 367551

4 years agocompiler-rt: Rename .cc file in lib/xray/tests/unit to .cpp
Nico Weber [Thu, 1 Aug 2019 12:35:27 +0000 (12:35 +0000)]
compiler-rt: Rename .cc file in lib/xray/tests/unit to .cpp

Like r367463, but for xray/texts/unit.

llvm-svn: 367550

4 years ago[lit] Use ld.lld -z separate-code to work around a debug_line parsing bug
Fangrui Song [Thu, 1 Aug 2019 12:34:43 +0000 (12:34 +0000)]
[lit] Use ld.lld -z separate-code to work around a debug_line parsing bug

The issue was exposed by D64903/r367537.
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/7321/

In these tests, .debug_str immediately follows .text.
The last section of last RX PT_LOAD was originally padded with trap
instructions and .debug_str started at a new page (actually
common-page-size). Now, .debug_str immediately follows .test.
Add -z separate-code to use the old layout.

llvm-svn: 367549

4 years ago[IR] Value: add replaceUsesWithIf() utility
Roman Lebedev [Thu, 1 Aug 2019 12:32:08 +0000 (12:32 +0000)]
[IR] Value: add replaceUsesWithIf() utility

Summary:
While there is always a `Value::replaceAllUsesWith()`,
sometimes the replacement needs to be conditional.

I have only cleaned a few cases where `replaceUsesWithIf()`
could be used, to both add test coverage,
and show that it is actually useful.

Reviewers: jdoerfert, spatel, RKSimon, craig.topper

Reviewed By: jdoerfert

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, aheejin, george.burgess.iv, asbirlea, llvm-commits

Tags: #llvm

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

llvm-svn: 367548

4 years ago[IR] SelectInst: add swapValues() utility
Roman Lebedev [Thu, 1 Aug 2019 12:31:35 +0000 (12:31 +0000)]
[IR] SelectInst: add swapValues() utility

Summary:
Sometimes we need to swap true-val and false-val of a `SelectInst`.
Having a function for that is nicer than hand-writing it each time.

Reviewers: spatel, RKSimon, craig.topper, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367547

4 years agocompiler-rt: Rename .cc file in lib/xray to .cpp
Nico Weber [Thu, 1 Aug 2019 12:30:58 +0000 (12:30 +0000)]
compiler-rt: Rename .cc file in lib/xray to .cpp

Like r367463, but for xray.

llvm-svn: 367546

4 years ago[Parser] Change parameter type from int to enum
Serge Pavlov [Thu, 1 Aug 2019 11:46:28 +0000 (11:46 +0000)]
[Parser] Change parameter type from int to enum

Some parser functions accept argument of type unsigned while it is
actually of type DeclSpec::TST. No functional changes.

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

llvm-svn: 367545

4 years ago[ARM] Fix for MVE VREV64
David Green [Thu, 1 Aug 2019 11:22:03 +0000 (11:22 +0000)]
[ARM] Fix for MVE VREV64

The VREV64 instruction is apparently unpredictable if Qd == Qm, due to the
cross-beat nature of the instruction. This adds an earlyclobber to Qd, which
seems to be the same way we deal with this on other instructions like the
write-back on loads and stores.

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

llvm-svn: 367544

4 years ago[ARM] Regenerate BSWAP16 tests
Simon Pilgrim [Thu, 1 Aug 2019 11:12:10 +0000 (11:12 +0000)]
[ARM] Regenerate BSWAP16 tests

llvm-svn: 367543

4 years ago[lldb][NFC] Make ClangDiagnostic::m_fixit_vec private
Raphael Isemann [Thu, 1 Aug 2019 11:05:47 +0000 (11:05 +0000)]
[lldb][NFC] Make ClangDiagnostic::m_fixit_vec private

llvm-svn: 367542

4 years ago[clangd] Add missing braces to completion tests. NFC
Ilya Biryukov [Thu, 1 Aug 2019 11:05:06 +0000 (11:05 +0000)]
[clangd] Add missing braces to completion tests. NFC

llvm-svn: 367541

4 years ago[AArch64] Do not allocate unnecessary emergency slot.
Sander de Smalen [Thu, 1 Aug 2019 10:53:45 +0000 (10:53 +0000)]
[AArch64] Do not allocate unnecessary emergency slot.

Fix an issue where the compiler still allocates an emergency spill slot even
though it already decided to spill an extra callee-save register to use
as a scratch register.

Reviewers: gberry, thegameg, mstorsjo, t.p.northover

Reviewed By: thegameg

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

llvm-svn: 367540

4 years ago[lldb][docs] Update landing page for monorepo
Stefan Granitz [Thu, 1 Aug 2019 10:33:54 +0000 (10:33 +0000)]
[lldb][docs] Update landing page for monorepo

Summary: Following up from D65330, here's an update for the landing page.

Reviewers: jryans, clayborg, amccarth, labath

Reviewed By: jryans, amccarth, labath

Subscribers: arphaman, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 367539

4 years ago[lldb][CMake] Avoid 'Autogenerate scheme' dialogs in Xcode projects
Stefan Granitz [Thu, 1 Aug 2019 10:33:44 +0000 (10:33 +0000)]
[lldb][CMake] Avoid 'Autogenerate scheme' dialogs in Xcode projects

Summary:
Supported in CMake 3.9 and higher: https://cmake.org/cmake/help/v3.9/variable/CMAKE_XCODE_GENERATE_SCHEME.html
Older versions will just report it as unused in the end of the configuration process.

Reviewers: jingham, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 367538

4 years ago[ELF] Add -z separate-code and pad the last page of last PF_X PT_LOAD with traps...
Fangrui Song [Thu, 1 Aug 2019 09:58:25 +0000 (09:58 +0000)]
[ELF] Add -z separate-code and pad the last page of last PF_X PT_LOAD with traps only if -z separate-code is specified

This patch

1) adds -z separate-code and -z noseparate-code (default).
2) changes the condition that the last page of last PF_X PT_LOAD is
 padded with trap instructions.
 Current condition (after D33630): if there is no `SECTIONS` commands.
 After this change: if -z separate-code is specified.

-z separate-code was introduced to ld.bfd in 2018, to place the text
segment in its own pages. There is no overlap in pages between an
executable segment and a non-executable segment:

1) RX cannot load initial contents from R or RW(or non-SHF_ALLOC).
2) R and RW(or non-SHF_ALLOC) cannot load initial contents from RX.

lld's current status:

- Between R and RX: in `Writer<ELFT>::fixSectionAlignments()`, the start of a
  segment is always aligned to maxPageSize, so the initial contents loaded by R
  and RX do not overlap. I plan to allow overlaps in D64906 if -z noseparate-code
  is in effect.
- Between RX and RW(or non-SHF_ALLOC if RW doesn't exist):
  we currently unconditionally pad the last page to commonPageSize
  (defaults to 4096 on all targets we support).
  This patch will make it effective only if -z separate-code is specified.

-z separate-code is a dubious feature that intends to reduce the number
of ROP gadgets (which is actually ineffective because attackers can find
plenty of gadgets in the text segment, no need to find gadgets in
non-code regions).

With the overlapping PT_LOAD technique D64906, -z noseparate-code
removes two more alignments at segment boundaries than -z separate-code.
This saves at most defaultCommonPageSize*2 bytes, which are significant
on targets with large defaultCommonPageSize (AArch64/MIPS/PPC: 65536).

Issues/feedback on alignment at segment boundaries to help understand
the implication:

* binutils PR24490 (the situation on ld.bfd is worse because they have
  two R-- on both sides of R-E so more alignments.)

* In binutils, the 2018-02-27 commit "ld: Add --enable-separate-code" made -z separate-code the default on Linux.
  https://github.com/richfelker/musl-cross-make/commit/d969dea983a2cc54a1e0308a0cdeb6c3307e4bfa
  In musl-cross-make, binutils is configured with --disable-separate-code
  to address size regressions caused by -z separate-code. (lld actually has the same
  issue, which I plan to fix in a future patch. The ld.bfd x86 status is
  worse because they default to max-page-size=0x200000).

* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237676 people want
  smaller code size. This patch will remove one alignment boundary.

* Stef O'Rear: I'm opposed to any kind of page alignment at the
  text/rodata line (having a partial page of text aliased as rodata and
  vice versa has no demonstrable harm, and I actually care about small
  systems).

So, make -z noseparate-code the default.

Reviewed By: ruiu

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

llvm-svn: 367537

4 years ago[ELF] With --vs-diagnostics, print a separate message for each location of a duplicat...
Igor Kudrin [Thu, 1 Aug 2019 09:58:03 +0000 (09:58 +0000)]
[ELF] With --vs-diagnostics, print a separate message for each location of a duplicate symbol.

We extract and print the source location in the message header so that
Visual Studio is able to parse it and jump there. As duplicate symbols
are defined in several locations, it is more convenient to have separate
error messages, which allows a user to easily access all the locations.

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

llvm-svn: 367536

4 years ago[MIPS GlobalISel] Fold load/store + G_GEP + G_CONSTANT
Petar Avramovic [Thu, 1 Aug 2019 09:40:13 +0000 (09:40 +0000)]
[MIPS GlobalISel] Fold load/store + G_GEP + G_CONSTANT

Fold load/store + G_GEP + G_CONSTANT when
immediate in G_CONSTANT fits into 16 bit signed integer.

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

llvm-svn: 367535

4 years ago[ELF][X86] Improve tests
Fangrui Song [Thu, 1 Aug 2019 09:25:34 +0000 (09:25 +0000)]
[ELF][X86] Improve tests

* Add --no-show-raw-insn to llvm-objdump -d tests
* When linking an executable with %t.so, the path %t.so will be recorded
  in the DT_NEEDED entry if %t.so doesn't have DT_SONAME. .dynstr will
  have varying lengths on different systems. Add -soname so that the
  string in .dynstr is of fixed length to make tests more robust.
* Rename i386-tls-initial-exec-local.s to i386-tls-ie-local.s
* Refactor tls-initial-exec-local.s to x86-64-tls-ie-local.s

llvm-svn: 367533

4 years ago[LLVM][Alignment] Fix AlignmentTest on platform where size_t != uint64_t
Guillaume Chatelet [Thu, 1 Aug 2019 09:20:00 +0000 (09:20 +0000)]
[LLVM][Alignment] Fix AlignmentTest on platform where size_t != uint64_t

Reviewers: yroux

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 367532

4 years ago[Preprocessor] Always discard body of #define if we failed to parse it
Ilya Biryukov [Thu, 1 Aug 2019 09:10:37 +0000 (09:10 +0000)]
[Preprocessor] Always discard body of #define if we failed to parse it

Summary:
Preivously we would only discard it if we failed to parse parameter lists.
If we do not consume the body, parser sees tokens inside directive. In
turn, this leads to spurious diagnostics and a crash in TokenBuffer, see
the added tests.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 367530

4 years ago[clangd] Fix buildbot failure from ambigous ArrayRef ctor
Johan Vikstrom [Thu, 1 Aug 2019 09:08:41 +0000 (09:08 +0000)]
[clangd] Fix buildbot failure from ambigous ArrayRef ctor

llvm-svn: 367529

4 years ago[NFC][ARM][ParallelDSP] Getters and renaming
Sam Parker [Thu, 1 Aug 2019 08:17:51 +0000 (08:17 +0000)]
[NFC][ARM][ParallelDSP] Getters and renaming

Add a couple of getters for Reduction and do some renaming of
variables around CreateSMLAD for clarity.

llvm-svn: 367522

4 years ago[clangd] Duplicate lines of semantic highlightings sent removed.
Johan Vikstrom [Thu, 1 Aug 2019 08:08:44 +0000 (08:08 +0000)]
[clangd] Duplicate lines of semantic highlightings sent removed.

Summary: Added a class for diffing highlightings and removing duplicate lines. Integrated into the highlighting generation flow. Only works correctly if all tokens are on a single line. Also returns empty lines if the IDE should remove previous highlightings on a line.

Reviewers: hokein, sammccall, ilya-biryukov

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

Tags: #clang

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

llvm-svn: 367521

4 years agoDelay emitting dllexport explicitly defaulted members until the class is fully parsed...
Hans Wennborg [Thu, 1 Aug 2019 08:01:09 +0000 (08:01 +0000)]
Delay emitting dllexport explicitly defaulted members until the class is fully parsed (PR40006)

This is similar to r245139, but that only addressed dllexported classes.
It was still possible to run into the same problem with dllexported
members in an otherwise normal class (see bug). This uses the same
strategy to fix: delay defining the method until the whole class has
been parsed.

(The easiest way to see the ordering problem is in
Parser::ParseCXXMemberSpecification(): it calls
ParseLexedMemberInitializers() *after* ActOnFinishCXXMemberDecls(),
which was trying to define the dllexport method. Now we delay it to
ActOnFinishCXXNonNestedClass() which is called after both of those.)

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

llvm-svn: 367520

4 years ago[Testing] Fix tests that break with read-only checkouts
David Zarzycki [Thu, 1 Aug 2019 06:41:40 +0000 (06:41 +0000)]
[Testing] Fix tests that break with read-only checkouts

Found with `mount --bind -o ro ...` on Linux.

llvm-svn: 367519

4 years ago[SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.
Craig Topper [Thu, 1 Aug 2019 06:06:21 +0000 (06:06 +0000)]
[SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.

Also use KnownBits::isNegative/isNonNegative to further simplify.

llvm-svn: 367518

4 years agoAMDGPU/SILoadStoreOptimizer: Make some functions const
Tom Stellard [Thu, 1 Aug 2019 05:39:17 +0000 (05:39 +0000)]
AMDGPU/SILoadStoreOptimizer: Make some functions const

Reviewers: arsenm, pendingchaos, rampitec

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367517

4 years agorecommit:[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using...
Zi Xuan Wu [Thu, 1 Aug 2019 05:26:02 +0000 (05:26 +0000)]
recommit:[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using big-endian load/store

In PowerPC, there is instruction to load vector in big endian element order when it's in little endian target.
So we can combine vector load + reverse into big endian load to eliminate the swap instruction.
Also combine vector reverse + store into big endian store.

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

llvm-svn: 367516

4 years ago[ELF] Fix finding locations in messages for undefined hidden symbols.
Igor Kudrin [Thu, 1 Aug 2019 05:23:45 +0000 (05:23 +0000)]
[ELF] Fix finding locations in messages for undefined hidden symbols.

Previously, when `--vs-diagnostics` was used, the linker printed
something like

  hidden(undef.s): error: undefined hidden symbol: foo
  >>> referenced by undef.s:15

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

llvm-svn: 367515

4 years agoAMDGPU/GlobalISel: fix inst-select-load-local.mir in -DLLVM_ENABLE_ASSERTIONS=off...
Fangrui Song [Thu, 1 Aug 2019 04:03:06 +0000 (04:03 +0000)]
AMDGPU/GlobalISel: fix inst-select-load-local.mir in -DLLVM_ENABLE_ASSERTIONS=off builds after r367498

llvm-svn: 367514

4 years agoAMDGPU/GlobalISel: Fix flat load/store of pointer types
Matt Arsenault [Thu, 1 Aug 2019 03:57:42 +0000 (03:57 +0000)]
AMDGPU/GlobalISel: Fix flat load/store of pointer types

llvm-svn: 367513

4 years agoAMDGPU/GlobalISel: Remove manual store select code
Matt Arsenault [Thu, 1 Aug 2019 03:52:40 +0000 (03:52 +0000)]
AMDGPU/GlobalISel: Remove manual store select code

This regresses the weird types that are newly treated as legal load
types, but fixes incorrectly using flat instrucions on SI.

llvm-svn: 367512

4 years agoAMDGPU/GlobalISel: Select local atomic cmpxchg
Matt Arsenault [Thu, 1 Aug 2019 03:41:41 +0000 (03:41 +0000)]
AMDGPU/GlobalISel: Select local atomic cmpxchg

llvm-svn: 367511

4 years agoRevert "[NFC] Remove obsolete LLVM_GNUC_PREREQ"
JF Bastien [Thu, 1 Aug 2019 03:40:59 +0000 (03:40 +0000)]
Revert "[NFC] Remove obsolete LLVM_GNUC_PREREQ"

The bots are sad, looks like GCC doesn't always have __has_builtin. I'll need to
modify the logic a bit.

llvm-svn: 367510

4 years agoAMDGPU/GlobalISel: Handle G_ATOMICRMW_FADD
Matt Arsenault [Thu, 1 Aug 2019 03:33:15 +0000 (03:33 +0000)]
AMDGPU/GlobalISel: Handle G_ATOMICRMW_FADD

llvm-svn: 367509

4 years ago[NFC] Remove obsolete LLVM_GNUC_PREREQ
JF Bastien [Thu, 1 Aug 2019 03:30:45 +0000 (03:30 +0000)]
[NFC] Remove obsolete LLVM_GNUC_PREREQ

The current minimum GCC version is 4.8 (soon to be 5.1), we there don't need to check for older versions. While I'm around Compiler.h, also update some of the doxygen comment.

llvm-svn: 367508

4 years agoAMDGPU/GlobalISel: Allow selection of DS atomicrmw
Matt Arsenault [Thu, 1 Aug 2019 03:29:01 +0000 (03:29 +0000)]
AMDGPU/GlobalISel: Allow selection of DS atomicrmw

llvm-svn: 367507

4 years agoAMDGPU: Start redefining atomic PatFrags
Matt Arsenault [Thu, 1 Aug 2019 03:25:52 +0000 (03:25 +0000)]
AMDGPU: Start redefining atomic PatFrags

Start migrating to a form that will be compatible with the global isel
emitter. Also should fix some overly lax checks on the memory type,
which allowed mis-selecting some illegal atomics.

llvm-svn: 367506

4 years agoAMDGPU: Correct FP atomic patterns
Matt Arsenault [Thu, 1 Aug 2019 03:22:40 +0000 (03:22 +0000)]
AMDGPU: Correct FP atomic patterns

These need to use an fadd, not an add. Also make the noret part clear
in the name.

llvm-svn: 367505

4 years agoAMDGPU/GlobalISel: Select simple local stores
Matt Arsenault [Thu, 1 Aug 2019 03:09:15 +0000 (03:09 +0000)]
AMDGPU/GlobalISel: Select simple local stores

llvm-svn: 367504

4 years agoGlobalISel: moreElementsVector for G_LOAD/G_STORE
Matt Arsenault [Thu, 1 Aug 2019 01:44:22 +0000 (01:44 +0000)]
GlobalISel: moreElementsVector for G_LOAD/G_STORE

AMDGPU change and test is a placeholder until a future patch with
complete handling.

llvm-svn: 367503

4 years ago[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision...
Ziang Wan [Thu, 1 Aug 2019 01:39:21 +0000 (01:39 +0000)]
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Fix one test case for it to be system-independent.

llvm-svn: 367502

4 years agoCreate unique, but identically-named ELF sections for explicitly-sectioned functions...
Peter Collingbourne [Thu, 1 Aug 2019 01:38:53 +0000 (01:38 +0000)]
Create unique, but identically-named ELF sections for explicitly-sectioned functions and globals when using -function-sections and -data-sections.

This allows functions and globals to to be reordered later in the linking phase
(using the -symbol-ordering-file) even though reordering will be limited to
the scope of the explicit section.

Patch by Rahman Lavaee!

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

llvm-svn: 367501

4 years agoReapply "AMDGPU: Split block for si_end_cf"
Matt Arsenault [Thu, 1 Aug 2019 01:25:27 +0000 (01:25 +0000)]
Reapply "AMDGPU: Split block for si_end_cf"

This reverts commit r359363, reapplying r357634

llvm-svn: 367500

4 years agoFix a release-only build warning triggered by rL367485
Philip Reames [Thu, 1 Aug 2019 01:16:08 +0000 (01:16 +0000)]
Fix a release-only build warning triggered by rL367485

llvm-svn: 367499

4 years agoAMDGPU/GlobalISel: Select local loads
Matt Arsenault [Thu, 1 Aug 2019 00:53:38 +0000 (00:53 +0000)]
AMDGPU/GlobalISel: Select local loads

llvm-svn: 367498

4 years ago[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision...
Ziang Wan [Thu, 1 Aug 2019 00:16:43 +0000 (00:16 +0000)]
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Issue an warning when the code tries to do an implicit int -> float
conversion, where the float type ha a narrower significant than the
float type.

The new warning is controlled by flag -Wimplicit-int-float-conversion,
under -Wimplicit-float-conversion and -Wconversion. It is also silenced
when c++11 narrowing warning is issued.

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

llvm-svn: 367497

4 years agoRevert "[MS] Emit S_HEAPALLOCSITE debug info in Selection DAG" and
Amy Huang [Wed, 31 Jul 2019 23:59:31 +0000 (23:59 +0000)]
Revert "[MS] Emit S_HEAPALLOCSITE debug info in Selection DAG" and
and partial fix.
Causes windows buildbot errors.

This reverts commit 6e65c34523963094acd0d6c94a5f5c64b32fe6aa and
53da7ca94343166ac68aef81db0398932fc258bb.

llvm-svn: 367496

4 years agoFix build when both gtest death tests and LLVM_NODISCARD are available.
Richard Smith [Wed, 31 Jul 2019 23:37:24 +0000 (23:37 +0000)]
Fix build when both gtest death tests and LLVM_NODISCARD are available.

llvm-svn: 367495

4 years ago[Reproducers] Force replay in synchronous mode.
Jonas Devlieghere [Wed, 31 Jul 2019 23:34:45 +0000 (23:34 +0000)]
[Reproducers] Force replay in synchronous mode.

Replaying a reproducer in asynchronous mode never makes sense. This
patch disables asynchronous mode during replay.

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

llvm-svn: 367494

4 years agocompiler-rt: Try to appease lint script.
Nico Weber [Wed, 31 Jul 2019 23:34:07 +0000 (23:34 +0000)]
compiler-rt: Try to appease lint script.

A bot complains:

/b/sanitizer-x86_64-linux-autoconf/build/llvm/projects/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp:2:  Streams are highly discouraged.  [readability/streams] [3]
/b/sanitizer-x86_64-linux-autoconf/build/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp:11:  Streams are highly discouraged.  [readability/streams] [3]
lib/CMakeFiles/SanitizerLintCheck.dir/build.make:57: recipe for target 'lib/CMakeFiles/SanitizerLintCheck' failed

I do not know why this apparently wasn't a problem when the files
had extension .cc.

llvm-svn: 367493

4 years ago[ARM] Lower "(x<<c) > 0x80000000U" to "lsls" on Thumb1.
Eli Friedman [Wed, 31 Jul 2019 23:19:21 +0000 (23:19 +0000)]
[ARM] Lower "(x<<c) > 0x80000000U" to "lsls" on Thumb1.

This is extremely specific, but saves three instructions when it's
legal.  I don't think the code can be usefully generalized.

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

llvm-svn: 367492

4 years ago[ARM] Transform compare of masked value to shift on Thumb1.
Eli Friedman [Wed, 31 Jul 2019 23:17:34 +0000 (23:17 +0000)]
[ARM] Transform compare of masked value to shift on Thumb1.

Thumb1 has very limited immediate modes, so turning an "and" into a
shift can save multiple instructions.

It's possible to simplify the generated code for test2 and test3 in
cmp-and-fold.ll a little more, but I'll implement that as a followup.

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

llvm-svn: 367491

4 years ago[ConstExprPreter] Overflow-detecting methods use GCC or clang builtins
JF Bastien [Wed, 31 Jul 2019 23:09:18 +0000 (23:09 +0000)]
[ConstExprPreter] Overflow-detecting methods use GCC or clang builtins

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

llvm-svn: 367490

4 years ago[ScalarizeMaskedMemIntrin] Bitcast the mask to the scalar domain and use scalar bit...
Craig Topper [Wed, 31 Jul 2019 22:58:15 +0000 (22:58 +0000)]
[ScalarizeMaskedMemIntrin] Bitcast the mask to the scalar domain and use scalar bit tests for the branches.

X86 at least is able to use movmsk or kmov to move the mask to the scalar
domain. Then we can just use test instructions to test individual bits.

This is more efficient than extracting each mask element
individually.

I special cased v1i1 to use the previous behavior. This avoids
poor type legalization of bitcast of v1i1 to i1.

I've skipped expandload/compressstore as I think we need to
handle constant masks for those better first.

Many tests end up with duplicate test instructions due to tail
duplication in the branch folding pass. But the same thing
happens when constructing similar code in C. So its not unique
to the scalarization.

Not sure if this lowering code will also be good for other targets,
but we're only testing X86 today.

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

llvm-svn: 367489

4 years ago[X86] Add DAG combine to fold any_extend_vector_inreg+truncstore to an extractelement...
Craig Topper [Wed, 31 Jul 2019 22:43:08 +0000 (22:43 +0000)]
[X86] Add DAG combine to fold any_extend_vector_inreg+truncstore to an extractelement+store

We have custom code that ignores the normal promoting type legalization on less than 128-bit vector types like v4i8 to emit pavgb, paddusb, psubusb since we don't have the equivalent instruction on a larger element type like v4i32. If this operation appears before a store, we can be left with an any_extend_vector_inreg followed by a truncstore after type legalization. When truncstore isn't legal, this will normally be decomposed into shuffles and a non-truncating store. This will then combine away the any_extend_vector_inreg and shuffle leaving just the store. On avx512, truncstore is legal so we don't decompose it and we had no combines to fix it.

This patch adds a new DAG combine to detect this case and emit either an extract_store for 64-bit stoers or a extractelement+store for 32 and 16 bit stores. This makes the avx512 codegen match the avx2 codegen for these situations. I'm restricting to only when -x86-experimental-vector-widening-legalization is false. When we're widening we're not likely to create this any_extend_inreg+truncstore combination. This means we should be able to remove this code when we flip the default. I would like to flip the default soon, but I need to investigate some performance regressions its causing in our branch that I wasn't seeing on trunk.

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

llvm-svn: 367488

4 years agoAttempt to unbreak sphinx build bot by inserting a link.
Philip Reames [Wed, 31 Jul 2019 22:14:26 +0000 (22:14 +0000)]
Attempt to unbreak sphinx build bot by inserting a link.

llvm-svn: 367487

4 years agoMigrate some more fadd and fsub cases away from UnsafeFPMath control to utilize NoSig...
Michael Berg [Wed, 31 Jul 2019 21:57:28 +0000 (21:57 +0000)]
Migrate some more fadd and fsub cases away from UnsafeFPMath control to utilize NoSignedZerosFPMath options control

Summary: Honoring no signed zeroes is also available as a user control through clang separately regardless of fastmath or UnsafeFPMath context, DAG guards should reflect this context.

Reviewers: spatel, arsenm, hfinkel, wristow, craig.topper

Reviewed By: spatel

Subscribers: rampitec, foad, nhaehnle, wuzish, nemanjai, jvesely, wdng, javed.absar, MaskRay, jsji

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

llvm-svn: 367486

4 years ago[IndVars, RLEV] Support rewriting exit values in loops without known exits (prep...
Philip Reames [Wed, 31 Jul 2019 21:15:21 +0000 (21:15 +0000)]
[IndVars, RLEV] Support rewriting exit values in loops without known exits (prep work)

This is a prepatory patch for future work on support exit value rewriting in loops with a mixture of computable and non-computable exit counts.  The intention is to be "mostly NFC" - i.e. not enable any interesting new transforms - but in practice, there are some small output changes.

The test differences are caused by cases wherewhere getSCEVAtScope can simplify a single entry phi without needing any knowledge of the loop.

llvm-svn: 367485

4 years ago[NFC] allow creating error strings from a Twine
JF Bastien [Wed, 31 Jul 2019 21:09:53 +0000 (21:09 +0000)]
[NFC] allow creating error strings from a Twine

It's useful when no format needs to happen, only the Twine needs to be put together.

llvm-svn: 367484

4 years agoFix to r367374 "[MS] Emit S_HEAPALLOCSITE debug info in Selection DAG"
Amy Huang [Wed, 31 Jul 2019 21:03:38 +0000 (21:03 +0000)]
Fix to r367374 "[MS] Emit S_HEAPALLOCSITE debug info in Selection DAG"
after windows buildbot failure.

Added a check that the MachineInstr exists and is a call before trying
to add symbols around it.

llvm-svn: 367483

4 years agoFix unused variable warning for non-assert builds.
Eric Christopher [Wed, 31 Jul 2019 21:02:03 +0000 (21:02 +0000)]
Fix unused variable warning for non-assert builds.

llvm-svn: 367482

4 years ago[GDBRemote] Reflow comments and improve docs.
Jonas Devlieghere [Wed, 31 Jul 2019 20:47:44 +0000 (20:47 +0000)]
[GDBRemote] Reflow comments and improve docs.

Improved the GDB client base documentation while I was reading through
it. Looks like it got messed up during the automatic comment reflow a
while ago.

llvm-svn: 367481

4 years ago[API] Remove use of ClangASTContext from SBTarget
Alex Langford [Wed, 31 Jul 2019 20:47:38 +0000 (20:47 +0000)]
[API] Remove use of ClangASTContext from SBTarget

Summary:
The methods to find types in a Target aren't clang specific and are
pretty generalizable to type systems. Additionally, to support some of
the use cases in SBTarget, I've added a "GetScratchTypeSystems" method
to Target to support getting all type systems for a target we are
debugging.

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

llvm-svn: 367480

4 years ago[clang][ARM] Fix msvc arm{64} builtins to use int on LP64 systems.
Michael J. Spencer [Wed, 31 Jul 2019 20:42:28 +0000 (20:42 +0000)]
[clang][ARM] Fix msvc arm{64} builtins to use int on LP64 systems.

The `InterlockedX_{acq,nf,rel}` functions deal with 32 bits which is long on
MSVC, but int on most other systems.

This also checks that `ReadStatusRegister` and `WriteStatusRegister` have
the correct type on aarch64-darwin.

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

llvm-svn: 367479

4 years ago[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.
Puyan Lotfi [Wed, 31 Jul 2019 20:40:08 +0000 (20:40 +0000)]
[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

Second landing attempt: Changed TY_ObjCXXHeader to TY_PP_ObjCXXHeader to fix
                        -xobjective-c++-header. This time I verified against
                        preprocessor output.

Dropping the 'u' entry and the entire Flags table from Types.def.
Now it'll be a bit easier to tablegenify this.

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

llvm-svn: 367478

4 years ago[GISel] Address review feedback on passing MD_callees to lowerCall.
Mark Lacey [Wed, 31 Jul 2019 20:34:05 +0000 (20:34 +0000)]
[GISel] Address review feedback on passing MD_callees to lowerCall.

Preserve the nullptr default for KnownCallees that appears in
the base class.

llvm-svn: 367477

4 years ago[GISel] Pass MD_callees metadata down in call lowering.
Mark Lacey [Wed, 31 Jul 2019 20:34:02 +0000 (20:34 +0000)]
[GISel] Pass MD_callees metadata down in call lowering.

Summary:
This will make it possible to improve IPRA by taking into account
register usage in indirect calls.

NFC yet; this is just laying the groundwork to start building
up patches to take advantage of the information for improved register
allocation.

Reviewers: aditya_nandakumar, volkan, qcolombet, arsenm, rovka, aemerson, paquette

Subscribers: sdardis, wdng, javed.absar, hiraditya, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

llvm-svn: 367476

4 years agoAArch64: Add a tagged-globals backend feature.
Peter Collingbourne [Wed, 31 Jul 2019 20:14:19 +0000 (20:14 +0000)]
AArch64: Add a tagged-globals backend feature.

This feature instructs the backend to allow locally defined global variable
addresses to contain a pointer tag in bits 56-63 that will be ignored by
the hardware (i.e. TBI), but may be used by an instrumentation pass such
as HWASAN. It works by adding a MOVK instruction to the regular ADRP/ADD
sequence that sets bits 48-63 to the corresponding bits of the global, with
the linker bounds check disabled on the ADRP instruction to prevent the tag
from causing a link failure.

This implementation of the feature omits the MOVK when loading from or storing
to a global, which is sufficient for TBI. If the same approach is extended
to MTE, assuming that 0 is not configured as a catch-all tag, we will most
likely also need the MOVK in this case in order to avoid a tag mismatch.

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

llvm-svn: 367475

4 years agoSelectionDAG, MI, AArch64: Widen target flags fields/arguments from unsigned char...
Peter Collingbourne [Wed, 31 Jul 2019 20:14:09 +0000 (20:14 +0000)]
SelectionDAG, MI, AArch64: Widen target flags fields/arguments from unsigned char to unsigned.

This makes the field wider than MachineOperand::SubReg_TargetFlags so that
we don't end up silently truncating any higher bits. We should still catch
any bits truncated from the MachineOperand field as a consequence of the
assertion in MachineOperand::setTargetFlags().

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

llvm-svn: 367474

4 years agoAttempt to heal bots after r367467
Nico Weber [Wed, 31 Jul 2019 20:12:19 +0000 (20:12 +0000)]
Attempt to heal bots after r367467

llvm-svn: 367473

4 years ago[DAGCombine] Limit the number of times for the same store and root nodes
Wei Mi [Wed, 31 Jul 2019 19:59:24 +0000 (19:59 +0000)]
[DAGCombine] Limit the number of times for the same store and root nodes
to bail out in store merging dependence check.

We run into a case where dependence check in store merging bail out many times
for the same store and root nodes in a huge basicblock. That increases compile
time by almost 100x. The patch add a map to track how many times the bailing
out happen for the same store and root, and if it is over a limit, stop
considering the store with the same root as a merging candidate.

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

llvm-svn: 367472

4 years agocompiler-rt: Rename .cc file in lib/sanitizer_common/symbolizer to .cpp
Nico Weber [Wed, 31 Jul 2019 19:41:02 +0000 (19:41 +0000)]
compiler-rt: Rename .cc file in lib/sanitizer_common/symbolizer to .cpp

llvm-svn: 367471

4 years ago[Support] Added overflow checking add, sub and mul.
JF Bastien [Wed, 31 Jul 2019 19:40:07 +0000 (19:40 +0000)]
[Support] Added overflow checking add, sub and mul.

Added AddOverflow, SubOverflow and MulOverflow to compute truncated results and return a flag indicating whether overflow occured.

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

llvm-svn: 367470

4 years agoAttempt to heal tsan bot after r367463
Nico Weber [Wed, 31 Jul 2019 19:31:36 +0000 (19:31 +0000)]
Attempt to heal tsan bot after r367463

llvm-svn: 367469

4 years ago[pstl] Fully qualify pstl names.
Eric Fiselier [Wed, 31 Jul 2019 19:14:16 +0000 (19:14 +0000)]
[pstl] Fully qualify pstl names.

Previously the code used "using namespace __pstl;" at block
scope to introduce these names. This could cause conflicts with
names defined by the standard library. So we should fully qualify
them instead.

llvm-svn: 367468

4 years agocompiler-rt: Rename .cc file in lib/sanitizer_common/tests to .cpp
Nico Weber [Wed, 31 Jul 2019 19:11:14 +0000 (19:11 +0000)]
compiler-rt: Rename .cc file in lib/sanitizer_common/tests to .cpp

See https://reviews.llvm.org/D58620 for discussion, and for the commands
I ran. In addition I also ran

  for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $(basename $f) . ; done

and manually updated references to renamed files found by that.

llvm-svn: 367467

4 years ago[X86] Add test cases to show premature decomposition of vector multiplies into shift...
Craig Topper [Wed, 31 Jul 2019 19:05:11 +0000 (19:05 +0000)]
[X86] Add test cases to show premature decomposition of vector multiplies into shift+add/sub for types that aren't legal and need to be split. NFC

llvm-svn: 367466

4 years ago[X86] Add AVX512DQ command lines to vector-mul.ll to show that we use vpmullq instead...
Craig Topper [Wed, 31 Jul 2019 19:05:03 +0000 (19:05 +0000)]
[X86] Add AVX512DQ command lines to vector-mul.ll to show that we use vpmullq instead of shift+add/sub for some cases. NFC

llvm-svn: 367465

4 years agogn build: Merge r367463
Nico Weber [Wed, 31 Jul 2019 18:56:49 +0000 (18:56 +0000)]
gn build: Merge r367463

llvm-svn: 367464

4 years agocompiler-rt: Rename .cc file in lib/sanitizer_common to .cpp
Nico Weber [Wed, 31 Jul 2019 18:51:27 +0000 (18:51 +0000)]
compiler-rt: Rename .cc file in lib/sanitizer_common to .cpp

See https://reviews.llvm.org/D58620 for discussion, and for the commands
I ran. In addition I also ran

  for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done

and manually updated (many) references to renamed files found by that.

llvm-svn: 367463

4 years agoAttempt to heal bots after r367456
Nico Weber [Wed, 31 Jul 2019 18:43:27 +0000 (18:43 +0000)]
Attempt to heal bots after r367456

llvm-svn: 367462

4 years ago[SCCP] Update condition to avoid overflow.
Alina Sbirlea [Wed, 31 Jul 2019 18:22:22 +0000 (18:22 +0000)]
[SCCP] Update condition to avoid overflow.

Summary:
Update condition to remove addition that may cause an overflow.
Resolves PR42814.

Reviewers: sanjoy, RKSimon

Subscribers: jlebar, llvm-commits

Tags: #llvm

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

llvm-svn: 367461

4 years agocompiler-rt: Rename .cc file in lib/profile to .cpp
Nico Weber [Wed, 31 Jul 2019 18:21:08 +0000 (18:21 +0000)]
compiler-rt: Rename .cc file in lib/profile to .cpp

See https://reviews.llvm.org/D58620 for discussion.

Note how the comment in the file already said ".cpp" :)

llvm-svn: 367460

4 years ago[CommandCompletions] Remove commented out code.
Jonas Devlieghere [Wed, 31 Jul 2019 18:09:26 +0000 (18:09 +0000)]
[CommandCompletions] Remove commented out code.

We use version control here.

llvm-svn: 367459

4 years ago[docs] Add references to unreferenced footnotes.
Lang Hames [Wed, 31 Jul 2019 18:07:37 +0000 (18:07 +0000)]
[docs] Add references to unreferenced footnotes.

Thanks to Stefan Granitz for catching the issue.

llvm-svn: 367458

4 years agogn build: Merge r367456
Nico Weber [Wed, 31 Jul 2019 18:04:03 +0000 (18:04 +0000)]
gn build: Merge r367456

llvm-svn: 367457

4 years agocompiler-rt: Rename .cc files in lib/interception to .cpp.
Nico Weber [Wed, 31 Jul 2019 18:01:55 +0000 (18:01 +0000)]
compiler-rt: Rename .cc files in lib/interception to .cpp.

See https://reviews.llvm.org/D58620 for discussion, and for the commands
I ran. In addition I also ran

  for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done

and manually updated references to renamed files found by that.

llvm-svn: 367456

4 years agoFix completion for functions in anonymous namespaces
Jonas Devlieghere [Wed, 31 Jul 2019 17:58:00 +0000 (17:58 +0000)]
Fix completion for functions in anonymous namespaces

I was going through some of the old bugs and came across PR21069 which I
was able to reproduce. The issue is that we match the regex `^foo`
against the `DW_AT_name` in the DWARF, which for our anonymous function
is indeed `foo`. However, when we get the function name from the symbol
context, the result is `(anonymous namespace)::foo()`. This throws off
completions, which assumes that it's appending to whatever is already
present on the input, resulting in a bogus
`b fooonymous\ namespace)::foo()`.

Bug report: https://llvm.org/PR21069

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

llvm-svn: 367455

4 years agogn build: Merge r367452 and add standalone sources
Nico Weber [Wed, 31 Jul 2019 17:56:45 +0000 (17:56 +0000)]
gn build: Merge r367452 and add standalone sources

llvm-svn: 367454

4 years ago[clangd] Ignore semicolons, whitespace, and comments in SelectionTree.
Sam McCall [Wed, 31 Jul 2019 17:52:40 +0000 (17:52 +0000)]
[clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

Summary:
Whitespace and comments are a clear bugfix: selecting some
comments/space near a statement doesn't mean you're selecting the
surrounding block.

Semicolons are less obvious, but for similar reasons: these tokens
aren't actually claimed by any AST node (usually), so an AST-based model
like SelectionTree shouldn't take them into account.

Callers may still sometimes care about semis of course:
 - when the selection is an expr with a non-expr parent, selection of
   the semicolon indicates intent to select the statement.
 - when a statement with a trailing semi is selected, we need to know
   its range to ensure it can be removed.
SelectionTree may or may not play a role here, but these are separate questions
from its core function of describing which AST nodes were selected.

The mechanism here is the TokenBuffer from syntax-trees. We use it in a
fairly low-level way (just to get boundaries of raw spelled tokens). The
actual mapping of AST nodes to coordinates continues to use the (fairly
mature) SourceLocation based logic. TokenBuffer/Syntax trees
don't currently offer an alternative to getFileRange(), I think.

Reviewers: SureYeaah, kadircet

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

Tags: #clang

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

llvm-svn: 367453

4 years agocompiler-rt: Rename .cc files in lib/ubsan to .cpp.
Nico Weber [Wed, 31 Jul 2019 17:51:05 +0000 (17:51 +0000)]
compiler-rt: Rename .cc files in lib/ubsan to .cpp.

See https://reviews.llvm.org/D58620 for discussion, and for the commands
I ran. In addition I also ran

  for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done

and manually updated references to renamed files found by that.

llvm-svn: 367452

4 years ago[MemorySSA] Add additional verification for phis.
Alina Sbirlea [Wed, 31 Jul 2019 17:41:04 +0000 (17:41 +0000)]
[MemorySSA] Add additional verification for phis.

Summary:
Verify that the incoming defs into phis are the last defs from the
respective incoming blocks.
When moving blocks, insertDef must RenameUses. Adding this verification
makes GVNHoist tests fail that uncovered this issue.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

llvm-svn: 367451

4 years agogn build: Add build files for compiler-rt/lib/profile
Nico Weber [Wed, 31 Jul 2019 17:15:32 +0000 (17:15 +0000)]
gn build: Add build files for compiler-rt/lib/profile

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

llvm-svn: 367450

4 years agogn build: Make builtin library build on macOS
Nico Weber [Wed, 31 Jul 2019 17:12:33 +0000 (17:12 +0000)]
gn build: Make builtin library build on macOS

For now, it only builds the x86_64 slice.

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

llvm-svn: 367449

4 years agogn build: Fix redundant object files in builtin lib.
Nico Weber [Wed, 31 Jul 2019 17:08:34 +0000 (17:08 +0000)]
gn build: Fix redundant object files in builtin lib.

compiler-rt's builtin library has generic implementations of many
functions, and then per-arch optimized implementations of some.

In the CMake build, both filter_builtin_sources() and an explicit loop
at the end of the build file (see D37166) filter out the generic
versions if a per-arch file is present.

The GN build wasn't doing this filtering. Just do the filtering manually
and explicitly, instead of being clever.

While here, also remove files from the mingw/arm build that are
redundantly listed after D39938 / r318139 (both from the CMake and the
GN build).

While here, also fix a target_os -> target_cpu typo.

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

llvm-svn: 367448