platform/upstream/llvm.git
6 years ago[X86][AVX512F_512]: Adding full coverage of MC encoding for the AVX512F 512 bits...
Gadi Haber [Mon, 15 Jan 2018 09:39:08 +0000 (09:39 +0000)]
[X86][AVX512F_512]: Adding full coverage of MC encoding for the AVX512F 512 bits isa sets.<NFC>

NFC.
 Adding MC regressions tests to cover the AVX512F_512 isa sets both 32 and 64 bit.
 This patch is part of a larger task to cover MC encoding of all X86 ISA Sets.
 started in revision: https://reviews.llvm.org/D39952

Reviewers: zvi, craig.topper, RKSimon, AndreiGrischenko
Differential Revision: https://reviews.llvm.org/D41172

Change-Id: I46aa33dd967d63d33f67d1988ad42d8df2081e39
llvm-svn: 322471

6 years ago[GlobalsAA] Don't let dbg intrinsics affect analysis result
Mikael Holmen [Mon, 15 Jan 2018 07:05:51 +0000 (07:05 +0000)]
[GlobalsAA] Don't let dbg intrinsics affect analysis result

Summary:
This fixes PR35899.

Debug info intrinsics shouldn't affect code generation so ignore them
in GlobalsAA.

Reviewers: hfinkel, aprantl

Reviewed By: aprantl

Subscribers: aprantl, llvm-commits

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

llvm-svn: 322470

6 years agoClang counterpart change for fuzzer FreeBSD support
Kamil Rytarowski [Mon, 15 Jan 2018 05:56:44 +0000 (05:56 +0000)]
Clang counterpart change for fuzzer FreeBSD support

Summary: Providing fuzzer sanitizer support for FreeBSD (but only for X86/64 architectures).

Reviewers: kimgr, EricWF, martell

Reviewed By: martell

Patch by David CARLIER.

Subscribers: krytarowski, kimgr, emaste, cfe-commits

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

llvm-svn: 322469

6 years ago[NFC] Fix comment to adjust to reality
Max Kazantsev [Mon, 15 Jan 2018 05:44:43 +0000 (05:44 +0000)]
[NFC] Fix comment to adjust to reality

llvm-svn: 322468

6 years ago[BasicAA] Stop crashing when dealing with pointers > 64 bits.
Davide Italiano [Mon, 15 Jan 2018 01:40:18 +0000 (01:40 +0000)]
[BasicAA] Stop crashing when dealing with pointers > 64 bits.

An alternative (and probably better) fix would be that of
making `Scale` an APInt, and there's a patch floating around
to do this. As we're still discussing it, at least stop crashing
in the meanwhile (added bonus, we now have a regression test for
this situation).

Fixes PR35843.

Thanks to Eli for suggesting the fix and Simon for reporting and
reducing the bug.

llvm-svn: 322467

6 years ago[GlobalISel][Legalizer] Convert some typedefs to using. NFC.
Amara Emerson [Mon, 15 Jan 2018 00:44:20 +0000 (00:44 +0000)]
[GlobalISel][Legalizer] Convert some typedefs to using. NFC.

llvm-svn: 322466

6 years ago[X86][SSE] Tag PR21137 test case
Simon Pilgrim [Sun, 14 Jan 2018 21:59:43 +0000 (21:59 +0000)]
[X86][SSE] Tag PR21137 test case

The test was added ages ago, but we didn't comment where it came from.

llvm-svn: 322465

6 years ago[X86] Add test cases for D41794.
Craig Topper [Sun, 14 Jan 2018 20:53:49 +0000 (20:53 +0000)]
[X86] Add test cases for D41794.

llvm-svn: 322464

6 years ago[X86][SSE] Add PR22391 test case
Simon Pilgrim [Sun, 14 Jan 2018 19:57:50 +0000 (19:57 +0000)]
[X86][SSE] Add PR22391 test case

llvm-svn: 322463

6 years ago[X86] Autoupgrade kunpck intrinsics using vector operations instead of scalar operations
Craig Topper [Sun, 14 Jan 2018 19:24:10 +0000 (19:24 +0000)]
[X86] Autoupgrade kunpck intrinsics using vector operations instead of scalar operations

Summary: This patch changes the kunpck intrinsic autoupgrade to use vXi1 shufflevector operations to perform vector extracts and concats. This more closely matches the definition of the kunpck instructions. Currently we rely on a DAG combine to turn the scalar shift/and/or code into a concat vectors operation. By doing it in the IR we get this for free.

Reviewers: spatel, RKSimon, zvi, jina.nahias

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 322462

6 years ago[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer...
Craig Topper [Sun, 14 Jan 2018 19:23:50 +0000 (19:23 +0000)]
[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer shift/and/or

Summary:
kunpck intrinsics were removed in favor of native IR a few months ago. The implementation lowers them as by operation on the integer types passed to the intrinsic and then just shifting, masking, and oring them together. A special X86 DAG combine was added to recognize this patter and turn it into a concat_vector operation.

I think it makes more sense to keep the IR implementation closer to vector operations on vXi1. Given that we expect these builtins to be used around other builtins that operate on k-registers which we try to represent in IR with vXi1. InstCombine should be able to get rid of the bitcasts between integers and vXi1 leaving only the vector operations.

Reviewers: RKSimon, spatel, zvi, jina.nahias

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 322461

6 years ago[X86] Regenerate fp128 test
Simon Pilgrim [Sun, 14 Jan 2018 19:07:41 +0000 (19:07 +0000)]
[X86] Regenerate fp128 test

llvm-svn: 322460

6 years ago[X86][SSE] Support combining MOVLHPS undef inputs
Simon Pilgrim [Sun, 14 Jan 2018 18:50:34 +0000 (18:50 +0000)]
[X86][SSE] Support combining MOVLHPS undef inputs

llvm-svn: 322459

6 years ago[X86][SSE] Add v2f64 3u shuffle test
Simon Pilgrim [Sun, 14 Jan 2018 18:38:21 +0000 (18:38 +0000)]
[X86][SSE] Add v2f64 3u shuffle test

Shows a missed opportunity to remove a unnecessary move compared to 31 shuffle mask.

llvm-svn: 322458

6 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Sun, 14 Jan 2018 17:47:40 +0000 (17:47 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 322457

6 years ago[InstSimplify] fix code comments; NFC
Sanjay Patel [Sun, 14 Jan 2018 15:58:18 +0000 (15:58 +0000)]
[InstSimplify] fix code comments; NFC

llvm-svn: 322456

6 years ago[X86] Use ISD::TRUNCATE instead of X86ISD::VTRUNC when input and output types have...
Craig Topper [Sun, 14 Jan 2018 08:11:36 +0000 (08:11 +0000)]
[X86] Use ISD::TRUNCATE instead of X86ISD::VTRUNC when input and output types have the same number of elements.

llvm-svn: 322455

6 years ago[X86] Add X86ISD::VTRUNC to computeKnownBitsForTargetNode.
Craig Topper [Sun, 14 Jan 2018 08:11:33 +0000 (08:11 +0000)]
[X86] Add X86ISD::VTRUNC to computeKnownBitsForTargetNode.

We have to take special care to avoid the cases where the result of the truncate would be padded with zero elements.

Ideally we'd just use ISD::TRUNCATE for these cases instead.

llvm-svn: 322454

6 years agoRemove dead code.
Rui Ueyama [Sun, 14 Jan 2018 04:44:21 +0000 (04:44 +0000)]
Remove dead code.

parseInt assumed that it could take a negative number literal (e.g.
"-123"). However, such number is in reality already handled as a
unary operator '-' followed by a number literal, so the number
literal is always non-negative. Thus, this code is dead.

llvm-svn: 322453

6 years agoReland "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Sun, 14 Jan 2018 03:43:17 +0000 (03:43 +0000)]
Reland "[Driver] Update default sanitizer blacklist location"

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

llvm-svn: 322452

6 years agoReland "Install resource files into a share/ directory"
Petr Hosek [Sun, 14 Jan 2018 03:43:14 +0000 (03:43 +0000)]
Reland "Install resource files into a share/ directory"

Currently these files are being installed into a root installation
directory, but this triggers an error when the installation directory
is set to an empty string which is often the case when DESTDIR is
used to control the installation destination.

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

llvm-svn: 322451

6 years ago[X86] Improve legalization of vXi16/vXi8 selects.
Craig Topper [Sun, 14 Jan 2018 02:05:51 +0000 (02:05 +0000)]
[X86] Improve legalization of vXi16/vXi8 selects.

Extend vXi1 conditions of vXi8/vXi16 selects even before type legalization gets a chance to split wide vectors. Previously we would only extend 128 and 256 bit vectors. But if we start with a 512 bit vector or wider that needs to be split we wouldn't extend until after the split had taken place. By extending early we improve the results of type legalization.

Don't widen condition of 128/256 bit vXi16/vXi8 selects when we have BWI but not VLX. We can still use a mask register by widening the select to 512-bits instead. This is similar to what we do for compares already.

llvm-svn: 322450

6 years ago[X86] Add an avx512bw command line to the avx512-vec-cmp.ll test. Add some additional...
Craig Topper [Sun, 14 Jan 2018 02:05:49 +0000 (02:05 +0000)]
[X86] Add an avx512bw command line to the avx512-vec-cmp.ll test. Add some additional test cases.

Additional test cases cover selects with i16/i8 conditions that are only 128/256-bits wide, but the compares are 512-bits wide and can only produce k-registers. We should be able to artificially widen the selects to avoid moving the k-register to an xmm/ymm register.

llvm-svn: 322449

6 years ago[clang-format] [NFC] Remove comment
Mark Zeren [Sat, 13 Jan 2018 22:52:34 +0000 (22:52 +0000)]
[clang-format] [NFC] Remove comment

Remove inaccurate comment that came in with  r312125.

llvm-svn: 322448

6 years ago[docs] Use monospace for PCH option flags
Brian Gesiak [Sat, 13 Jan 2018 18:34:07 +0000 (18:34 +0000)]
[docs] Use monospace for PCH option flags

Summary:
Use monospace for option flags in the PCH section, instead of the
italics that were being used previously.

I believe these used to be links, for which single backticks would
have been appropriate, but since they were un-link-ified in
https://reviews.llvm.org/rL275560, I believe monospace is now more
appropriate, and so two backticks are needed.

Test Plan:
Build the `docs-clang-html` target and confirm the options are rendered
using monospace font.

Reviewers: sepavloff, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 322447

6 years agoX86: Add pattern matching for PMADDWD
Zvi Rackover [Sat, 13 Jan 2018 17:42:19 +0000 (17:42 +0000)]
X86: Add pattern matching for PMADDWD

In addition to the existing match as part of a loop-reduction, add a
straightforward pattern match for DAG-contained patterns.

Reviewers: RKSimon, craig.topper

Subscribers: llvm-commits

Reviewed By: RKSimon

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

llvm-svn: 322446

6 years ago[Driver] Add "did you mean?" suggestions to -cc1as
Brian Gesiak [Sat, 13 Jan 2018 17:09:11 +0000 (17:09 +0000)]
[Driver] Add "did you mean?" suggestions to -cc1as

Summary:
In https://reviews.llvm.org/D41733, the driver was modified such that,
when a user provided a mispelled option such as `-hel`, it would
suggest a valid option with a nearby edit distance: "did you mean
'-help'?".

Add these suggestions to invocations of `clang -cc1as` as well.

Test Plan: `check-clang`

Reviewers: v.g.vassilev, bruno

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 322445

6 years ago[X86] Regenerate double shift tests
Simon Pilgrim [Sat, 13 Jan 2018 16:55:28 +0000 (16:55 +0000)]
[X86] Regenerate double shift tests

llvm-svn: 322444

6 years ago[clangd] Fix uninitialized-read found by asan
Sam McCall [Sat, 13 Jan 2018 16:46:26 +0000 (16:46 +0000)]
[clangd] Fix uninitialized-read found by asan

llvm-svn: 322443

6 years ago[WebAssembly] Fix build failures due to warning
Sam Clegg [Sat, 13 Jan 2018 15:59:53 +0000 (15:59 +0000)]
[WebAssembly] Fix build failures due to warning

Oops, the waterfall tests with `-Werror -Wunused-variable`.

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

llvm-svn: 322442

6 years agoRevert "[WebAssembly] Move checking of InputSegment comdat group earlier"
Sam Clegg [Sat, 13 Jan 2018 15:57:48 +0000 (15:57 +0000)]
Revert "[WebAssembly] Move checking of InputSegment comdat group earlier"

This reverts commit 7421eab7ccf2e14518f4526a084a5afc76ac9c6a.

llvm-svn: 322441

6 years ago[WebAssembly] Move checking of InputSegment comdat group earlier
Sam Clegg [Sat, 13 Jan 2018 15:44:54 +0000 (15:44 +0000)]
[WebAssembly] Move checking of InputSegment comdat group earlier

This should also fixe an unused varaible warning in the realeae
build.

llvm-svn: 322440

6 years ago[InstSimplify] fold implied null ptr check (PR35790)
Sanjay Patel [Sat, 13 Jan 2018 15:44:44 +0000 (15:44 +0000)]
[InstSimplify] fold implied null ptr check (PR35790)

This extends rL322327 to handle the pointer cast and should solve:
https://bugs.llvm.org/show_bug.cgi?id=35790

Name: or_eq_zero
  %isnull = icmp eq i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_zero = icmp eq i64 %somebits, 0
  %or = or i1 %somebits_are_zero, %isnull
  =>
  %or = %somebits_are_zero

Name: and_ne_zero
  %isnotnull = icmp ne i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_not_zero = icmp ne i64 %somebits, 0
  %and = and i1 %somebits_are_not_zero, %isnotnull
  =>
  %and = %somebits_are_not_zero

https://rise4fun.com/Alive/CQ3

llvm-svn: 322439

6 years ago[Sema] Fix crash for type-dependent base classes
Jan Korous [Sat, 13 Jan 2018 15:24:16 +0000 (15:24 +0000)]
[Sema] Fix crash for type-dependent base classes

llvm-svn: 322438

6 years ago[Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCE
Francis Ricci [Sat, 13 Jan 2018 14:43:49 +0000 (14:43 +0000)]
[Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCE

Summary:
Some time ago, the sanitizers as of r315899 were imported into gcc mainline.  This broke
bootstrap on Darwin 10 and 11, as reported in GCC PR sanitizer/82824
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82824) due to the unconditional use
of VM_MEMORY_OS_ALLOC_ONCE.  This was only introduced in Darwin 13/Mac OS X 10.9.

The use of the macro was introduced in r300450.

I couldn't find any statement which Darwin versions are supposed to be supported by
LLVM, but the trivial patch to use the macro only if present allowed the gcc bootstrap
to finish.

So far, I haven't tried building llvm/compiler-rt  on Darwin 11.  Maybe the patch is
simple enough to go in nonetheless.

Committing on behalf of ro.

Reviewers: glider, fjricci, kcc, kuba, kubamracek, george.karpenkov

Reviewed By: fjricci

Subscribers: #sanitizers, zaks.anna, srhines, dberris, kubamracek, llvm-commits

Tags: #sanitizers

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

llvm-svn: 322437

6 years ago[X86][MMX] Add test for MMX zero folding
Simon Pilgrim [Sat, 13 Jan 2018 12:29:06 +0000 (12:29 +0000)]
[X86][MMX] Add test for MMX zero folding

As discussed in D41908

llvm-svn: 322436

6 years agoFix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER
Alex Bradbury [Sat, 13 Jan 2018 09:21:11 +0000 (09:21 +0000)]
Fix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER

Petr Hosek reported an external buildbot was failing on riscv32-toolchain.c,
seemingly as it set CLANG_DEFAULT_LINKER to lld. Address this by explicitly
setting -fuse-ld=ld in the tests.

llvm-svn: 322435

6 years agoX86 Tests: add more pamddwd cases. NFC
Zvi Rackover [Sat, 13 Jan 2018 08:21:29 +0000 (08:21 +0000)]
X86 Tests: add more pamddwd cases. NFC

Improve coverage of D41811

llvm-svn: 322434

6 years ago[lldb] Add support to cache a PDB's global scope and fix a bug in getting the source...
Aaron Smith [Sat, 13 Jan 2018 06:58:18 +0000 (06:58 +0000)]
[lldb] Add support to cache a PDB's global scope and fix a bug in getting the source file name for a compiland

Summary:
This commit is a combination of the following changes:

- Cache PDB's global scope (executable) in SymbolFilePDB

- Change naming of `cu` to `compiland` which is PDB specific

- Change ParseCompileUnitForSymIndex to ParseCompileUnitForUID.
   Prefer using a common name `UID` instead of PDB's `System Index`
   Adding one more argument `index` to this method, which is used to
   specify the index of the compile unit in a cached compile unit array

- Add GetPDBCompilandByUID method to simply code

- Fix a bug in getting the source file name for a PDB compiland.
   For some reason, PDBSymbolCompiland::getSourceFileName() could
   return an empty name, so if that is true, we have to walk through all
   source files of this compiland and determine the right source file
   used to generate this compiland based on language indicated.

   The previous implementation called PDBSession::findOneSourceFile
   method to get its name for the compiland. This is not accurate since
   the `one source file` found could be a header other than source file.

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 322433

6 years ago[X86] Add DAG combine to promote vXi1 result of a vXi8/vXi16 setcc when we have AVX51...
Craig Topper [Sat, 13 Jan 2018 06:24:46 +0000 (06:24 +0000)]
[X86] Add DAG combine to promote vXi1 result of a vXi8/vXi16 setcc when we have AVX512 but not BWI.

This avoids having the result type stick around until lowering where we have to extend the setcc and insert a truncate. If we get the types converted early we can do more to optimize it.

llvm-svn: 322432

6 years agoDR126: partially implement the const-correct rules for exception handler matching.
Richard Smith [Sat, 13 Jan 2018 05:05:45 +0000 (05:05 +0000)]
DR126: partially implement the const-correct rules for exception handler matching.

While here, fix up the myriad other ways in which Sema's two "can this handler
catch that exception?" implementations get things wrong and unify them.

llvm-svn: 322431

6 years agoXFAIL a test on Darwin, line-table stuck on DWARF 2
Paul Robinson [Sat, 13 Jan 2018 01:39:30 +0000 (01:39 +0000)]
XFAIL a test on Darwin, line-table stuck on DWARF 2

llvm-svn: 322430

6 years ago[hwasan] An LLVM flag to disable stack tag randomization.
Evgeniy Stepanov [Sat, 13 Jan 2018 01:32:15 +0000 (01:32 +0000)]
[hwasan] An LLVM flag to disable stack tag randomization.

Summary: Necessary to achieve consistent test results.

Reviewers: kcc, alekseyshl

Subscribers: kubamracek, llvm-commits, hiraditya

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

llvm-svn: 322429

6 years agoRevert "[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized"
Petr Hosek [Sat, 13 Jan 2018 00:56:28 +0000 (00:56 +0000)]
Revert "[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized"

This reverts commit r322424: this broke the tsan lint check.

llvm-svn: 322428

6 years agoRemove unused addIfPresent function.
Eric Christopher [Sat, 13 Jan 2018 00:46:47 +0000 (00:46 +0000)]
Remove unused addIfPresent function.

llvm-svn: 322427

6 years agoRemove extraneous semicolon.
Eric Christopher [Sat, 13 Jan 2018 00:44:45 +0000 (00:44 +0000)]
Remove extraneous semicolon.

llvm-svn: 322426

6 years ago[MachineOutliner] Move hasAddressTaken check to MachineOutliner.cpp
Jessica Paquette [Sat, 13 Jan 2018 00:42:28 +0000 (00:42 +0000)]
[MachineOutliner] Move hasAddressTaken check to MachineOutliner.cpp

*Mostly* NFC. Still updating the test though just for completeness.

This moves the hasAddressTaken check to MachineOutliner.cpp and replaces it
with a per-basic block test rather than a per-function test. The old test was
too conservative and was preventing functions in C programs from being
outlined even though they were safe to outline.

This was mostly a problem in C sources.

llvm-svn: 322425

6 years ago[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized
Petr Hosek [Sat, 13 Jan 2018 00:29:49 +0000 (00:29 +0000)]
[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized

It was always intended to be.

Patch By: mcgrathr

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

llvm-svn: 322424

6 years ago[WebAssembly] Use ArrayRef over raw pointers
Sam Clegg [Sat, 13 Jan 2018 00:22:00 +0000 (00:22 +0000)]
[WebAssembly] Use ArrayRef over raw pointers

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

llvm-svn: 322423

6 years agoSwitch from Bourne shell to simply base shell to build libfuzzer
Kamil Rytarowski [Fri, 12 Jan 2018 23:45:24 +0000 (23:45 +0000)]
Switch from Bourne shell to simply base shell to build libfuzzer

Summary: It is not necessary launching the build script with bash.

Reviewers: krytarowski

Reviewed By: krytarowski

Subscribers: llvm-commits, #sanitizers

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

llvm-svn: 322422

6 years agoFix incorrect physical address on self-referencing AT command.
Rafael Espindola [Fri, 12 Jan 2018 23:26:25 +0000 (23:26 +0000)]
Fix incorrect physical address on self-referencing AT command.

When a section placement (AT) command references the section itself,
the physical address of the section in the ELF header was calculated
incorrectly due to alignment happening right after the location
pointer's value was captured.

The problem was diagnosed and the first version of the patch written
by Erick Reyes.

llvm-svn: 322421

6 years agoTry to suppress Windows testing again.
Richard Trieu [Fri, 12 Jan 2018 23:13:33 +0000 (23:13 +0000)]
Try to suppress Windows testing again.

llvm-svn: 322420

6 years ago[AMDGPU] stop image_store being moved illegally
Tim Renouf [Fri, 12 Jan 2018 22:57:24 +0000 (22:57 +0000)]
[AMDGPU] stop image_store being moved illegally

Summary:
A recent change
321556: AMDGPU: Remove mayLoad/hasSideEffects from MIMG stores
can allow the machine instruction scheduler to move an image store past
an image load using the same descriptor.

V2: Fixed by marking image ops as mayAlias and isAliased. This may be
overly conservative, and we may need to revisit.
V3: Reverted test change done on 321556.

Reviewers: arsenm, nhaehnle, dstuttard

Subscribers: llvm-commits, t-tye, yaxunl, wdng, kzhuravl

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

llvm-svn: 322419

6 years agoWe have two sources for path remapping information that we get out
Jason Molenda [Fri, 12 Jan 2018 22:42:45 +0000 (22:42 +0000)]
We have two sources for path remapping information that we get out
of a dSYM per-uuid plist that may be present (dsymutil does not
create this plist, it is only added after the fact by additional
tools) -- either the DBGBuildSourcePath + DBGSourcePath pair of
k-v entries which give us the build-time and debug-time remapping,
or the newer DBGSourcePathRemapping dictionary which may give us
multiple remappings.

I'm changing the order that we process these & add them to the
list of source remappings.  If the DBGSourcePathRemapping dict
is present, it should be the first entries we will try.

<rdar://problem/36481989>

llvm-svn: 322418

6 years agoFix test on Windows that was added in r322382.
Douglas Yung [Fri, 12 Jan 2018 22:32:01 +0000 (22:32 +0000)]
Fix test on Windows that was added in r322382.

The test was using "%clang++" which on Windows became "clang.exe++". Use %clangxx instead.

Reviewed by Paul Robinson

llvm-svn: 322417

6 years agoDo not pass an argument that can be easily inferred from other argument.
Rui Ueyama [Fri, 12 Jan 2018 22:29:29 +0000 (22:29 +0000)]
Do not pass an argument that can be easily inferred from other argument.

llvm-svn: 322416

6 years ago[WebAssembly] Add COMDAT support
Sam Clegg [Fri, 12 Jan 2018 22:25:17 +0000 (22:25 +0000)]
[WebAssembly] Add COMDAT support

See https://bugs.llvm.org/show_bug.cgi?id=35533, and D40844

Things covered:
* Removing duplicate data segments (as determined by COMDATs emitted
  by the frontend)
* Removing duplicate globals and functions in COMDATs
* Checking that each time a COMDAT is seen it has the same symbols
  as at other times (ie it's a stronger check than simply giving all
  the symbols in the COMDAT weak linkage)

Patch by Nicholas Wilson!

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

llvm-svn: 322415

6 years agoWhen rebuilding an InitListExpr, don't give it a type.
Richard Smith [Fri, 12 Jan 2018 22:21:33 +0000 (22:21 +0000)]
When rebuilding an InitListExpr, don't give it a type.

InitListExprs without types (well, with type 'void') represent not-yet-analyzed
initializer lists; InitListExpr with types fool Sema into thinking they don't
need further analysis in some cases (particularly C++17 copy omission).

llvm-svn: 322414

6 years ago[DWARFv5] Have -gdwarf-5 generate MD5 checksums
Paul Robinson [Fri, 12 Jan 2018 22:19:03 +0000 (22:19 +0000)]
[DWARFv5] Have -gdwarf-5 generate MD5 checksums

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

llvm-svn: 322413

6 years ago[WebAssembly] Fix typo in file header
Sam Clegg [Fri, 12 Jan 2018 22:18:22 +0000 (22:18 +0000)]
[WebAssembly] Fix typo in file header

llvm-svn: 322412

6 years ago[InstSimplify] add tests for implied ptr cmp with null (PR35790); NFC
Sanjay Patel [Fri, 12 Jan 2018 22:16:26 +0000 (22:16 +0000)]
[InstSimplify] add tests for implied ptr cmp with null (PR35790); NFC

llvm-svn: 322411

6 years ago[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.
Artem Dergachev [Fri, 12 Jan 2018 22:12:11 +0000 (22:12 +0000)]
[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.

In the security package, we have a simple syntactic check that warns about
strcpy() being insecure, due to potential buffer overflows.

Suppress that check's warning in the trivial situation when the source is an
immediate null-terminated string literal and the target is an immediate
sufficiently large buffer.

Patch by András Leitereg!

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

llvm-svn: 322410

6 years ago[libFuzzer] Fix bug introduced in r322380 that always links -lc++.
Matt Morehouse [Fri, 12 Jan 2018 22:10:47 +0000 (22:10 +0000)]
[libFuzzer] Fix bug introduced in r322380 that always links -lc++.

llvm-svn: 322409

6 years ago[WebAssembly] Add --export flag to force a symbol to be exported
Sam Clegg [Fri, 12 Jan 2018 22:10:35 +0000 (22:10 +0000)]
[WebAssembly] Add --export flag to force a symbol to be exported

This is useful for emscripten or other tools that want to
selectively exports symbols without necessarily changing the
source code.

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

llvm-svn: 322408

6 years agoAllow unaligned access to ELF file data structures.
Rui Ueyama [Fri, 12 Jan 2018 22:09:19 +0000 (22:09 +0000)]
Allow unaligned access to ELF file data structures.

The ELF specification says that all ELF data structures are aligned to
their natural alignments both in memory and file. That means when we
access mmap'ed ELF files, we could assume that all data structures are
aligned properly.

However, in reality, we assume that the data structures are aligned only
to two bytes because .a files only guarantee that their member files are
aligned to two bytes in archive files. So the data access is already
unaligned.

This patch relaxes the alignment requirement even more, so that we
accept unaligned access to all ELF data structures.

This patch in particular makes lld bug-compatible with icc. Intel C
compiler doesn't seem to care about data alignment and generates unaligned
relocation sections (https://bugs.llvm.org/show_bug.cgi?id=35854).
I also saw another instance of compatibility issues with our internal tool
which creates unaligned section headers.

Because GNU linkers are not picky about alignment, looks like it is
not uncommon that ELF-generating tools create unaligned files.

There is a performance penalty with this patch on host machines on which
unaligned access is expensive. x86 and AArch64 are fine. ARMv6 is a
problem, but I don't think using ARMv6 machines as hosts is common, so I
believe it's not a real problem.

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

llvm-svn: 322407

6 years agoAllocate and access NormalCleanupDest with the natural alignment of i32.
John McCall [Fri, 12 Jan 2018 22:07:01 +0000 (22:07 +0000)]
Allocate and access NormalCleanupDest with the natural alignment of i32.

This alignment can be less than 4 on certain embedded targets, which may
not even be able to deal with 4-byte alignment on the stack.

Patch by Jacob Young!

llvm-svn: 322406

6 years agoDisable test for Windows to fix Windows buildbots.
Richard Trieu [Fri, 12 Jan 2018 21:49:20 +0000 (21:49 +0000)]
Disable test for Windows to fix Windows buildbots.

llvm-svn: 322405

6 years agoUpdate MSF File Documentation.
Zachary Turner [Fri, 12 Jan 2018 21:42:39 +0000 (21:42 +0000)]
Update MSF File Documentation.

This adds some more detail about the PDB container format,
specifically surrounding the layout of the Free Page Map.

Patch by Colden Cullen
Differential Revision: https://reviews.llvm.org/D41825

llvm-svn: 322404

6 years ago[NFC] Change MemIntrinsicInst::setAlignment() to take an unsigned instead of a Constant
Daniel Neilson [Fri, 12 Jan 2018 21:33:37 +0000 (21:33 +0000)]
[NFC] Change MemIntrinsicInst::setAlignment() to take an unsigned instead of a Constant

Summary:
 In preparation for https://reviews.llvm.org/D41675 this NFC changes this
prototype of MemIntrinsicInst::setAlignment() to accept an unsigned instead
of a Constant.

llvm-svn: 322403

6 years agoAMDGPU/SI: Add d16 support for buffer intrinsics.
Changpeng Fang [Fri, 12 Jan 2018 21:12:19 +0000 (21:12 +0000)]
AMDGPU/SI: Add d16 support for buffer intrinsics.

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

Reviewers:
  Matt and Brian.

llvm-svn: 322402

6 years ago[JumpThreading] Preservation of DT and LVI across the pass
Brian M. Rzycki [Fri, 12 Jan 2018 21:06:48 +0000 (21:06 +0000)]
[JumpThreading] Preservation of DT and LVI across the pass

Summary:
See D37528 for a previous (non-deferred) version of this
patch and its description.

Preserves dominance in a deferred manner using a new class
DeferredDominance. This reduces the performance impact of
updating the DominatorTree at every edge insertion and
deletion. A user may call DDT->flush() within JumpThreading
for an up-to-date DT. This patch currently has one flush()
at the end of runImpl() to ensure DT is preserved across
the pass.

LVI is also preserved to help subsequent passes such as
CorrelatedValuePropagation. LVI is simpler to maintain and
is done immediately (not deferred). The code to perform the
preversation was minimally altered and simply marked as
preserved for the PassManager to be informed.

This extends the analysis available to JumpThreading for
future enhancements such as threading across loop headers.

Reviewers: dberlin, kuhar, sebpop

Reviewed By: kuhar, sebpop

Subscribers: mgorny, dmgreen, kuba, rnk, rsmith, hiraditya, llvm-commits

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

llvm-svn: 322401

6 years agoTry to fix more bots after r322391
Paul Robinson [Fri, 12 Jan 2018 20:54:45 +0000 (20:54 +0000)]
Try to fix more bots after r322391

llvm-svn: 322400

6 years agoCorrect the setitimer interceptor on NetBSD
Kamil Rytarowski [Fri, 12 Jan 2018 20:45:56 +0000 (20:45 +0000)]
Correct the setitimer interceptor on NetBSD

Summary:
itimerval can contain padding that may be legitimately uninitialized.

On NetBSD there are four integers of type "long, int, long, int", the
int argument stands for __sanitizer_suseconds_t. Compiler adds extra
padding in this layout.

Check every field of struct itimerval separately.

Define __sanitizer_suseconds_t as long on FreeBSD, Linux and SmartOS,
and int on NetBSD. Define __sanitizer_timeval and __sanitizer_itimerval.

Sponsored by <The NetBSD Foundation>

Reviewers: eugenis, joerg, vitalybuka

Reviewed By: vitalybuka

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

Tags: #sanitizers

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

llvm-svn: 322399

6 years agoSilence GCC 7 warning by using an enum class.
Florian Hahn [Fri, 12 Jan 2018 20:35:45 +0000 (20:35 +0000)]
Silence GCC 7 warning by using an enum class.

This silences the following GCC7 warning:

    lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp:142:30: warning:
    enumeral and non-enumeral type in conditional expression [-Wextra]
         return F != Colors.end() ? F->second : None;
                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~

Reviewers: amharc, RKSimon, davide

Reviewed By: RKSimon, davide

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

llvm-svn: 322398

6 years ago[llvm-cov] Skip unnecessary coverage computations for "export -summary-only".
Max Moroz [Fri, 12 Jan 2018 20:31:32 +0000 (20:31 +0000)]
[llvm-cov] Skip unnecessary coverage computations for "export -summary-only".

Summary:
This speeds up export "summary-only" execution by an order of magnitude or two,
depending on number of threads used for prepareFileReports execution.

Also includes minor refactoring for splitting render of summary and detailed data
in two independent methods.

Reviewers: vsk, morehouse

Reviewed By: vsk

Subscribers: llvm-commits, kcc

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

llvm-svn: 322397

6 years agoRefactor handling of signext/zeroext in ABIArgInfo
Alex Bradbury [Fri, 12 Jan 2018 20:08:16 +0000 (20:08 +0000)]
Refactor handling of signext/zeroext in ABIArgInfo

As @rjmccall suggested in D40023, we can get rid of
ABIInfo::shouldSignExtUnsignedType (used to handle cases like the Mips calling
convention where 32-bit integers are always sign extended regardless of the
sign of the type) by adding a SignExt field to ABIArgInfo. In the common case,
this new field is set automatically by ABIArgInfo::getExtend based on the sign
of the type. For targets that want greater control, they can use
ABIArgInfo::getSignExtend or ABIArgInfo::getZeroExtend when necessary. This
change also cleans up logic in CGCall.cpp.

There is no functional change intended in this patch, and all tests pass
unchanged. As noted in D40023, Mips might want to sign-extend unsigned 32-bit
integer return types. A future patch might modify
MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType.

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

llvm-svn: 322396

6 years agoRemove ELFDataTypeTypedefHelper class.
Rui Ueyama [Fri, 12 Jan 2018 19:59:43 +0000 (19:59 +0000)]
Remove ELFDataTypeTypedefHelper class.

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

llvm-svn: 322395

6 years agoAdd toothpicks to test from r322391
Paul Robinson [Fri, 12 Jan 2018 19:58:35 +0000 (19:58 +0000)]
Add toothpicks to test from r322391

llvm-svn: 322394

6 years ago[OPENMP] Replace calls of getAssociatedStmt().
Alexey Bataev [Fri, 12 Jan 2018 19:39:11 +0000 (19:39 +0000)]
[OPENMP] Replace calls of getAssociatedStmt().

getAssociatedStmt() returns the outermost captured statement for the
OpenMP directive. It may return incorrect region in case of combined
constructs. Reworked the code to reduce the number of calls of
getAssociatedStmt() and used getInnermostCapturedStmt() and
getCapturedStmt() functions instead.
In case of firstprivate variables it may lead to an extra allocas
generation for private copies even if the variable is passed by value
into outlined function and could be used directly as private copy.

llvm-svn: 322393

6 years ago[AArch64] Fix scheduling resources for post indexed loads and stores
Evandro Menezes [Fri, 12 Jan 2018 19:20:11 +0000 (19:20 +0000)]
[AArch64] Fix scheduling resources for post indexed loads and stores

Fix typos in the default scheduling resources when using the post indexed
addressing modes.

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

llvm-svn: 322392

6 years ago[DWARFv5] CodeGen support for MD5 file checksums
Paul Robinson [Fri, 12 Jan 2018 19:17:50 +0000 (19:17 +0000)]
[DWARFv5] CodeGen support for MD5 file checksums

Pass MD5 checksums through from IR to assembly/object files.
After this, getting Clang to compute the MD5 should be the last step
to supporting MD5 in the DWARF v5 line table header.

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

llvm-svn: 322391

6 years ago[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.
Volodymyr Sapsai [Fri, 12 Jan 2018 18:54:35 +0000 (18:54 +0000)]
[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.

Fix makes the loop in LexAngledStringLiteral more like the loops in
LexStringLiteral, LexCharConstant. When we skip a character after
backslash, we need to check if we reached the end of the file instead of
reading the next character unconditionally.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832

rdar://problem/35572754

Reviewers: arphaman, kcc, rsmith, dexonsmith

Reviewed By: rsmith, dexonsmith

Subscribers: cfe-commits, rsmith, dexonsmith

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

llvm-svn: 322390

6 years ago[scudo] Add SANITIZER_CXX_ABI_LIBRARY to SCUDO_DYNAMIC_LIBS
Kostya Kortchinsky [Fri, 12 Jan 2018 18:45:30 +0000 (18:45 +0000)]
[scudo] Add SANITIZER_CXX_ABI_LIBRARY to SCUDO_DYNAMIC_LIBS

Summary:
This is needed for the shared runtime since we are pulling RTUbsan in.

Otherwise some builds might fail with errors such as:
`error: undefined reference to '__dynamic_cast'`

Reviewers: alekseyshl, srhines

Reviewed By: srhines

Subscribers: kongyi, pirama, chh, mgorny, llvm-commits, #sanitizers

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

llvm-svn: 322389

6 years ago[WebAssembly] Create synthetic __wasm_call_ctors function
Sam Clegg [Fri, 12 Jan 2018 18:35:13 +0000 (18:35 +0000)]
[WebAssembly] Create synthetic __wasm_call_ctors function

This change create a new synthetic function in the final
output binary which calls the static constructors in sequence.

See: https://github.com/WebAssembly/tool-conventions/issues/25

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

llvm-svn: 322388

6 years ago[clangd] Code completion uses Sema for NS-level things in the current file.
Sam McCall [Fri, 12 Jan 2018 18:30:08 +0000 (18:30 +0000)]
[clangd] Code completion uses Sema for NS-level things in the current file.

Summary:
To stay fast, it avoids deserializing anything outside the current file, by
disabling the LoadExternal code completion option added in r322377, when the
index is enabled.

Reviewers: hokein

Subscribers: klimek, ilya-biryukov, cfe-commits

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

llvm-svn: 322387

6 years agoMC: Remove redundant `SetUsed` arguments in MCSymbol methods
Sam Clegg [Fri, 12 Jan 2018 18:05:40 +0000 (18:05 +0000)]
MC: Remove redundant `SetUsed` arguments in MCSymbol methods

We can probably take this a step further since the only
user of the isUsed flag is AsmParser it should probably
be doing this explicitly. For now this is a step in the
right direction though.

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

llvm-svn: 322386

6 years ago[X86][SSE] Force blend domains on stack folding tests
Simon Pilgrim [Fri, 12 Jan 2018 18:05:29 +0000 (18:05 +0000)]
[X86][SSE] Force blend domains on stack folding tests

llvm-svn: 322385

6 years ago[X86][AVX] Regenerate element insertion tests
Simon Pilgrim [Fri, 12 Jan 2018 18:02:52 +0000 (18:02 +0000)]
[X86][AVX] Regenerate element insertion tests

llvm-svn: 322384

6 years ago[WebAssembly] Don't allow functions to be named more than once
Sam Clegg [Fri, 12 Jan 2018 17:56:15 +0000 (17:56 +0000)]
[WebAssembly] Don't allow functions to be named more than once

Even though a function can have multiple names in the
linking standards (i.e. due to aliases), there can only
be one name for a given function in the NAME section.

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

llvm-svn: 322383

6 years ago[WebAssembly] Support -stdlib=libc++ switch
Sam Clegg [Fri, 12 Jan 2018 17:54:49 +0000 (17:54 +0000)]
[WebAssembly] Support -stdlib=libc++ switch

Referenced implementation from Fuchsia and Darwin Toolchain.
Still only support CST_Libcxx.  Now checks that the argument
is really '-stdlib=libc++', and display error.

Also, now will pass -lc++ and -lc++abi to the linker.

Patch by Patrick Cheng!

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

llvm-svn: 322382

6 years ago[X86] Remove unused isel pattern for zero extend from v16i1/v8i1 to v16i32/v8i64.
Craig Topper [Fri, 12 Jan 2018 17:34:09 +0000 (17:34 +0000)]
[X86] Remove unused isel pattern for zero extend from v16i1/v8i1 to v16i32/v8i64.

We have custom lowering on vzext that produces a vselect and a build vector. So zext never gets to isel.

llvm-svn: 322381

6 years agolib Fuzzer FreeBSD support
Kamil Rytarowski [Fri, 12 Jan 2018 17:15:05 +0000 (17:15 +0000)]
lib Fuzzer FreeBSD support

Summary: Patch by David CARLIER

Reviewers: vitalybuka, kcc, dim, emaste, davide, morehouse, george.karpenkov

Reviewed By: morehouse

Subscribers: george.karpenkov, kubamracek, srhines, mgorny, emaste, krytarowski

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

llvm-svn: 322380

6 years ago[clangd] Include debugging tags for both static and dynamic index. NFC
Sam McCall [Fri, 12 Jan 2018 17:09:49 +0000 (17:09 +0000)]
[clangd] Include debugging tags for both static and dynamic index. NFC

llvm-svn: 322379

6 years agoAllow dso_local on ifunc.
Rafael Espindola [Fri, 12 Jan 2018 17:03:43 +0000 (17:03 +0000)]
Allow dso_local on ifunc.

It was never fully disallowed. We were rejecting it in the asm parser,
but not in the verifier.

Currently TargetMachine::shouldAssumeDSOLocal returns true for hidden
ifuncs. I considered changing it and moving the check from the asm
parser to the verifier.

The reason for deciding to allow it instead is that all linkers handle
a direct reference just fine. They use the plt address as the address
of the function. In fact doing that means that clang doesn't have the
same bug as gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83782.

This patch then removes the check from the asm parser and updates the
bitcode reader and writer.

llvm-svn: 322378

6 years ago[clangd] Incorporate fuzzy-match into result rankings.
Sam McCall [Fri, 12 Jan 2018 16:16:09 +0000 (16:16 +0000)]
[clangd] Incorporate fuzzy-match into result rankings.

Summary: The scoring function is fuzzy-match-quality * existing quality score.

Reviewers: ioeric

Subscribers: klimek, cfe-commits, ilya-biryukov

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

llvm-svn: 322377

6 years ago[CMake] Use only keyword-version of target_link_library. NFC.
Michael Kruse [Fri, 12 Jan 2018 16:09:18 +0000 (16:09 +0000)]
[CMake] Use only keyword-version of target_link_library. NFC.

CMake insists that for each target, one uses only the non-keyword
version of target_link_library

    target_link_library(mytarget lib)

or the one with PUBLIC/PRIVATE/INTERFACE keyword:

    target_link_library(mytarget PUBLIC lib)

Otherwise, CMake fails with the error message:

  The keyword signature for target_link_libraries has already been used with
  the target "mytarget".  All uses of target_link_libraries with a target
  must be either all-keyword or all-plain.

Change all occurances of target_link_library to the newer keyworded
version to avoid such errors. Some already have been changed in r319840,
but might not be sufficient for all build configurations to build
the doxygen manual.

Reported-by: Tanya Lattner <tanyalattner@llvm.org>
llvm-svn: 322376

6 years ago[docs] Tweak update to Phabricator docs about setting repository for diffs uploaded...
Ben Hamilton [Fri, 12 Jan 2018 15:44:35 +0000 (15:44 +0000)]
[docs] Tweak update to Phabricator docs about setting repository for diffs uploaded via web

Summary:
In D41919, I missed that there was a *second* step when uploading
diffs via web where the repository should be specified.

Reviewers: asb, probinson

Reviewed By: asb

Subscribers: llvm-commits

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

llvm-svn: 322375

6 years ago[llvm] Set up .arcconfig to point to Diffusion L repository
Ben Hamilton [Fri, 12 Jan 2018 15:37:41 +0000 (15:37 +0000)]
[llvm] Set up .arcconfig to point to Diffusion L repository

Summary:
Thanks to probinson for noticing this in his review of D41956.

Now that we have repository callsigns set in all the other
LLVM/Clang projects' .arcconfig files, we can set the top-level
LLVM .arcconfig repository callsign to "L".

This will correctly Cc: llvm-commits@ on all review requests
sent out from the LLVM repo directory, using Herald rule H270.

Reviewers: klimek, sammccall

Reviewed By: sammccall

Subscribers: llvm-commits, probinson, asb

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

llvm-svn: 322374

6 years ago[PowerPC] Don't miscompile rotate+mask into an ANDIo if it can't recreate the immediate
Benjamin Kramer [Fri, 12 Jan 2018 15:03:24 +0000 (15:03 +0000)]
[PowerPC] Don't miscompile rotate+mask into an ANDIo if it can't recreate the immediate

I'm not even sure if this transform is ever worth it, but this at least
stops the bleeding.

llvm-svn: 322373

6 years ago[PowerPC] Zero-extend the compare operand for ATOMIC_CMP_SWAP
Nemanja Ivanovic [Fri, 12 Jan 2018 14:58:41 +0000 (14:58 +0000)]
[PowerPC] Zero-extend the compare operand for ATOMIC_CMP_SWAP

Part of the fix for https://bugs.llvm.org/show_bug.cgi?id=35812.
This patch ensures that the compare operand for the atomic compare and swap
is properly zero-extended to 32 bits if applicable.
A follow-up commit will fix the extension for the SETCC node generated when
expanding an ATOMIC_CMP_SWAP_WITH_SUCCESS. That will complete the bug fix.

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

llvm-svn: 322372