platform/upstream/llvm.git
5 years ago[X86] Promote i16 SRA instructions to i32
Craig Topper [Fri, 5 Apr 2019 06:32:50 +0000 (06:32 +0000)]
[X86] Promote i16 SRA instructions to i32

We already promote SRL and SHL to i32.

This will introduce sign extends sometimes which might be harder to deal with than the zero we use for promoting SRL. I ran this through some of our internal benchmark lists and didn't see any major regressions.

I think there might be some DAG combine improvement opportunities in the test changes here.

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

llvm-svn: 357743

5 years ago[FastISel] Fix crash for gc.relocate lowring
Serguei Katkov [Fri, 5 Apr 2019 05:41:08 +0000 (05:41 +0000)]
[FastISel] Fix crash for gc.relocate lowring

Lowering safepoint checks that all gc.relocaes observed in safepoint
must be lowered. However Fast-Isel is able to skip dead gc.relocate.

To resolve this issue we just ignore dead gc.relocate in the check.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60184

llvm-svn: 357742

5 years ago[TSan][libdispatch] Make test work on Linux, pt. 2
Julian Lettner [Fri, 5 Apr 2019 02:05:57 +0000 (02:05 +0000)]
[TSan][libdispatch] Make test work on Linux, pt. 2

llvm-svn: 357741

5 years ago[test] Specify an explicit darwin version in a triple in
Alex Lorenz [Fri, 5 Apr 2019 01:48:11 +0000 (01:48 +0000)]
[test] Specify an explicit darwin version in a triple in
`test/Driver/debug-options.c` to ensure that the driver
selects the DWARF 2 version as intended by the test.

Fixes the `test/Driver/debug-options.c` test regression on GreenDragon
on macOS that started failing after r357713.

llvm-svn: 357740

5 years agoELF: Simplify. NFCI.
Peter Collingbourne [Fri, 5 Apr 2019 01:31:40 +0000 (01:31 +0000)]
ELF: Simplify. NFCI.

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

llvm-svn: 357739

5 years agoRemove redundant parameters. NFC.
Rui Ueyama [Fri, 5 Apr 2019 01:30:09 +0000 (01:30 +0000)]
Remove redundant parameters. NFC.

llvm-svn: 357738

5 years ago[WebAssembly] Include function in wasm table when used in R_WASM_TABLE_INDEX_REL_SLEB
Sam Clegg [Fri, 5 Apr 2019 00:35:12 +0000 (00:35 +0000)]
[WebAssembly] Include function in wasm table when used in R_WASM_TABLE_INDEX_REL_SLEB

This should have been part of rL357710 but was overlooked because
in our test code the function in question was also used in other
relocations that caused it to be added to the table anyway.

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

llvm-svn: 357737

5 years agoNFC: Move API uses of MD5::MD5Result to Optional rather than a pointer.
Eric Christopher [Thu, 4 Apr 2019 23:34:38 +0000 (23:34 +0000)]
NFC: Move API uses of MD5::MD5Result to Optional rather than a pointer.

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

llvm-svn: 357736

5 years agoInclude invoke'd functions for recursive extract
David Callahan [Thu, 4 Apr 2019 23:30:47 +0000 (23:30 +0000)]
Include invoke'd functions for recursive extract

Summary: When recursively extracting a function from a bit code file, include functions mentioned in InvokeInst as well as CallInst

Reviewers: loladiro, espindola, volkan

Reviewed By: loladiro

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357735

5 years agoAn unreachable block may have a route to a reachable block, don't fast-path return...
Nick Lewycky [Thu, 4 Apr 2019 23:09:40 +0000 (23:09 +0000)]
An unreachable block may have a route to a reachable block, don't fast-path return that it can't.

A block reachable from the entry block can't have any route to a block that's not reachable from the entry block (if it did, that route would make it reachable from the entry block). That is the intended performance optimization for isPotentiallyReachable. For the case where we ask whether an unreachable from entry block has a route to a reachable from entry block, we can't conclude one way or the other. Fix a bug where we claimed there could be no such route.

The fix in rL357425 ironically reintroduced the very bug it was fixing but only when a DominatorTree is provided. This fixes the remaining bug.

llvm-svn: 357734

5 years ago[TextAPI] Prefix all architecture enums to fix the build on i386.
Juergen Ributzka [Thu, 4 Apr 2019 22:56:50 +0000 (22:56 +0000)]
[TextAPI] Prefix all architecture enums to fix the build on i386.

Summary: This changes the Architecture enum to use a prefix (AK_) to prevent the
preprocessor from replacing i386 with 1 when building llvm/clang for i386.

Reviewers: steven_wu, lhames, mstorsjo

Reviewed By: mstorsjo

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 357733

5 years ago[libFuzzer] Another follow up fix for Data Flow scripts in Py3.
Max Moroz [Thu, 4 Apr 2019 22:55:18 +0000 (22:55 +0000)]
[libFuzzer] Another follow up fix for Data Flow scripts in Py3.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357732

5 years ago[IR] Refactor attribute methods in Function class (NFC)
Evandro Menezes [Thu, 4 Apr 2019 22:40:06 +0000 (22:40 +0000)]
[IR] Refactor attribute methods in Function class (NFC)

Rename the functions that query the optimization kind attributes.

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

llvm-svn: 357731

5 years ago[libFuzzer] Fix output format in data flow merge script after Py3 change.
Max Moroz [Thu, 4 Apr 2019 22:21:27 +0000 (22:21 +0000)]
[libFuzzer] Fix output format in data flow merge script after Py3 change.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357730

5 years ago[TSan][libdispatch] Make test work on Linux
Julian Lettner [Thu, 4 Apr 2019 21:55:40 +0000 (21:55 +0000)]
[TSan][libdispatch] Make test work on Linux

llvm-svn: 357729

5 years agoRemove unneeded ymath.h include from int_math.h
Reid Kleckner [Thu, 4 Apr 2019 21:47:15 +0000 (21:47 +0000)]
Remove unneeded ymath.h include from int_math.h

This avoids a conflict between stdbool.h, which defines bool to _Bool in
xkeycheck.h. From what I can tell, ymath.h is an internal header, and
the intention is that users should include math.h directly instead. It
doesn't appear to provide declarations of anything required for our
builtins. This include was added back in r249513 from 2015, and it's
possible that ymath.h provided something this code needed at the time,
but today it does not.

llvm-svn: 357728

5 years ago[TSan][libdispatch] Stricter checks via `--implicit-check-not`
Julian Lettner [Thu, 4 Apr 2019 21:25:56 +0000 (21:25 +0000)]
[TSan][libdispatch] Stricter checks via `--implicit-check-not`

`--implicit-check-not='ThreadSanitizer'` checks in the entire output
while `// CHECK-NOT: ThreadSanitizer` only checks after (before) the
previous (next) match.

llvm-svn: 357727

5 years ago[libFuzzer] Make DataFlow scripts Python3 compatible.
Max Moroz [Thu, 4 Apr 2019 21:20:36 +0000 (21:20 +0000)]
[libFuzzer] Make DataFlow scripts Python3 compatible.

Summary:
Python2 will hit end of life soon: https://pythonclock.org/
This change also makes the integration with OSS-Fuzz a bit simpler:
https://github.com/google/oss-fuzz/issues/1632

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357726

5 years ago[winasan] Fix strrchr interception with vs2019 CRT
Reid Kleckner [Thu, 4 Apr 2019 21:08:02 +0000 (21:08 +0000)]
[winasan] Fix strrchr interception with vs2019 CRT

strrchr in vs2019 CRT begins with unrecognized instructions.

VCRUNTIME140!strrchr:
4533c9         xor     r9d, r9d
4c8bc1         mov     r8, rcx

Patch by Christopher Reid!

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

llvm-svn: 357725

5 years agoMake SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*
Nico Weber [Thu, 4 Apr 2019 21:06:41 +0000 (21:06 +0000)]
Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*

Requires making the llvm::MemoryBuffer* stored by SourceManager const,
which in turn requires making the accessors for that return const
llvm::MemoryBuffer*s and updating all call sites.

The original motivation for this was to use it and fix the TODO in
CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag
version of createFileID, and since llvm::SourceMgr* hands out a const
llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO
this way actually works, but this seems like a good change on its own
anyways.

No intended behavior change.

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

llvm-svn: 357724

5 years agoFix some MCTargetOptions Doxygen comments (NFC)
Scott Linder [Thu, 4 Apr 2019 20:35:57 +0000 (20:35 +0000)]
Fix some MCTargetOptions Doxygen comments (NFC)

llvm-svn: 357723

5 years ago[OpenMP] Fix hang on Windows
Jonathan Peyton [Thu, 4 Apr 2019 20:35:29 +0000 (20:35 +0000)]
[OpenMP] Fix hang on Windows

Debug dump on large machine shows when many OpenMP threads (401 in total)
sleep on a barrier, one of the innermost nesting levels sleeps
on a child's b_arrived flag whose value is equal to 4 and is equal to
checker value. i.e., (1) sleep bit is 0, and (2) done_check() would
return true if called.

It is unclear how this might happen. It could be Windows Server 2016's
error of EnterCriticalSection / LeaveCriticalSection, or
error of WaitForSingleObject / SetEvent / ResetEvent, or
error in the library which is very difficult to find.

As a workaround, change INFINITE wait to timed wait, so that each
thread awakens each 5 seconds (the timeout was chosen arbitrary to not
disturb other threads much), check flag condition under the lock, and
either go to sleep again or stop sleeping as a result of the check.

Patch by Andrey Churbanov

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

llvm-svn: 357722

5 years agoSpecial case ObjCPropertyDecl for printing
David Goldman [Thu, 4 Apr 2019 20:13:22 +0000 (20:13 +0000)]
Special case ObjCPropertyDecl for printing

ObjCPropertyDecl should use the category interface as a context similar to what is done for methods.

Previously category methods would be printed as `::property`; now they are printed as `Class::property`.

llvm-svn: 357720

5 years agocheck-clang-tools: Actually build and run XPC test
Nico Weber [Thu, 4 Apr 2019 20:08:04 +0000 (20:08 +0000)]
check-clang-tools: Actually build and run XPC test

The CMake variable controlling if XPC code is built is called
CLANGD_BUILD_XPC but three places unintentionally checked the
non-existent variable CLANGD_BUILD_XPC_SUPPORT instead, which (due to
being nonexistent, and due to cmake) always silently evaluated to false.

Luckily the test still seems to pass, despite never running after being
added almost 3 months ago in r351280.

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

llvm-svn: 357719

5 years agoRevert [X86] When using Win64 ABI, exit with error if SSE is disabled for varargs
James Y Knight [Thu, 4 Apr 2019 19:05:48 +0000 (19:05 +0000)]
Revert [X86] When using Win64 ABI, exit with error if SSE is disabled for varargs

It unnecessarily breaks previously-working code which used varargs,
but didn't pass any float/double arguments (such as EDK2).

Also revert the fixup on top of that:
Revert [X86] Fix a test from r357317

This reverts r357317 (git commit d413f41de6baf500e5d20c638375447e18777db2)
This reverts r357380 (git commit 7af32444b9b17719ebabb6bee6eb52465acc8507)

llvm-svn: 357718

5 years ago[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:58:17 +0000 (18:58 +0000)]
[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.

Added test for the task reduction variables with the allocate clause.

llvm-svn: 357717

5 years agoAppease STLs where std::atomic<void*> lacks a constexpr default ctor
Reid Kleckner [Thu, 4 Apr 2019 18:45:05 +0000 (18:45 +0000)]
Appease STLs where std::atomic<void*> lacks a constexpr default ctor

MSVC 2019 casts the pointer to a pointer-sized integer, which is a
reinterpret_cast, which is invalid in a constexpr context, so I have to
remove the LLVM_REQUIRES_CONSTANT_INITIALIZATION annotation for now.

llvm-svn: 357716

5 years ago[WebAssembly] Apply data relocations at runtime in shared objects
Sam Clegg [Thu, 4 Apr 2019 18:40:51 +0000 (18:40 +0000)]
[WebAssembly] Apply data relocations at runtime in shared objects

See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md

Data section relocations in wasm shared libraries are applied by the
library itself at static constructor time.  This change adds a new
synthetic function that applies relocations to relevant memory locations
on startup.

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

llvm-svn: 357715

5 years agoEnsure that ManagedStatic is constant initialized in MSVC 2017 & 2019
Reid Kleckner [Thu, 4 Apr 2019 18:30:07 +0000 (18:30 +0000)]
Ensure that ManagedStatic is constant initialized in MSVC 2017 & 2019

Fixes PR41367.

This effectively relands r357655 with a workaround for MSVC 2017.

I tried various approaches with unions, but I ended up going with this
ifdef approach because it lets us write the proper C++11 code that we
want to write, with a separate workaround that we can delete when we
drop MSVC 2017 support.

This also adds LLVM_REQUIRE_CONSTANT_INITIALIZATION, which wraps
[[clang::require_constant_initialization]]. This actually detected a
minor issue when using clang-cl where clang wasn't able to use the
constexpr constructor in MSVC's STL, so I switched back to using the
default ctor of std::atomic<void*>.

llvm-svn: 357714

5 years agoVerify that Android targets generate DWARF 4 by default.
Stephen Hines [Thu, 4 Apr 2019 18:17:46 +0000 (18:17 +0000)]
Verify that Android targets generate DWARF 4 by default.

Summary:
In the future, Android releases will support DWARF 5, but we need to
ensure that older targets only have DWARF 4 generated for them. This
patch inserts that verification for all Android releases now. The patch
also fixes 2 minor mistakes (a mistakenly moved RUN line, and the
missing G_DWARF2 check label).

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: chh, pirama, cfe-commits

Tags: #clang

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

llvm-svn: 357713

5 years ago[OPENMP]Add codegen for linear vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:06:53 +0000 (18:06 +0000)]
[OPENMP]Add codegen for linear vars with allocate clause, NFC.

Added test for the linear variables with the allocate clause.

llvm-svn: 357712

5 years agoMove the alias definition of unw_getcontext to within !defined(__USING_SJLJ_EXCEPTIONS__)
Martin Storsjo [Thu, 4 Apr 2019 17:50:14 +0000 (17:50 +0000)]
Move the alias definition of unw_getcontext to within !defined(__USING_SJLJ_EXCEPTIONS__)

For builds with SJLJ, there is no __unw_getcontext symbol. On Windows,
the weak alias macro also expands to a dllexport directive, which fails
if the symbol doesn't exist.

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

llvm-svn: 357711

5 years ago[WebAssembly] Add new explicit relocation types for PIC relocations
Sam Clegg [Thu, 4 Apr 2019 17:43:50 +0000 (17:43 +0000)]
[WebAssembly] Add new explicit relocation types for PIC relocations

See https://github.com/WebAssembly/tool-conventions/pull/106

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

llvm-svn: 357710

5 years ago[llvm-objcopy] [llvm-symbolizer] Fix failing tests
Don Hinton [Thu, 4 Apr 2019 17:35:41 +0000 (17:35 +0000)]
[llvm-objcopy] [llvm-symbolizer] Fix failing tests

Summary: Fix failing tests that matched substrings in path.

Reviewers: evgeny777, mattd, espindola, alexshap, rupprecht, jhenderson

Reviewed By: jhenderson

Subscribers: Bulletmagnet, emaste, arichardson, jakehehrlich, MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 357709

5 years ago[OPENMP]Fix lookup of the user-defined reductions in C.
Alexey Bataev [Thu, 4 Apr 2019 17:28:22 +0000 (17:28 +0000)]
[OPENMP]Fix lookup of the user-defined reductions in C.

Fixed the regression of the lookup of user-defined reductions for C.

llvm-svn: 357708

5 years ago[TSan][libdispatch] Specify libdispatch header dir for lit tests
Julian Lettner [Thu, 4 Apr 2019 17:25:43 +0000 (17:25 +0000)]
[TSan][libdispatch] Specify libdispatch header dir for lit tests

Specify libdispatch header dir (include path) for lit tests. This is the
last missing piece in order to run the libdispatch tests on Linux even
when libdispatch is installed in a custom path instead of a default
(system) location.

llvm-svn: 357707

5 years agollvm-dwarfdump: Support alternative architecture names in the -arch filter
Adrian Prantl [Thu, 4 Apr 2019 15:48:40 +0000 (15:48 +0000)]
llvm-dwarfdump: Support alternative architecture names in the -arch filter

<rdar://problem/47918606>

llvm-svn: 357706

5 years agoHandle TLS values in sym_check
Eric Fiselier [Thu, 4 Apr 2019 15:37:10 +0000 (15:37 +0000)]
Handle TLS values in sym_check

llvm-svn: 357705

5 years ago[x86] eliminate unnecessary broadcast of horizontal op
Sanjay Patel [Thu, 4 Apr 2019 14:46:13 +0000 (14:46 +0000)]
[x86] eliminate unnecessary broadcast of horizontal op

This is another pattern that comes up if we more aggressively
scalarize FP ops.

llvm-svn: 357703

5 years ago[RISCV] Fix rL357699 by adding missing zero-length files
Alex Bradbury [Thu, 4 Apr 2019 14:36:07 +0000 (14:36 +0000)]
[RISCV] Fix rL357699 by adding missing zero-length files

svn add doesn't play very nicely here...

llvm-svn: 357702

5 years ago[llvm] [cmake] Add additional headers only if they exist
Michal Gorny [Thu, 4 Apr 2019 14:21:38 +0000 (14:21 +0000)]
[llvm] [cmake] Add additional headers only if they exist

Modify the add_header_files_for_glob() function to only add files
that do exist, rather than all matches of the glob.  This fixes CMake
error when one of the include directories (which happen to include
/usr/include) contain broken symlinks.

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

llvm-svn: 357701

5 years agoUpdating Chromium's Java import order
Nico Weber [Thu, 4 Apr 2019 14:19:45 +0000 (14:19 +0000)]
Updating Chromium's Java import order

Adding in androidx as another import group.

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

Patch from Sam Maier <smaier@chromium.org>!

llvm-svn: 357700

5 years ago[RISCV] Collect library directories and triples for riscv64 triple too
Alex Bradbury [Thu, 4 Apr 2019 14:18:26 +0000 (14:18 +0000)]
[RISCV] Collect library directories and triples for riscv64 triple too

When setting up library and tools paths when detecting an accompanying GCC
installation only riscv32 was handled. As a consequence when targetting
riscv64 neither the linker nor libraries would be found. This adds handling
and tests for riscv64.

Differential Revision: https://reviews.llvm.org/D53392
Patch by Edward Jones.

llvm-svn: 357699

5 years ago[RISCV] Support assembling TLS add and associated modifiers
Lewis Revill [Thu, 4 Apr 2019 14:13:37 +0000 (14:13 +0000)]
[RISCV] Support assembling TLS add and associated modifiers

This patch adds support in the MC layer for parsing and assembling the
4-operand add instruction needed for TLS addressing. This also involves
parsing the %tprel_hi, %tprel_lo and %tprel_add operand modifiers.

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

llvm-svn: 357698

5 years ago[COFF] Fix delay import directory iterator
Joseph Tremoulet [Thu, 4 Apr 2019 14:13:28 +0000 (14:13 +0000)]
[COFF] Fix delay import directory iterator

Summary:
Take the Index into account in `getDelayImportTable`, otherwise we
always return the entry for the first delay DLL reference.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357697

5 years agoFix clangd-fuzzer build
Nico Weber [Thu, 4 Apr 2019 14:08:35 +0000 (14:08 +0000)]
Fix clangd-fuzzer build

r357102 made clangd-fuzzer no longer compile, but before
r357654 / r357694 we didn't notice. Fix the compile.

Also add a dep on FuzzMutate which I forgot to do in r357654.

llvm-svn: 357696

5 years ago[clang-format] Preserve include blocks in ObjC Google style
Krasimir Georgiev [Thu, 4 Apr 2019 14:04:26 +0000 (14:04 +0000)]
[clang-format] Preserve include blocks in ObjC Google style

Summary:
r357567 started to regroup include block for Google style; it was meant to apply
only for C++. This patch reverts this for ObjC.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: thakis, cfe-commits

Tags: #clang

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

llvm-svn: 357695

5 years agoUse a cmake check for linux that actually works.
Nico Weber [Thu, 4 Apr 2019 13:54:01 +0000 (13:54 +0000)]
Use a cmake check for linux that actually works.

llvm-svn: 357694

5 years ago[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver...
Alex Bradbury [Thu, 4 Apr 2019 13:51:41 +0000 (13:51 +0000)]
[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver/riscv32-toolchain.c

riscv32-linux-unknown-elf was a weird thing to test for as it doesn't match
the triple used in any common RISC-V toolchain distributions (e.g.
riscv-gnu-toolchain scripts produce riscv{32,64}-unknown-linux-gnu).

llvm-svn: 357693

5 years agoTry to suppress nodiscard_extension failures with Xcode 9
Nico Weber [Thu, 4 Apr 2019 13:37:15 +0000 (13:37 +0000)]
Try to suppress nodiscard_extension failures with Xcode 9

See https://crbug.com/949509 for the error message.

llvm-svn: 357692

5 years agoBreakpad: Refine record classification code
Pavel Labath [Thu, 4 Apr 2019 13:23:25 +0000 (13:23 +0000)]
Breakpad: Refine record classification code

Previously we would classify all STACK records into a single bucket.
This is not really helpful, because there are three distinct types of
records beginning with the token "STACK" (STACK CFI INIT, STACK CFI,
STACK WIN). To be consistent with how we're treating other records, we
should classify these as three different record types.

It also implements the logic to put "STACK CFI INIT" and "STACK CFI"
records into the same "section" of the breakpad file, as they are meant
to be read together (similar to how FUNC and LINE records are treated).

The code which performs actual parsing of these records will come in a
separate patch.

llvm-svn: 357691

5 years ago[clangd] Test #import directive go-to-definition. NFC
Sam McCall [Thu, 4 Apr 2019 13:09:02 +0000 (13:09 +0000)]
[clangd] Test #import directive go-to-definition. NFC

llvm-svn: 357690

5 years ago[clangd] Stop passing around PCHContainerOperations, just create it in place. NFC
Sam McCall [Thu, 4 Apr 2019 12:56:03 +0000 (12:56 +0000)]
[clangd] Stop passing around PCHContainerOperations, just create it in place. NFC

llvm-svn: 357689

5 years ago[SystemZ] Bugfix in isFusableLoadOpStorePattern()
Jonas Paulsson [Thu, 4 Apr 2019 12:12:35 +0000 (12:12 +0000)]
[SystemZ]  Bugfix in isFusableLoadOpStorePattern()

This function is responsible for checking the legality of fusing an instance
of load -> op -> store into a single operation. In the SystemZ backend the
check was incomplete and a test case emerged with a cycle in the instruction
selection DAG as a result.

Instead of using the NodeIds to determine node relationships,
hasPredecessorHelper() now is used just like in the X86 backend. This handled
the failing tests and as well gave a few additional transformations on
benchmarks.

The SystemZ isFusableLoadOpStorePattern() is now a very near copy of the X86
function, and it seems this could be made a utility function in common code
instead.

Review: Ulrich Weigand
https://reviews.llvm.org/D60255

llvm-svn: 357688

5 years ago[yaml2obj] - Check we correctly set the sh_info field of .symtab section.
George Rimar [Thu, 4 Apr 2019 11:49:54 +0000 (11:49 +0000)]
[yaml2obj] - Check we correctly set the sh_info field of .symtab section.

initSymtabSectionHeader has the following line:
SHeader.sh_info = findLocalsNum(Symbols) + 1;

As was mentioned in a review comments for D60122,
it is never tested. The patch adds a test.

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

llvm-svn: 357687

5 years ago[CodeComplete] Fix crash when completing ObjC block parameter with a broken type
Sam McCall [Thu, 4 Apr 2019 11:34:18 +0000 (11:34 +0000)]
[CodeComplete] Fix crash when completing ObjC block parameter with a broken type

Summary:
The fix isn't great, but it's hard to fix properly because the completion
code sensibly uses ParmVarDecl to represent parameters, but the AST-building
code sensibly doesn't synthesize them if the type is broken.
Also this case is apparently really rare, so it's probably not worth bending
over backwards for.

Reviewers: ilya-biryukov

Subscribers: javed.absar, kristof.beyls, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 357686

5 years agoRevert rL357655 and rL357656 from llvm/trunk:
Simon Pilgrim [Thu, 4 Apr 2019 11:12:30 +0000 (11:12 +0000)]
Revert rL357655 and rL357656 from llvm/trunk:
Fix minor innaccuracy in previous comment on ManagedStaticBase
........
Make ManagedStatic constexpr constructible

Apparently it needs member initializers so that it can be constructed in
a constexpr context. I explained my investigation of this in PR41367.
........
Causes vs2017 debug llvm-tblgen to fail with "Unknown command line argument" errors - similar to the vs2019 error discussed on PR41367 without the patch....

llvm-svn: 357685

5 years ago[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.
Anastasia Stulova [Thu, 4 Apr 2019 11:08:51 +0000 (11:08 +0000)]
[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.

Prevent adding initializers implicitly to variables declared in
local address space. This happens when they get converted into
global variables and therefore theoretically have to be default
initialized in C++.

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

llvm-svn: 357684

5 years ago[Symbolize] Keep SymbolDescs with the same address and improve getNameFromSymbolTable...
Fangrui Song [Thu, 4 Apr 2019 11:08:45 +0000 (11:08 +0000)]
[Symbolize] Keep SymbolDescs with the same address and improve getNameFromSymbolTable heuristic

I'll follow up with better heuristics or tests.

llvm-svn: 357683

5 years ago[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.
Anastasia Stulova [Thu, 4 Apr 2019 10:48:36 +0000 (10:48 +0000)]
[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.

Improved classification of address space cast when qualification
conversion is performed - prevent adding addr space cast for
non-pointer and non-reference types. Take address space correctly
from the pointee.

Also pass correct address space from 'this' object using
AggValueSlot when generating addrspacecast in the constructor
call.

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

llvm-svn: 357682

5 years ago[ARM GlobalISel] Support DBG_VALUE
Diana Picus [Thu, 4 Apr 2019 10:24:51 +0000 (10:24 +0000)]
[ARM GlobalISel] Support DBG_VALUE

Make sure we can map and select DBG_VALUE.

llvm-svn: 357681

5 years agomodify-python-lldb.py: (Re)move __len__ and __iter__ support
Pavel Labath [Thu, 4 Apr 2019 10:13:59 +0000 (10:13 +0000)]
modify-python-lldb.py: (Re)move __len__ and __iter__ support

Summary:
This patch moves the modify-python-lldb code for adding new functions to
the SBModule class into the SBModule interface file. As this is the last
class using this functionality, I also remove all support for this kind
of modifications from modify-python-lldb.py.

Reviewers: amccarth, clayborg, jingham

Subscribers: zturner, lldb-commits

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

llvm-svn: 357680

5 years ago[SLP][X86] Regenerate operandorder tests with arguments on same line. NFCI.
Simon Pilgrim [Thu, 4 Apr 2019 09:31:12 +0000 (09:31 +0000)]
[SLP][X86] Regenerate operandorder tests with arguments on same line. NFCI.

Stops update_test_checks.py from splitting the later arguments after the CHECKs.

llvm-svn: 357679

5 years agoAdd dropped ManualDWARFIndex assert()
Jan Kratochvil [Thu, 4 Apr 2019 09:24:02 +0000 (09:24 +0000)]
Add dropped ManualDWARFIndex assert()

D47253 dropped this assertion.

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

llvm-svn: 357678

5 years ago[AArch64][AsmParser] Fix .arch_extension directive parsing
Sander de Smalen [Thu, 4 Apr 2019 09:11:17 +0000 (09:11 +0000)]
[AArch64][AsmParser] Fix .arch_extension directive parsing

This patch fixes .arch_extension directive parsing to handle a wider
range of architecture extension options. The existing parser was parsing
extensions as an identifier which breaks for extensions containing a
"-", such as the "tlb-rmi" extension.

The extension is now parsed as a string. This is consistent with the
extension parsing in the .arch and .cpu directive parsing.

Patch by Cullen Rhodes (c-rhodes)

Reviewed By: SjoerdMeijer

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

llvm-svn: 357677

5 years ago[llvm-symbolizer] Allow more flexible usage of -e.
Igor Kudrin [Thu, 4 Apr 2019 08:45:06 +0000 (08:45 +0000)]
[llvm-symbolizer] Allow more flexible usage of -e.

addr2line allows -e to be grouped with other options; it also allows it
to prefix the value. Thus, all the following usages are possible:

  * addr2line -f -e <bin> <addr>
  * addr2line -fe <bin> <addr>
  * addr2line -f e<bin> <addr>
  * addr2line -fe<bin> <addr>

This patch adds the same for llvm-symbolizer.

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

llvm-svn: 357676

5 years ago[llvm-symbolizer] Add `--output-style` switch.
Igor Kudrin [Thu, 4 Apr 2019 08:39:40 +0000 (08:39 +0000)]
[llvm-symbolizer] Add `--output-style` switch.

In general, llvm-symbolizer follows the output style of GNU's addr2line.
However, there are still some differences; in particular, for a requested
address, llvm-symbolizer prints line and column, while addr2line prints
only the line number.

This patch adds a new switch to select the preferred style.

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

llvm-svn: 357675

5 years ago[InstCombine] Combine no-wrap sub and icmp w/ constant.
Luqman Aden [Thu, 4 Apr 2019 07:08:30 +0000 (07:08 +0000)]
[InstCombine] Combine no-wrap sub and icmp w/ constant.

Teach InstCombine the transformation `(icmp P (sub nuw|nsw C2, Y), C) -> (icmp swap(P) Y, C2-C)`

Reviewers: majnemer, apilipenko, sanjoy, spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: dmgreen, lebedev.ri, nikic, hiraditya, JDevlieghere, jfb, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357674

5 years ago[X86] Use INSERT_SUBREG rather than SUBREG_TO_REG when creating LEA64_32 during isel.
Craig Topper [Thu, 4 Apr 2019 05:00:18 +0000 (05:00 +0000)]
[X86] Use INSERT_SUBREG rather than SUBREG_TO_REG when creating LEA64_32 during isel.

SUBREG_TO_REG is supposed to be used to assert that we know the upper bits are
zero. But that isn't the case here. We've done no analysis of the inputs.

llvm-svn: 357673

5 years ago[FastISel] Fix the crash in gc.result lowering
Serguei Katkov [Thu, 4 Apr 2019 04:19:56 +0000 (04:19 +0000)]
[FastISel] Fix the crash in gc.result lowering

The Fast ISel has a fallback to SelectionDAGISel in case it cannot handle the instruction.
This works as follows:
Using reverse order, try to select instruction using Fast ISel, if it cannot handle instruction it fallbacks to SelectionDAGISel
for these instructions if it is a call and continue fast instruction selections.

However if unhandled instruction is not a call or statepoint related instruction it fallbacks to SelectionDAGISel for all remaining
instructions in basic block.

However gc.result instruction is missed and as a result it is possible that gc.result is processed earlier than statepoint
causing breakage invariant the gc.results should be handled after statepoint.

Test is updated because in the current form fast-isel cannot handle ret instruction (due to i1 ret type without explicit ext)
and as a result test does not check fast-isel at all.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60182

llvm-svn: 357672

5 years ago[libunwind] Export the weak alias in Mach-O
Petr Hosek [Thu, 4 Apr 2019 03:36:35 +0000 (03:36 +0000)]
[libunwind] Export the weak alias in Mach-O

This is not necessary for ELF since .globl and .weak are mutually
exclusive, but is necessary for Mach-O otherwise the symbol isn't
visible externally.

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

llvm-svn: 357671

5 years agoELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI.
Peter Collingbourne [Thu, 4 Apr 2019 03:13:51 +0000 (03:13 +0000)]
ELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI.

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

llvm-svn: 357670

5 years agoCreate RAII lock guard for global initialization lock.
Eric Fiselier [Thu, 4 Apr 2019 02:54:42 +0000 (02:54 +0000)]
Create RAII lock guard for global initialization lock.

This patch is a part of a series of cleanups to cxa_guard.cpp.
It should introduce no functionality change.

This patch refactors the use of the global mutex and condvar into
a RAII lock guard class. This improves correctness (since unlocks can't
be forgotten). It also allows the unification of the non-threading and
threading implementations.

llvm-svn: 357669

5 years agoAlways use is_initialized and set_initialized in cxa_guard.cpp
Eric Fiselier [Thu, 4 Apr 2019 02:40:30 +0000 (02:40 +0000)]
Always use is_initialized and set_initialized in cxa_guard.cpp

This patch is part of a series of cleanups to cxa_guard.cpp.
It should have no functionality change.

llvm-svn: 357668

5 years agoRevert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function...
David L. Jones [Thu, 4 Apr 2019 02:27:57 +0000 (02:27 +0000)]
Revert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)'

This revision causes tests to fail under ASAN. Since the cause of the failures
is not clear (could be ASAN, could be a Clang bug, could be a bug in this
revision), the safest course of action seems to be to revert while investigating.

llvm-svn: 357667

5 years agogn build: Merge r357663
Nico Weber [Thu, 4 Apr 2019 02:08:10 +0000 (02:08 +0000)]
gn build: Merge r357663

llvm-svn: 357666

5 years ago[WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined
Sam Clegg [Thu, 4 Apr 2019 01:43:21 +0000 (01:43 +0000)]
[WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined

This allows __THREW__ to be defined in the current module, although
it is still required to be a GlobalVariable.

In emscripten we want to be able to compile the source code that
defines this symbols.

Previously we were avoid this by not running this pass when building
that compiler-rt library, but I have change out to build it using the
normal compiler path:
https://github.com/emscripten-core/emscripten/pull/8391

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

llvm-svn: 357665

5 years ago[NFC][TSan][libdispatch] Better CMake variable names
Julian Lettner [Thu, 4 Apr 2019 01:10:07 +0000 (01:10 +0000)]
[NFC][TSan][libdispatch] Better CMake variable names

llvm-svn: 357664

5 years ago[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Hubert Tong [Thu, 4 Apr 2019 00:53:21 +0000 (00:53 +0000)]
[XCOFF] Add functionality for parsing AIX XCOFF object file headers

Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.

Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk

Reviewed By: sfertile, hubert.reinterpretcast

Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

Patch by Digger Lin

llvm-svn: 357663

5 years ago[Support] On AIX, Check ENOTSUP on posix_fallocate instead of EOPNOTSUPP
Hubert Tong [Thu, 4 Apr 2019 00:40:34 +0000 (00:40 +0000)]
[Support] On AIX, Check ENOTSUP on posix_fallocate instead of EOPNOTSUPP

Summary:
`posix_fallocate` can fail if the underlying filesystem does not support
it; and, on AIX, such a failure is reported by a return value of
`ENOTSUP`. The existing code checks only for `EOPNOTSUPP`, which may
share the same value as `ENOTSUP`, but is not required to.

Reviewers: xingxue, sfertile, jasonliu

Reviewed By: xingxue

Subscribers: kristina, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 357662

5 years ago[AIX] SelectionDAGNodes.h: Pack bit-fields that are meant to be packed
Hubert Tong [Thu, 4 Apr 2019 00:33:57 +0000 (00:33 +0000)]
[AIX] SelectionDAGNodes.h: Pack bit-fields that are meant to be packed

Summary:
Certain classes in the subject file are expected to provide different
views of a two-byte field as a collection of various bit-fields. On AIX,
the canonical layout of bit-fields would cause these classes to span
four bytes. Applying the `pack` pragma for compilers that employ the AIX
canonical layout allows these classes to fit within the expected two
bytes. In the future, the pragma would also likely need to be applied
when building with Clang on AIX.

Reviewers: xingxue, sfertile, jasonliu

Reviewed By: xingxue

Subscribers: jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 357661

5 years ago[gn] Use "$link /lib" for archives instead of lib.exe
Reid Kleckner [Thu, 4 Apr 2019 00:31:19 +0000 (00:31 +0000)]
[gn] Use "$link /lib" for archives instead of lib.exe

Summary:
This avoids the need to talk about lib.exe or llvm-lib.exe and it does
the right thing with LLD.

Reviewers: thakis

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357660

5 years ago[X86] Remove CustomInserters for RDPKRU/WRPKRU. Use some custom lowering and new...
Craig Topper [Thu, 4 Apr 2019 00:28:49 +0000 (00:28 +0000)]
[X86] Remove CustomInserters for RDPKRU/WRPKRU. Use some custom lowering and new ISD opcodes instead.

These inserters inserted some instructions to zero some registers and copied from virtual registers to physical registers.

This change instead inserts the zeros directly into the DAG at lowering time using new ISD opcodes
that take the extra zeroes as inputs. The zeros will then go through isel on their own to select
the MOV32r0 pseudo. Then we just need to mention the physical registers directly
in the isel patterns and the isel table and InstrEmitter will take care of inserting the necessary
copies to/from physical registers.

llvm-svn: 357659

5 years ago[codeview] Remove Type member from CVRecord
Reid Kleckner [Thu, 4 Apr 2019 00:28:48 +0000 (00:28 +0000)]
[codeview] Remove Type member from CVRecord

Summary:
Now CVType and CVSymbol are effectively type-safe wrappers around
ArrayRef<uint8_t>. Make the kind() accessor load it from the
RecordPrefix, which is the same for types and symbols.

Reviewers: zturner, aganea

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357658

5 years ago[TSan][libdispatch] Add Cmake option for libdispatch install path
Julian Lettner [Thu, 4 Apr 2019 00:28:09 +0000 (00:28 +0000)]
[TSan][libdispatch] Add Cmake option for libdispatch install path

llvm-svn: 357657

5 years agoFix minor innaccuracy in previous comment on ManagedStaticBase
Reid Kleckner [Thu, 4 Apr 2019 00:13:16 +0000 (00:13 +0000)]
Fix minor innaccuracy in previous comment on ManagedStaticBase

llvm-svn: 357656

5 years agoMake ManagedStatic constexpr constructible
Reid Kleckner [Thu, 4 Apr 2019 00:11:21 +0000 (00:11 +0000)]
Make ManagedStatic constexpr constructible

Apparently it needs member initializers so that it can be constructed in
a constexpr context. I explained my investigation of this in PR41367.

llvm-svn: 357655

5 years agoMake clangd-fuzzer use the normal add_llvm_fuzzer() machinery
Nico Weber [Thu, 4 Apr 2019 00:05:53 +0000 (00:05 +0000)]
Make clangd-fuzzer use the normal add_llvm_fuzzer() machinery

This allows building it even if no fuzzer is enabled. (Sadly, it only
builds on Linux at the moment.)

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

llvm-svn: 357654

5 years agollvm-undname: Name a pair. No behavior change.
Nico Weber [Wed, 3 Apr 2019 23:29:05 +0000 (23:29 +0000)]
llvm-undname: Name a pair. No behavior change.

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

llvm-svn: 357653

5 years ago[X86] Remove CustomInserter pseudos for MONITOR/MONITORX/CLZERO. Use custom instructi...
Craig Topper [Wed, 3 Apr 2019 23:28:30 +0000 (23:28 +0000)]
[X86] Remove CustomInserter pseudos for MONITOR/MONITORX/CLZERO. Use custom instruction selection instead.

This custom inserter existed so we could do a weird thing where we pretended that the instructions support
a full address mode instead of taking a pointer in EAX/RAX. I think was largely so we could be pointer
size agnostic in the isel pattern.

To make this work we would then put the address into an LEA into EAX/RAX in front of the instruction after
isel. But the LEA is overkill when we just have a base pointer. So we end up using the LEA as a slower MOV
instruction.

With this change we now just do custom selection during isel instead and just assign the incoming address
of the intrinsic into EAX/RAX based on its size. After the intrinsic is selected, we can let isel take
care of selecting an LEA or other operation to do any address computation needed in this basic block.

I've also split the instruction into a 32-bit mode version and a 64-bit mode version so the implicit
use is properly sized based on the pointer. Without this we get comments in the assembly output about
killing eax and defing rax or vice versa depending on whether we define the instruction to use EAX/RAX.

llvm-svn: 357652

5 years ago[X86] Remove dead CHECK lines for a test. NFC
Craig Topper [Wed, 3 Apr 2019 23:28:18 +0000 (23:28 +0000)]
[X86] Remove dead CHECK lines for a test. NFC

llvm-svn: 357651

5 years ago[X86] Autogenerate checks. NFC
Craig Topper [Wed, 3 Apr 2019 23:28:11 +0000 (23:28 +0000)]
[X86] Autogenerate checks. NFC

llvm-svn: 357650

5 years agollvm-undname: Fix a crash-on-invalid
Nico Weber [Wed, 3 Apr 2019 23:27:18 +0000 (23:27 +0000)]
llvm-undname: Fix a crash-on-invalid

Found by oss-fuzz, fixes issue 13260 on oss-fuzz.

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

llvm-svn: 357649

5 years agollvm-undame: Fix an assert-on-invalid
Nico Weber [Wed, 3 Apr 2019 23:23:32 +0000 (23:23 +0000)]
llvm-undame: Fix an assert-on-invalid

Found by oss-fuzz, fixes issue 12432 on os-fuzz.

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

llvm-svn: 357648

5 years agollvm-undname: Fix an assert-on-invalid
Nico Weber [Wed, 3 Apr 2019 23:19:39 +0000 (23:19 +0000)]
llvm-undname: Fix an assert-on-invalid

Found by oss-fuzz, fixes issues 12428 and 12429 on oss-fuzz.

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

llvm-svn: 357647

5 years agollvm-undname: Fix a crash-on-invalid
Nico Weber [Wed, 3 Apr 2019 23:15:56 +0000 (23:15 +0000)]
llvm-undname: Fix a crash-on-invalid

Found by oss-fuzz, fixes issues 12435 and 12438 on oss-fuzz.

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

llvm-svn: 357646

5 years agollvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors
Nico Weber [Wed, 3 Apr 2019 23:14:33 +0000 (23:14 +0000)]
llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors

These are variant 4, cf
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1851
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1880
and gcc seems to sometimes emit them still.

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

llvm-svn: 357645

5 years ago[x86] fold shuffles of h-ops that have an undef operand
Sanjay Patel [Wed, 3 Apr 2019 22:40:35 +0000 (22:40 +0000)]
[x86] fold shuffles of h-ops that have an undef operand

If an operand is undef, we can assume it's the same as the
other operand.

llvm-svn: 357644

5 years agoadd periods
Amy Huang [Wed, 3 Apr 2019 22:19:07 +0000 (22:19 +0000)]
add periods

llvm-svn: 357643

5 years ago[x86] eliminate movddup of horizontal op
Sanjay Patel [Wed, 3 Apr 2019 22:15:29 +0000 (22:15 +0000)]
[x86] eliminate movddup of horizontal op

This pattern would show up as a regression if we more
aggressively convert vector FP ops to scalar ops.

There's still a missed optimization for the v4f64 legal
case (AVX) because we create that h-op with an undef operand.
We should probably just duplicate the operands for that
pattern to avoid trouble.

llvm-svn: 357642