platform/upstream/llvm.git
6 years agoRemove unneeded preprocessor condition.
Charles Davis [Wed, 8 Aug 2018 15:18:22 +0000 (15:18 +0000)]
Remove unneeded preprocessor condition.

llvm-svn: 339259

6 years ago[libunwind][include] Add SEH declarations to <unwind.h>.
Charles Davis [Wed, 8 Aug 2018 15:18:20 +0000 (15:18 +0000)]
[libunwind][include] Add SEH declarations to <unwind.h>.

Summary:
Make the `_Unwind_Exception` struct correct under SEH. Add a
declaration of `_GCC_specific_handler()`, which is used by SEH versions
of Itanium personality handlers to do common setup. Roughly corresponds
to Clang's D50380.

Reviewers: mstorsjo, rnk, compnerd, smeenai

Subscribers: christof, chrib, cfe-commits, llvm-commits

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

llvm-svn: 339258

6 years ago[CodeGen] emit inline asm clobber list warnings for reserved
Ties Stuij [Wed, 8 Aug 2018 15:15:59 +0000 (15:15 +0000)]
[CodeGen] emit inline asm clobber list warnings for reserved

Summary:
Currently, in line with GCC, when specifying reserved registers like sp or pc on an inline asm() clobber list, we don't always preserve the original value across the statement. And in general, overwriting reserved registers can have surprising results.

For example:

```
extern int bar(int[]);

int foo(int i) {
  int a[i]; // VLA
  asm volatile(
      "mov r7, #1"
    :
    :
    : "r7"
  );

  return 1 + bar(a);
}
```

Compiled for thumb, this gives:
```
$ clang --target=arm-arm-none-eabi -march=armv7a -c test.c -o - -S -O1 -mthumb
...
foo:
        .fnstart
@ %bb.0:                                @ %entry
        .save   {r4, r5, r6, r7, lr}
        push    {r4, r5, r6, r7, lr}
        .setfp  r7, sp, #12
        add     r7, sp, #12
        .pad    #4
        sub     sp, #4
        movs    r1, #7
        add.w   r0, r1, r0, lsl #2
        bic     r0, r0, #7
        sub.w   r0, sp, r0
        mov     sp, r0
        @APP
        mov.w   r7, #1
        @NO_APP
        bl      bar
        adds    r0, #1
        sub.w   r4, r7, #12
        mov     sp, r4
        pop     {r4, r5, r6, r7, pc}
...
```

r7 is used as the frame pointer for thumb targets, and this function needs to restore the SP from the FP because of the variable-length stack allocation a. r7 is clobbered by the inline assembly (and r7 is included in the clobber list), but LLVM does not preserve the value of the frame pointer across the assembly block.

This type of behavior is similar to GCC's and has been discussed on the bugtracker: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11807 . No consensus seemed to have been reached on the way forward.  Clang behavior has briefly been discussed on the CFE mailing (starting here: http://lists.llvm.org/pipermail/cfe-dev/2018-July/058392.html). I've opted for following Eli Friedman's advice to print warnings when there are reserved registers on the clobber list so as not to diverge from GCC behavior for now.

The patch uses MachineRegisterInfo's target-specific knowledge of reserved registers, just before we convert the inline asm string in the AsmPrinter.

If we find a reserved register, we print a warning:
```
repro.c:6:7: warning: inline asm clobber list contains reserved registers: R7 [-Winline-asm]
      "mov r7, #1"
      ^
```

Reviewers: eli.friedman, olista01, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: efriedma, eraman, kristof.beyls, llvm-commits

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

llvm-svn: 339257

6 years ago[AST] Check described template at structural equivalence check.
Balazs Keri [Wed, 8 Aug 2018 15:04:27 +0000 (15:04 +0000)]
[AST] Check described template at structural equivalence check.

Summary:
When checking a class or function the described class or function template
is checked too.
Split StructuralEquivalenceContext::Finish into multiple functions.
Improved test with symmetric check, added new tests.

Reviewers: martong, a.sidorin, a_sidorin, bruno

Reviewed By: martong, a.sidorin

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 339256

6 years ago[RISCV] Add mnemonic alias: move, sbreak and scall.
Alex Bradbury [Wed, 8 Aug 2018 14:53:45 +0000 (14:53 +0000)]
[RISCV] Add mnemonic alias: move, sbreak and scall.

Further improve compatibility with the GNU assembler.

Differential Revision: https://reviews.llvm.org/D50217
Patch by Kito Cheng.

llvm-svn: 339255

6 years ago[TargetLowering] BuildUDIV - Add support for divide by one (PR38477)
Simon Pilgrim [Wed, 8 Aug 2018 14:51:19 +0000 (14:51 +0000)]
[TargetLowering] BuildUDIV - Add support for divide by one (PR38477)

Provide a pass-through of the numerator for divide by one cases - this is the same approach we take in DAGCombiner::visitSDIVLike.

I investigated whether we could achieve this by magic MULHU/SRL values but nothing appeared to work as we don't have a way for MULHU(x,c) -> x

llvm-svn: 339254

6 years agoAdd missing REQUIRES x86 to tests.
Peter Smith [Wed, 8 Aug 2018 14:50:33 +0000 (14:50 +0000)]
Add missing REQUIRES x86 to tests.

Add REQUIRES to tests that fail when an x86 backend is not present.

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

llvm-svn: 339253

6 years ago[RISCV] Add InstAlias definitions for add[w], and, xor, or, sll[w], srl[w], sra[w...
Alex Bradbury [Wed, 8 Aug 2018 14:45:44 +0000 (14:45 +0000)]
[RISCV] Add InstAlias definitions for add[w], and, xor, or, sll[w], srl[w], sra[w], slt and sltu with immediate

Match the GNU assembler in supporting immediate operands for these
instructions even when the reg-reg mnemonic is used.

Differential Revision: https://reviews.llvm.org/D50046
Patch by Kito Cheng.

llvm-svn: 339252

6 years ago[ARM][NFC] Replaced tab-characters in test file vtrn.ll
Sjoerd Meijer [Wed, 8 Aug 2018 14:42:11 +0000 (14:42 +0000)]
[ARM][NFC] Replaced tab-characters in test file vtrn.ll

llvm-svn: 339251

6 years agoAdd a CommandGuide for llvm-objdump
Michael Trent [Wed, 8 Aug 2018 14:39:22 +0000 (14:39 +0000)]
Add a CommandGuide for llvm-objdump

Summary:
Add a CommandGuide for llvm-objdump summarizing its usage along with some
general context.

Reviewers: beanz

Reviewed By: beanz

Subscribers: Eugene.Zelenko, llvm-commits

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

llvm-svn: 339250

6 years ago[libFuzzer] Optimize handle unstable checks by reducing iterations
Max Moroz [Wed, 8 Aug 2018 14:32:46 +0000 (14:32 +0000)]
[libFuzzer] Optimize handle unstable checks by reducing iterations

Summary:
We only run the 3rd check if 2nd check finds unstable edges.
3rd UpdateUnstableCounters is now merged with ApplyUnstableCounters to only run 1 iteration.

Patch by Kyungtak Woo (@kevinwkt).

Reviewers: Dor1s, metzman, morehouse

Reviewed By: Dor1s, morehouse

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

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

llvm-svn: 339249

6 years ago[InstCombine] fold fneg into constant operand of fmul/fdiv
Sanjay Patel [Wed, 8 Aug 2018 14:29:08 +0000 (14:29 +0000)]
[InstCombine] fold fneg into constant operand of fmul/fdiv

This accounts for the missing IR fold noted in D50195. We don't need any fast-math to enable the negation transform.
FP negation can always be folded into an fmul/fdiv constant to eliminate the fneg.

I've limited this to one-use to ensure that we are eliminating an instruction rather than replacing fneg by a
potentially expensive fdiv or fmul.

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

llvm-svn: 339248

6 years ago[X86][SSE] PR38477 test is more cleanly tested with udiv instead of urem
Simon Pilgrim [Wed, 8 Aug 2018 14:11:44 +0000 (14:11 +0000)]
[X86][SSE] PR38477 test is more cleanly tested with udiv instead of urem

Making the test use urem relies on it calling udiv-like combines, but the real issue is with the udiv so we're better off using that directly.

llvm-svn: 339247

6 years ago[TargetLowering] Remove APInt divisor argument from BuildExactSDIV (NFCI).
Simon Pilgrim [Wed, 8 Aug 2018 13:59:44 +0000 (13:59 +0000)]
[TargetLowering] Remove APInt divisor argument from BuildExactSDIV (NFCI).

As requested in D50392, this is a minor refactor to BuildExactSDIV to stop taking the uniform constant APInt divisor and instead extract it locally.

I also cleanup the operands and valuetypes to better match BuildUDiv (and BuildSDIV in the near future).

llvm-svn: 339246

6 years agotest commit access
Ties Stuij [Wed, 8 Aug 2018 13:51:13 +0000 (13:51 +0000)]
test commit access

Summary: changing a few typos

Subscribers: llvm-commits

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

llvm-svn: 339245

6 years ago[analyzer] Fix a typo in `RegionStore.txt`.
Henry Wong [Wed, 8 Aug 2018 13:37:28 +0000 (13:37 +0000)]
[analyzer] Fix a typo in `RegionStore.txt`.

Summary: The typo of the description for default bindings can be confusing.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits, MTC

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

llvm-svn: 339244

6 years ago[InstCombine] De Morgan: sink 'not' into 'xor' (PR38446)
Roman Lebedev [Wed, 8 Aug 2018 13:31:19 +0000 (13:31 +0000)]
[InstCombine] De Morgan: sink 'not' into 'xor' (PR38446)

Summary:
https://rise4fun.com/Alive/IT3

Comes up in the [most ugliest]  `signed int` -> `signed char`  case of
`-fsanitize=implicit-conversion` (https://reviews.llvm.org/D50250)
Previously, we were stuck with `not`: {F6867736}
But now we are able to completely get rid of it: {F6867737}
(FIXME: why are we loosing the metadata? that seems wrong/strange.)

Here, we only want to do that it we will be able to completely
get rid of that 'not'.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: vsk, erichkeane, llvm-commits

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

llvm-svn: 339243

6 years ago[ARM] FP16: codegen support for VEXT
Sjoerd Meijer [Wed, 8 Aug 2018 13:26:38 +0000 (13:26 +0000)]
[ARM] FP16: codegen support for VEXT

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

llvm-svn: 339241

6 years ago[analyzer][UninitializedObjectChecker] Pointer/reference objects are dereferenced...
Kristof Umann [Wed, 8 Aug 2018 13:18:53 +0000 (13:18 +0000)]
[analyzer][UninitializedObjectChecker] Pointer/reference objects are dereferenced according to dynamic type

This patch fixed an issue where the dynamic type of pointer/reference
object was known by the analyzer, but wasn't obtained in the checker,
which resulted in false negatives. This should also increase reliability
of the checker, as derefencing is always done now according to the
dynamic type (even if that happens to be the same as the static type).

Special thanks to Artem Degrachev for setting me on the right track.

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

llvm-svn: 339240

6 years ago[ARM] FP16: vector vmov and vdup support
Sjoerd Meijer [Wed, 8 Aug 2018 13:11:31 +0000 (13:11 +0000)]
[ARM] FP16: vector vmov and vdup support

This adds codegen support for the vmov_n_f16 and vdup_n_f16 variants.

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

llvm-svn: 339238

6 years ago[analyzer][UninitializedObjectChecker] Fixed a false negative by no longer filtering...
Kristof Umann [Wed, 8 Aug 2018 12:23:02 +0000 (12:23 +0000)]
[analyzer][UninitializedObjectChecker] Fixed a false negative by no longer filtering out certain constructor calls

As of now, all constructor calls are ignored that are being called
by a constructor. The point of this was not to analyze the fields
of an object, so an uninitialized field wouldn't be reported
multiple times.

This however introduced false negatives when the two constructors
were in no relation to one another -- see the test file for a neat
example for this with singletons. This patch aims so fix this issue.

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

llvm-svn: 339237

6 years ago[ARM] FP16: vector VMUL variants
Sjoerd Meijer [Wed, 8 Aug 2018 10:27:34 +0000 (10:27 +0000)]
[ARM] FP16: vector VMUL variants

This adds codegen support for the vmul_lane_f16 and vmul_n_f16 variants.

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

llvm-svn: 339232

6 years ago[X86][SSE] Add divide-by-one exact sdiv vector test
Simon Pilgrim [Wed, 8 Aug 2018 10:16:43 +0000 (10:16 +0000)]
[X86][SSE] Add divide-by-one exact sdiv vector test

Based on PR38477, we need to ensure we're testing for divide-by-one in non-uniform vectors

llvm-svn: 339231

6 years ago[Wasm] Don't iterate over MachineBasicBlock::successors while erasing from it
Benjamin Kramer [Wed, 8 Aug 2018 10:13:19 +0000 (10:13 +0000)]
[Wasm] Don't iterate over MachineBasicBlock::successors while erasing from it

This will read out of bounds. Found by asan.

llvm-svn: 339230

6 years ago[TargetLowering] BuildUDIV - Early out for divide by one (PR38477)
Simon Pilgrim [Wed, 8 Aug 2018 10:00:54 +0000 (10:00 +0000)]
[TargetLowering] BuildUDIV - Early out for divide by one (PR38477)

We're not handling the UDIV by one special case properly - for now just early out.

llvm-svn: 339229

6 years ago[ARM] FP16: support vector INT_TO_FP and FP_TO_INT
Sjoerd Meijer [Wed, 8 Aug 2018 09:45:34 +0000 (09:45 +0000)]
[ARM] FP16: support vector INT_TO_FP and FP_TO_INT

This adds codegen support for the different vcvt_f16 variants.

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

llvm-svn: 339227

6 years ago[ASTImporter] Load external Decls when getting field index.
Balazs Keri [Wed, 8 Aug 2018 09:40:57 +0000 (09:40 +0000)]
[ASTImporter] Load external Decls when getting field index.

Summary:
At equality check of fields without name the index of fields is compared.
At determining the index of a field all fields of the parent context
should be loaded from external source to find the field at all.

Reviewers: a.sidorin, a_sidorin, r.stahl

Reviewed By: a.sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339226

6 years agoSupport inline asm with multiple 64bit output in 32bit GPR
Thomas Preud'homme [Wed, 8 Aug 2018 09:35:26 +0000 (09:35 +0000)]
Support inline asm with multiple 64bit output in 32bit GPR

Summary: Extend fix for PR34170 to support inline assembly with multiple output operands that do not naturally go in the register class it is constrained to (eg. double in a 32-bit GPR as in the PR).

Reviewers: bogner, t.p.northover, lattner, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: efriedma, tra, eraman, javed.absar, llvm-commits

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

llvm-svn: 339225

6 years agoAdded functionality to suggest FixIts for conversion of '->' to '.' and vice versa.
Kadir Cetinkaya [Wed, 8 Aug 2018 08:59:29 +0000 (08:59 +0000)]
Added functionality to suggest FixIts for conversion of '->' to '.' and vice versa.

Summary: Added functionality to suggest FixIts for conversion of '->' to '.' and vice versa.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: yvvan, ioeric, jkorous, arphaman, cfe-commits, kadircet

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

llvm-svn: 339224

6 years ago[NFC][InstCombine] Cleanup demorgan-sink-not-into-xor.ll test
Roman Lebedev [Wed, 8 Aug 2018 08:46:07 +0000 (08:46 +0000)]
[NFC][InstCombine] Cleanup demorgan-sink-not-into-xor.ll test

We are only going to do it if it is free to do.

llvm-svn: 339223

6 years ago[ARM] FP16: support the vector vmin and vmax variants
Sjoerd Meijer [Wed, 8 Aug 2018 07:20:15 +0000 (07:20 +0000)]
[ARM] FP16: support the vector vmin and vmax variants

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

llvm-svn: 339221

6 years ago[NFC] Add some tests on mustexec
Max Kazantsev [Wed, 8 Aug 2018 04:40:47 +0000 (04:40 +0000)]
[NFC] Add some tests on mustexec

llvm-svn: 339219

6 years ago[libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp.
Billy Robert O'Neal III [Wed, 8 Aug 2018 04:24:47 +0000 (04:24 +0000)]
[libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp.

llvm-svn: 339218

6 years ago[libunwind] Fix pointer-to-integer cast warnings on LLP64.
Charles Davis [Wed, 8 Aug 2018 04:21:24 +0000 (04:21 +0000)]
[libunwind] Fix pointer-to-integer cast warnings on LLP64.

Summary:
`long` is too short on LLP64. We have to use `intptr_t` to
avoid truncating pointers.

Reviewers: mstorsjo, rnk, compnerd, smeenai

Subscribers: christof, cfe-commits, llvm-commits

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

llvm-svn: 339217

6 years agoFixed a breaking test case
Balaji V. Iyer [Wed, 8 Aug 2018 02:47:28 +0000 (02:47 +0000)]
Fixed a breaking test case

llvm-svn: 339216

6 years ago[NFC][VFS] Fix typos in comments.
Volodymyr Sapsai [Wed, 8 Aug 2018 01:28:37 +0000 (01:28 +0000)]
[NFC][VFS] Fix typos in comments.

llvm-svn: 339215

6 years ago[libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue...
Billy Robert O'Neal III [Wed, 8 Aug 2018 00:49:02 +0000 (00:49 +0000)]
[libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue/rvalue.pass.cpp

(Still pending review at https://reviews.llvm.org/D47400 which has been open since may; will ask for forgiveness rather than permission :) )

llvm-svn: 339214

6 years ago[libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow...
Billy Robert O'Neal III [Wed, 8 Aug 2018 00:47:29 +0000 (00:47 +0000)]
[libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow.pass.cpp

I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere.

(Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) )

llvm-svn: 339213

6 years ago[libcxx] [test] Remove asserts that <cstddef> and <stdexcept> are included by <bitset>
Billy Robert O'Neal III [Wed, 8 Aug 2018 00:43:38 +0000 (00:43 +0000)]
[libcxx] [test] Remove asserts that <cstddef> and <stdexcept> are included by <bitset>

Reviewed as https://reviews.llvm.org/D50421

llvm-svn: 339212

6 years ago[MS Demangler] Properly handle backreferencing of special names.
Zachary Turner [Wed, 8 Aug 2018 00:43:31 +0000 (00:43 +0000)]
[MS Demangler] Properly handle backreferencing of special names.

Function template names are not stored in the backref table,
but non-template function names are.  The general pattern seems
to be that when you are demangling a symbol name, if the name
starts with '?' it does not go into the backreference table,
otherwise it does.  Note that this even handles the general case
of operator names (template or otherwise) not going into the
back-reference table, anonymous namespaces not going into the
backreference table, etc.

It's important that we apply this check *only* for the
unqualified portion of a name, and only for symbol names.
For example, this does not apply to type names (such as class
templates) and we need to make sure that these still do go
into the backref table.

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

llvm-svn: 339211

6 years agoPR38286: Don't crash when attempting to define a constructor for an
Richard Smith [Wed, 8 Aug 2018 00:42:42 +0000 (00:42 +0000)]
PR38286: Don't crash when attempting to define a constructor for an
incomplete class template.

llvm-svn: 339210

6 years ago[libcxx] [test] Add missing <stdexcept> in several tests.
Billy Robert O'Neal III [Wed, 8 Aug 2018 00:40:32 +0000 (00:40 +0000)]
[libcxx] [test] Add missing <stdexcept> in several tests.

Reviewed as https://reviews.llvm.org/D50420

llvm-svn: 339209

6 years ago[tablegen] Improve performance of -gen-register-info by replacing barely-necessary...
Daniel Sanders [Wed, 8 Aug 2018 00:19:59 +0000 (00:19 +0000)]
[tablegen] Improve performance of -gen-register-info by replacing barely-necessary std::map with a sorted vector

Summary:
This particular map is hardly ever queried and has a phased usage pattern (insert,
iterate, query, insert, iterate) so it's a good candidate for a sorted vector and
std::lower_bound.

This significantly reduces the run time of runTargetDesc() in some circumstances.
One llvm-tblgen invocation in my build improves the time spent in runTargetDesc()
from 9.86s down to 0.80s (~92%) without changing the output. The same invocation
also has 2GB less allocation churn.

Reviewers: bogner, rtereshin, aditya_nandakumar, volkan

Reviewed By: rtereshin

Subscribers: mgrang, dexonsmith, llvm-commits

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

llvm-svn: 339208

6 years ago[CodeGen] IncompleteArray Support
Balaji V. Iyer [Wed, 8 Aug 2018 00:01:21 +0000 (00:01 +0000)]
[CodeGen] IncompleteArray Support

Added code to support ArrayType that is not ConstantArray.

https://reviews.llvm.org/D49952
rdar://42476155

llvm-svn: 339207

6 years agoDelete a dead Function constructor (NFC)
Vedant Kumar [Tue, 7 Aug 2018 23:48:40 +0000 (23:48 +0000)]
Delete a dead Function constructor (NFC)

llvm-svn: 339206

6 years ago[StackFrame] Add more clarifying comments to StackFrameList (NFC)
Vedant Kumar [Tue, 7 Aug 2018 23:48:25 +0000 (23:48 +0000)]
[StackFrame] Add more clarifying comments to StackFrameList (NFC)

llvm-svn: 339205

6 years agoRemoved doxygen comment that doesn't fit to function signature
Raphael Isemann [Tue, 7 Aug 2018 23:47:05 +0000 (23:47 +0000)]
Removed doxygen comment that doesn't fit to function signature

llvm-svn: 339204

6 years ago[InstCombine] add tests for fneg fold including FMF; NFC
Sanjay Patel [Tue, 7 Aug 2018 23:24:25 +0000 (23:24 +0000)]
[InstCombine] add tests for fneg fold including FMF; NFC

llvm-svn: 339203

6 years agoRemoved duplicated commented-out code [NFC]
Raphael Isemann [Tue, 7 Aug 2018 23:24:24 +0000 (23:24 +0000)]
Removed duplicated commented-out code [NFC]

llvm-svn: 339202

6 years ago[analyzer] Avoid querying this-pointers for static-methods.
Matt Davis [Tue, 7 Aug 2018 23:13:28 +0000 (23:13 +0000)]
[analyzer] Avoid querying this-pointers for static-methods.

Summary:
The loop-widening code processes c++ methods looking for `this` pointers.  In
the case of static methods (which do not have `this` pointers), an assertion
was triggering.   This patch avoids trying to process `this` pointers for
static methods, and thus avoids triggering the assertion .

Reviewers: dcoughlin, george.karpenkov, NoQ

Reviewed By: NoQ

Subscribers: NoQ, xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits

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

llvm-svn: 339201

6 years ago[InstCombine] fix FP constant in test; NFC
Sanjay Patel [Tue, 7 Aug 2018 23:03:29 +0000 (23:03 +0000)]
[InstCombine] fix FP constant in test; NFC
Too many digits...

llvm-svn: 339200

6 years ago[VFS] Unify iteration code for VFSFromYamlDirIterImpl, NFC intended.
Volodymyr Sapsai [Tue, 7 Aug 2018 23:00:40 +0000 (23:00 +0000)]
[VFS] Unify iteration code for VFSFromYamlDirIterImpl, NFC intended.

First and subsequent iteration steps are similar, capture this similarity.

Reviewers: bruno, benlangmuir

Reviewed By: bruno

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 339199

6 years ago[Sema] Ensure an auto non-type template parameter is dependent
Erik Pilkington [Tue, 7 Aug 2018 22:59:02 +0000 (22:59 +0000)]
[Sema] Ensure an auto non-type template parameter is dependent

The dependent auto was getting stripped away while rebuilding the template
parameter type, so substitute it in.

rdar://41852459

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

llvm-svn: 339198

6 years ago[NFC] adding tests for Y - (X + Y) --> -X
Michael Berg [Tue, 7 Aug 2018 22:52:57 +0000 (22:52 +0000)]
[NFC] adding tests for Y - (X + Y) --> -X

llvm-svn: 339197

6 years ago[NFC] Improve auto-var-init alignment check
JF Bastien [Tue, 7 Aug 2018 22:43:44 +0000 (22:43 +0000)]
[NFC] Improve auto-var-init alignment check

We're not actually testing for alignment, we just want to know that whatever incoming alignment got propagated. Do that by capturing the alignment and checking that it's actually what's passed later, instead of hard-coding an alignment value.

llvm-svn: 339196

6 years ago[InstCombine] add tests for fneg of fmul/fdiv with constant; NFC
Sanjay Patel [Tue, 7 Aug 2018 22:30:43 +0000 (22:30 +0000)]
[InstCombine] add tests for fneg of fmul/fdiv with constant; NFC

llvm-svn: 339195

6 years ago[Coverage] Ignore 'unused' functions with non-zero execution counts
Vedant Kumar [Tue, 7 Aug 2018 22:25:36 +0000 (22:25 +0000)]
[Coverage] Ignore 'unused' functions with non-zero execution counts

Frontends emit 'unused' coverage mapping records for functions which are
provably unused in a TU. These unused records contain a single counter
with CounterKind::Zero. However, a function may be unused in one TU and
used in another. When this happens, prefer the records with a full set
of counters instead of arbitrarily picking the first loaded record.

There is no impact on the single-TU case. In the multiple-TU case, this
resolves issues causing a function to appear unused when it's not.

Testing: check-{llvm,clang,compiler-rt}

rdar://42981322

llvm-svn: 339194

6 years ago[Coverage] Delete getCounterMismatches, it's dead code (NFC)
Vedant Kumar [Tue, 7 Aug 2018 22:25:22 +0000 (22:25 +0000)]
[Coverage] Delete getCounterMismatches, it's dead code (NFC)

Exactly one counted region is inserted into a function record for every
region in a coverage mapping.

llvm-svn: 339193

6 years agoRefactor FileCheck to make it usable as an API
Aditya Nandakumar [Tue, 7 Aug 2018 21:58:49 +0000 (21:58 +0000)]
Refactor FileCheck to make it usable as an API

https://reviews.llvm.org/D50283
reviewed by bogner

This patch refactors FileCheck's implementation into support so it can
be used from C++ in other places (Unit tests).

llvm-svn: 339192

6 years ago[NFC] CGDecl factor out constant emission
JF Bastien [Tue, 7 Aug 2018 21:55:13 +0000 (21:55 +0000)]
[NFC] CGDecl factor out constant emission

The code is cleaner this way, and with some changes I'm playing with it makes sense to split it out so we can reuse it.

llvm-svn: 339191

6 years agoAMDGPU: Remove broken i16 ternary patterns
Jan Vesely [Tue, 7 Aug 2018 21:54:37 +0000 (21:54 +0000)]
AMDGPU: Remove broken i16 ternary patterns

Fixup test to check for GCN prefix
These patterns always zero extend the result even though it might need sign extension.
This has been broken since the addition of i16 support.
It has popped up in mad_sat(char) test since min(max()) combination is turned into v_med3, resulting in the following (incorrect) sequence:
        v_mad_i16 v2, v10, v9, v11
        v_med3_i32 v2, v2, v8, v7

Fixes mad_sat(char) piglit on VI.

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

llvm-svn: 339190

6 years agoAdd documentation for SBTarget::AppendImageSearchPath
Alexander Polyakov [Tue, 7 Aug 2018 21:41:59 +0000 (21:41 +0000)]
Add documentation for SBTarget::AppendImageSearchPath

llvm-svn: 339189

6 years agoFix one hard coded value I missed in r339185.
Douglas Yung [Tue, 7 Aug 2018 21:37:14 +0000 (21:37 +0000)]
Fix one hard coded value I missed in r339185.

llvm-svn: 339188

6 years agoClean up and simplify RequireCompleteType.
Richard Smith [Tue, 7 Aug 2018 21:35:41 +0000 (21:35 +0000)]
Clean up and simplify RequireCompleteType.

No functional change intended, except that we will now produce more
"declared here" notes.

llvm-svn: 339187

6 years ago[WebAssembly] Update SIMD binary arithmetic
Derek Schuff [Tue, 7 Aug 2018 21:24:01 +0000 (21:24 +0000)]
[WebAssembly] Update SIMD binary arithmetic

Add missing SIMD types (v2f64) and binary ops. Also adds
tablegen support for automatically prepending prefix byte to SIMD
opcodes.

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

Patch by Thomas Lively

llvm-svn: 339186

6 years agoMake test more robust by not checking hard coded debug info values, but instead check...
Douglas Yung [Tue, 7 Aug 2018 21:22:49 +0000 (21:22 +0000)]
Make test more robust by not checking hard coded debug info values, but instead check the relationships between them.

llvm-svn: 339185

6 years ago[lit] Disable shtest-timeout on Windows
Stella Stamenova [Tue, 7 Aug 2018 21:21:30 +0000 (21:21 +0000)]
[lit] Disable shtest-timeout on Windows

This test passes on Windows when using Python 3 but fails when using Python 2, so it needs more investigation before it can be enabled as the bots use Python 2.

llvm-svn: 339184

6 years ago[analyzer] [tests] Do not be verbose by default when updating reference results.
George Karpenkov [Tue, 7 Aug 2018 21:14:35 +0000 (21:14 +0000)]
[analyzer] [tests] Do not be verbose by default when updating reference results.

llvm-svn: 339183

6 years agoIf a function starts with line number 0, don't try to check if a breakpoint crossed...
Jim Ingham [Tue, 7 Aug 2018 21:09:55 +0000 (21:09 +0000)]
If a function starts with line number 0, don't try to check if a breakpoint crossed function boundaries.

clang doesn't use line number 0 (to mean artifically generated code) very often, but swift does it
quite often.  We were rejecting all by line breakpoints in functions that started at line 0.  But that's
a special marker so we can just not do this test in that case.

llvm-svn: 339182

6 years agoFix the Xcode project for the Core -> Utility moves.
Jim Ingham [Tue, 7 Aug 2018 21:05:34 +0000 (21:05 +0000)]
Fix the Xcode project for the Core -> Utility moves.

Scalar.{h,cpp}, RegisterValue.{h,cpp}, State.{h,cpp} were moved.

llvm-svn: 339181

6 years ago[lit, python] Change the order of the quotes in the lit cfg file
Stella Stamenova [Tue, 7 Aug 2018 20:58:02 +0000 (20:58 +0000)]
[lit, python] Change the order of the quotes in the lit cfg file
Double quotes are always correct in paths on windows while single quotes only work sometimes. By swapping the order of the quotes in the subsitution we guarantee that the quotes will be correct on Windows. Both sets work correctly on Linux in the test environment.

llvm-svn: 339180

6 years ago[lit, python3] Update lit error logging to work correctly in python3 and other test...
Stella Stamenova [Tue, 7 Aug 2018 20:54:38 +0000 (20:54 +0000)]
[lit, python3] Update lit error logging to work correctly in python3 and other test fixes

Summary:
In Python2 'unicode' is a distinct type from 'str', but in Python3 'unicode' does not exist and instead all 'str' objects are Unicode string. This change updates the logic in the test logging for lit to correctly process each of the types, and more importantly, to not just fail in Python3.

This change also reverses the use of quotes in several of the cfg files. By using '""' we are guaranteeing that the resulting path will work correctly on Windows while "''" only works correctly sometimes. This also fixes one of the failing tests.

Reviewers: asmith, zturner

Subscribers: stella.stamenova, delcypher, llvm-commits

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

llvm-svn: 339179

6 years ago[lldb-mi] Re-implement target-select command
Alexander Polyakov [Tue, 7 Aug 2018 20:45:46 +0000 (20:45 +0000)]
[lldb-mi] Re-implement target-select command

Now target-select uses SB API instead of HandleCommand.

This patch has been reviewed along with the r339175.

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

llvm-svn: 339178

6 years ago[Hexagon] Allow use of gather intrinsics even with no-packets
Krzysztof Parzyszek [Tue, 7 Aug 2018 20:33:47 +0000 (20:33 +0000)]
[Hexagon] Allow use of gather intrinsics even with no-packets

Vgather requires must be in a packet with a store, which contradicts
the no-packets feature. As a consequence, gather/scatter could not be
used with no-packets. Relax this, and allow gather packets as exceptions
to the no-packets requirements.

llvm-svn: 339177

6 years ago[InstSimplify] fold fsub+fadd with common operand
Sanjay Patel [Tue, 7 Aug 2018 20:32:55 +0000 (20:32 +0000)]
[InstSimplify] fold fsub+fadd with common operand

llvm-svn: 339176

6 years agoAdd new API to SBTarget class
Alexander Polyakov [Tue, 7 Aug 2018 20:23:57 +0000 (20:23 +0000)]
Add new API to SBTarget class

Summary:
The new API appends an image search path to the
target's path mapping list.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 339175

6 years ago[InstSimplify] fold fadd+fsub with common operand
Sanjay Patel [Tue, 7 Aug 2018 20:23:49 +0000 (20:23 +0000)]
[InstSimplify] fold fadd+fsub with common operand

llvm-svn: 339174

6 years ago[Local] Add dbg location on unreachable inst in changeToUnreachable
Anastasis Grammenos [Tue, 7 Aug 2018 20:21:56 +0000 (20:21 +0000)]
[Local] Add dbg location on unreachable inst in changeToUnreachable

As show in https://bugs.llvm.org/show_bug.cgi?id=37960
it would be desirable to have debug location in the unreachable
instruction.

Also adds a unti test for this function.

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

llvm-svn: 339173

6 years ago[WebAssembly] CFG sort support for exception handling
Heejin Ahn [Tue, 7 Aug 2018 20:19:23 +0000 (20:19 +0000)]
[WebAssembly] CFG sort support for exception handling

Summary:
This patch extends CFGSort pass to support exception handling. Once it
places a loop header, it does not place blocks that are not dominated by
the loop header until all the loop blocks are sorted. This patch extends
the same algorithm to exception 'catch' part, using the information
calculated by WebAssemblyExceptionInfo class.

Reviewers: dschuff, sunfish

Subscribers: sbc100, jgravelle-google, llvm-commits

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

llvm-svn: 339172

6 years ago[InstSimplify] fold fsub+fsub with common operand
Sanjay Patel [Tue, 7 Aug 2018 20:14:27 +0000 (20:14 +0000)]
[InstSimplify] fold fsub+fsub with common operand

llvm-svn: 339171

6 years ago[Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64
Martin Storsjo [Tue, 7 Aug 2018 20:02:40 +0000 (20:02 +0000)]
[Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64

This matches how GCC defines this struct.

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

llvm-svn: 339170

6 years agoUpdate msbuild integration warnings: Don't warn on /Zi and /X
Nico Weber [Tue, 7 Aug 2018 19:55:12 +0000 (19:55 +0000)]
Update msbuild integration warnings: Don't warn on /Zi and /X

We do need to map /Zi to /Z7 explicitly for msbuild as explained in this file,
but since /Zi is passed by default and since things transparently work fine
with it mapped to /Z7, we shouldn't produce effectively inactionable noise for
it.

Also don't warn on /X since clang-cl supports that (since r326357; the risk of
duplicating a bunch of clang-cl driver logic here).

https://reviews.llvm.org/D50398

llvm-svn: 339169

6 years ago[InstSimplify] add tests for fadd/fsub; NFC
Sanjay Patel [Tue, 7 Aug 2018 19:49:13 +0000 (19:49 +0000)]
[InstSimplify] add tests for fadd/fsub; NFC

Instcombine gets some, but not all, of these cases via
it's internal reassociation transforms. It fails in
all cases with vector types.

llvm-svn: 339168

6 years ago[Sema] Fix for crash on conditional operation with address_space pointer
Leonard Chan [Tue, 7 Aug 2018 19:43:53 +0000 (19:43 +0000)]
[Sema] Fix for crash on conditional operation with address_space pointer

Compiling the following causes clang to crash

```
char *cmp(__attribute__((address_space(1))) char *x, __attribute__((address_space(2))) char *y) {
  return x < y ? x : y;
}
```

with the message: "wrong cast for pointers in different address
spaces(must be an address space cast)!"

This is because during IR emission, the source and dest type for a
bitcast should not have differing address spaces.

This fix prints an error since the code shouldn't compile in the first place.

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

llvm-svn: 339167

6 years ago[SLP] Fix insert point for reused extract instructions.
Alexey Bataev [Tue, 7 Aug 2018 19:21:05 +0000 (19:21 +0000)]
[SLP] Fix insert point for reused extract instructions.

Summary:
Reworked the previously committed patch to insert shuffles for reused
extract element instructions in the correct position. Previous logic was
incorrect, and might lead to the crash with PHIs and EH instructions.

Reviewers: efriedma, javed.absar

Subscribers: llvm-commits

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

llvm-svn: 339166

6 years agolld-link: Take /SUBSYSTEM into account for automatic /ENTRY detection.
Nico Weber [Tue, 7 Aug 2018 19:10:28 +0000 (19:10 +0000)]
lld-link: Take /SUBSYSTEM into account for automatic /ENTRY detection.

If /subsystem:windows is passed, link.exe only looks for WinMain and wWinMain,
and if /subsystem:console is passed it only looks for main and wmain. lld-link
used to look for all 4 in both cases. This patch makes lld-link match
link.exe's behavior.

This requires that the subsystem is known by the time findDefaultEntry() gets
called. findDefaultEntry() is called before the main link loop, so that the
loop can mark the entry point as undefined. That means inferSubsystem() has to
be called above the main loop as well. This in turn means /subsystem: from
.drectve sections only has an effect on entry point inference for obj files
passed to lld-link directly (and not in obj files found later in .lib files).
link.exe seems to ignore /subsystem: for obj files from lib files completely
(while in lld it's ignored only for entry point detection but it still
overrides /subsystem: flags passed on the command line for the value that gets
written in the output file).

Also, if the subsytem isn't needed (e.g. when only writing a /def: lib file and
not writing a coff file), link.exe doesn't complain if the subsystem isn't
known, so both subsystem and entry point handling should be below the early
return lld has for that case.

Fixes PR36523.
https://reviews.llvm.org/D50316

llvm-svn: 339165

6 years ago[VFS] Emit an error when entry at root level uses a relative path.
Volodymyr Sapsai [Tue, 7 Aug 2018 19:05:41 +0000 (19:05 +0000)]
[VFS] Emit an error when entry at root level uses a relative path.

Entries with only a filename prevent us from building a file system tree and
cause the assertion

> Assertion failed: (NewParentE && "Parent entry must exist"), function uniqueOverlayTree, file clang/lib/Basic/VirtualFileSystem.cpp, line 1303.

Entries with a relative path are simply not discoverable during header search.

rdar://problem/28990865

Reviewers: bruno, benlangmuir

Reviewed By: bruno

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 339164

6 years ago[WebAssembly] Remove use of lld -flavor flag
Sam Clegg [Tue, 7 Aug 2018 18:55:41 +0000 (18:55 +0000)]
[WebAssembly] Remove use of lld -flavor flag

This flag is deprecated. The preferred way to select the lld
flavor is by calling it by one of its aliases.

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

llvm-svn: 339163

6 years ago[SampleFDO] Fix a bug in getOrCompHotCountThreshold/getOrCompColdCountThreshold
Wei Mi [Tue, 7 Aug 2018 18:13:10 +0000 (18:13 +0000)]
[SampleFDO] Fix a bug in getOrCompHotCountThreshold/getOrCompColdCountThreshold

getOrCompHotCountThreshold/getOrCompColdCountThreshold introduced in
https://reviews.llvm.org/D45377 contain a bad mistake and will only return 1 or 0
instead of the true hot/cold cutoff value. The patch fixes the mistake. But the
mistake seems not causing big performance difference according to internal server
benchmarks testing.

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

llvm-svn: 339162

6 years agoMisc module/dwarf logging improvements
Leonard Mosescu [Tue, 7 Aug 2018 18:00:30 +0000 (18:00 +0000)]
Misc module/dwarf logging improvements

This change improves the logging for the lldb.module category to note a few interesting cases:

1. Local object file found, but specs not matching
2. Local object file not found, using a placeholder module

The handling and logging for the cases wehre we fail to load compressed dwarf
symbols is also improved.

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

llvm-svn: 339161

6 years ago[lldb-mi] Re-implement MI HandleProcessEventStateSuspended.
Alexander Polyakov [Tue, 7 Aug 2018 17:55:26 +0000 (17:55 +0000)]
[lldb-mi] Re-implement MI HandleProcessEventStateSuspended.

Summary: Now this function uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 339160

6 years ago[LICM] Strengthen assume hoisting tests [NFC]
Philip Reames [Tue, 7 Aug 2018 17:54:36 +0000 (17:54 +0000)]
[LICM] Strengthen assume hoisting tests [NFC]

As requested in review of https://reviews.llvm.org/D50364

llvm-svn: 339159

6 years ago[WebAssembly] Force use of lld for test/Driver/wasm-toolchain.c(pp)
David Greene [Tue, 7 Aug 2018 17:44:43 +0000 (17:44 +0000)]
[WebAssembly] Force use of lld for test/Driver/wasm-toolchain.c(pp)

lld is the only supported linker that works for WebAssembly, so ensure
clang is using it for this test. This gets the tests passing when
configuring clang to use a different linker by default.

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

llvm-svn: 339158

6 years ago[SelectionDAG] When splitting scatter nodes during DAGCombine, create a serial chain...
Craig Topper [Tue, 7 Aug 2018 17:35:02 +0000 (17:35 +0000)]
[SelectionDAG] When splitting scatter nodes during DAGCombine, create a serial chain dependency.

Scatter could have multiple identical indices. We need to maintain sequential order. We get this right in LegalizeVectorTypes, but not in this code.

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

llvm-svn: 339157

6 years ago[SelectionDAG][X86][SystemZ] Add a generic nonvolatile_store/nonvolatile_load pattern...
Craig Topper [Tue, 7 Aug 2018 17:34:59 +0000 (17:34 +0000)]
[SelectionDAG][X86][SystemZ] Add a generic nonvolatile_store/nonvolatile_load pattern fragment in TargetSelectionDAG.td

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

llvm-svn: 339156

6 years agoAdd instructions for building LLDB on Mac OS X with CMake
Alex Langford [Tue, 7 Aug 2018 17:34:13 +0000 (17:34 +0000)]
Add instructions for building LLDB on Mac OS X with CMake

Summary:
There were previously no instructions for building LLDB on Mac OS X
with CMake. It's sufficiently close to building on Linux/FreeBSD/NetBSD that a
well-motivated developer could figure out the steps themselves. However, having
an explicit guide is better and can provide Mac OS X specific configurations
(e.g. LLDB_BUILD_FRAMEWORK).

Reviewers: labath, clayborg

Subscribers: emaste, krytarowski

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

llvm-svn: 339155

6 years agoCheck result after setting PC value.
Tatyana Krasnukha [Tue, 7 Aug 2018 16:46:11 +0000 (16:46 +0000)]
Check result after setting PC value.

llvm-svn: 339153

6 years ago[OPENMP] Mark variables captured in declare target region as implicitly
Alexey Bataev [Tue, 7 Aug 2018 16:14:36 +0000 (16:14 +0000)]
[OPENMP] Mark variables captured in declare target region as implicitly
declare target.

According to OpenMP 5.0, variables captured in lambdas in declare target
regions must be considered as implicitly declare target.

llvm-svn: 339152

6 years ago[RFC] Build LLVM-C.dll on MSVC that exports only the C API
David Bolvansky [Tue, 7 Aug 2018 15:54:50 +0000 (15:54 +0000)]
[RFC] Build LLVM-C.dll on MSVC that exports only the C API

Summary:
Hello!

This commit adds a LLVM-C target that is always built on MSVC. A big fat warning, this is my first cmake code ever so there is a fair bit of I-have-no-idea-what-I'm-doing going on here. Which is also why I placed it outside of llvm-shlib as I was afraid of breaking things of other people. Secondly llvm-shlib builds a LLVM.so which exports all symbols and then does a thin library that points to it, but on Windows we do not build a LLVM.dll so that would have complicated the code more.

The patch includes a python script that calls dumpbin.exe to get all of the symbols from the built libraries. It then grabs all the symbols starting with LLVM and generates the export file from those. The export file is then used to create the library just like the LLVM-C that is built on darwin.

Improvements that I need help with, to follow up this review.
  - Get cmake to make sure that dumpbin.exe is on the path and wire the full path to the script.
  - Use LLVM-C.dll when building llvm-c-test so we can verify that the symbols are exported.
  - Bundle the LLVM-C.dll with the windows installer.

Why do this?  I'm building a language frontend which is self-hosting, and on windows because of various tooling issues we have a problem of consuming the LLVM*.lib directly on windows. Me and the users of my projects using LLVM would be greatly helped by having LLVM-C.dll built and shipped by the Windows installer. Not only does LLVM takes forever to build, you have to run a extra python script in order to get the final DLL.

Any comments, thoughts or help is greatly appreciated.

Cheers, Jakob.

Patch by: Wallbraker (Jakob Bornecrantz)

Reviewers: compnerd, beanz, hans, smeenai

Reviewed By: beanz

Subscribers: xbolva00, bhelyer, Memnarch, rnk, fedor.sergeev, chapuni, smeenai, john.brawn, deadalnix, llvm-commits, mgorny

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

llvm-svn: 339151

6 years ago[OpenCL] Restore r338899 (reverted in r338904), fixing stack-use-after-return
Scott Linder [Tue, 7 Aug 2018 15:52:49 +0000 (15:52 +0000)]
[OpenCL] Restore r338899 (reverted in r338904), fixing stack-use-after-return

Always emit alloca in entry block for enqueue_kernel builtin.

Ensures the statically sized alloca is not converted to DYNAMIC_STACKALLOC
later because it is not in the entry block.

llvm-svn: 339150