platform/upstream/llvm.git
5 years ago[WebAssembly] Support imports from custom module names
Sam Clegg [Fri, 1 Feb 2019 02:29:57 +0000 (02:29 +0000)]
[WebAssembly] Support imports from custom module names

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

This is only a first pass at supporting these custom import
modules.  In the long run we most likely want to treat these
kinds of symbols very differently.  For example, it should not
be possible to resolve such as symbol at static link type.

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

llvm-svn: 352828

5 years ago[opaque pointer types] Add a FunctionCallee wrapper type, and use it.
James Y Knight [Fri, 1 Feb 2019 02:28:03 +0000 (02:28 +0000)]
[opaque pointer types] Add a FunctionCallee wrapper type, and use it.

Recommit r352791 after tweaking DerivedTypes.h slightly, so that gcc
doesn't choke on it, hopefully.

Original Message:
The FunctionCallee type is effectively a {FunctionType*,Value*} pair,
and is a useful convenience to enable code to continue passing the
result of getOrInsertFunction() through to EmitCall, even once pointer
types lose their pointee-type.

Then:
- update the CallInst/InvokeInst instruction creation functions to
  take a Callee,
- modify getOrInsertFunction to return FunctionCallee, and
- update all callers appropriately.

One area of particular note is the change to the sanitizer
code. Previously, they had been casting the result of
`getOrInsertFunction` to a `Function*` via
`checkSanitizerInterfaceFunction`, and storing that. That would report
an error if someone had already inserted a function declaraction with
a mismatching signature.

However, in general, LLVM allows for such mismatches, as
`getOrInsertFunction` will automatically insert a bitcast if
needed. As part of this cleanup, cause the sanitizer code to do the
same. (It will call its functions using the expected signature,
however they may have been declared.)

Finally, in a small number of locations, callers of
`getOrInsertFunction` actually were expecting/requiring that a brand
new function was being created. In such cases, I've switched them to
Function::Create instead.

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

llvm-svn: 352827

5 years ago[ELF] Support --{,no-}allow-shlib-undefined
Fangrui Song [Fri, 1 Feb 2019 02:25:05 +0000 (02:25 +0000)]
[ELF] Support --{,no-}allow-shlib-undefined

Summary:
In ld.bfd/gold, --no-allow-shlib-undefined is the default when linking
an executable. This patch implements a check to error on undefined
symbols in a shared object, if all of its DT_NEEDED entries are seen.

Our approach resembles the one used in gold, achieves a good balance to
be useful but not too smart (ld.bfd traces all DSOs and emulates the
behavior of a dynamic linker to catch more cases).

The error is issued based on the symbol table, different from undefined
reference errors issued for relocations. It is most effective when there
are DSOs that were not linked with -z defs (e.g. when static sanitizers
runtime is used).

gold has a comment that some system libraries on GNU/Linux may have
spurious undefined references and thus system libraries should be
excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
story may have changed now but we make --allow-shlib-undefined the
default for now. Its interaction with -shared can be discussed in the
future.

Reviewers: ruiu, grimar, pcc, espindola

Reviewed By: ruiu

Subscribers: joerg, emaste, arichardson, llvm-commits

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

llvm-svn: 352826

5 years agoFix names of functions in TargetOptionsCommandFlags.h. NFC.
Sam Clegg [Fri, 1 Feb 2019 02:24:50 +0000 (02:24 +0000)]
Fix names of functions in TargetOptionsCommandFlags.h. NFC.

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

llvm-svn: 352825

5 years ago[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts
George Karpenkov [Fri, 1 Feb 2019 02:13:02 +0000 (02:13 +0000)]
[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts

Having an incorrect type for a cast causes the checker to incorrectly
dismiss the operation under ARC, leading to a false positive
use-after-release on the test.

rdar://47709885

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

llvm-svn: 352824

5 years agoMark __rela_iplt_{start,end} as weak.
Peter Collingbourne [Fri, 1 Feb 2019 00:43:31 +0000 (00:43 +0000)]
Mark __rela_iplt_{start,end} as weak.

Should fix non-lld links.

llvm-svn: 352823

5 years agoRevert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"
Akira Hatanaka [Fri, 1 Feb 2019 00:12:06 +0000 (00:12 +0000)]
Revert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"

This reverts commit r350920 as it is not clear whether we should force a
class to be returned in registers when copy and move constructors are
both deleted.

For more background, see the following discussion:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190128/259907.html

llvm-svn: 352822

5 years ago[x86] adjust test to show both add/inc options; NFC
Sanjay Patel [Fri, 1 Feb 2019 00:07:20 +0000 (00:07 +0000)]
[x86] adjust test to show both add/inc options; NFC

If we're optimizing for size, that overrides the subtarget
feature, so we would always produce 'inc' if we matched
this pattern.

llvm-svn: 352821

5 years ago[x86] add test for missed opportunity to use 'inc'; NFC
Sanjay Patel [Thu, 31 Jan 2019 23:46:58 +0000 (23:46 +0000)]
[x86] add test for missed opportunity to use 'inc'; NFC

Another pattern exposed in D57516.

llvm-svn: 352820

5 years ago[libFuzzer] make a test for exploding dfsan labels more agressive
Kostya Serebryany [Thu, 31 Jan 2019 23:43:54 +0000 (23:43 +0000)]
[libFuzzer] make a test for exploding dfsan labels more agressive

llvm-svn: 352819

5 years ago[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed...
Kostya Serebryany [Thu, 31 Jan 2019 23:43:00 +0000 (23:43 +0000)]
[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed into the backedge branch. Instrumenting these CMP instructions is almost always useless (and harmful) for fuzzing

llvm-svn: 352818

5 years agoGlobalISel: Fix MMO creation with non-power-of-2 mem size
Matt Arsenault [Thu, 31 Jan 2019 23:41:23 +0000 (23:41 +0000)]
GlobalISel: Fix MMO creation with non-power-of-2 mem size

It should probably just be mandatory for getTgtMemIntrinsic to return
the alignment.

llvm-svn: 352817

5 years agohwasan: Add __hwasan_init_static() function.
Peter Collingbourne [Thu, 31 Jan 2019 23:37:12 +0000 (23:37 +0000)]
hwasan: Add __hwasan_init_static() function.

This function initializes enough of the runtime to be able to run
instrumented code in a statically linked executable. It replaces
__hwasan_shadow_init() which wasn't doing enough initialization for
instrumented code that uses either TLS or IFUNC to work.

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

llvm-svn: 352816

5 years ago[libFuzzer][Windows] Temporarily disable value-profile-cmp2.test on Win
Jonathan Metzman [Thu, 31 Jan 2019 23:34:56 +0000 (23:34 +0000)]
[libFuzzer][Windows] Temporarily disable value-profile-cmp2.test on Win

Summary:
Temporarily disable value-profile-cmp2.test on Win.
https://reviews.llvm.org/D57465 causes the test to fail on Win.
However, it seems that the behavior of libFuzzer on Win was broken
before that patch. It crashes in the exit handler when not used with
ASAN. Prior to the patch, the crash handler would run, tricking the
test into thinking libFuzzer on Win had exited properly.

Reviewers: morehouse, vitalybuka

Reviewed By: morehouse

Subscribers: yln

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

llvm-svn: 352815

5 years agoRevert "Bump minimum toolchain version"
JF Bastien [Thu, 31 Jan 2019 23:29:39 +0000 (23:29 +0000)]
Revert "Bump minimum toolchain version"

A handful of bots are still breaking, either because I missed them in my audit,
they were offline, or something else. I'm contacting their authors, but I'll
revert for now and re-commit later.

llvm-svn: 352814

5 years ago[WebAssembly] Fix a regression selecting negative build_vector lanes
Thomas Lively [Thu, 31 Jan 2019 23:22:39 +0000 (23:22 +0000)]
[WebAssembly] Fix a regression selecting negative build_vector lanes

Summary:
The custom lowering introduced in rL352592 creates build_vector nodes
with negative i32 operands, but these operands did not meet the value
range constraints necessary to match build_vector nodes. This CL fixes
the issue by removing the unnecessary constraints.

Reviewers: aheejin

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

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

llvm-svn: 352813

5 years agoDeveloperPolicy: update toolchain with sample RFC / patch
JF Bastien [Thu, 31 Jan 2019 23:18:11 +0000 (23:18 +0000)]
DeveloperPolicy: update toolchain with sample RFC / patch

As was suggested when the policy originally went in.

llvm-svn: 352812

5 years agoBump minimum toolchain version
JF Bastien [Thu, 31 Jan 2019 23:13:10 +0000 (23:13 +0000)]
Bump minimum toolchain version

Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352811

5 years agoFixed hasLinkerPrivateGlobalPrefix treating StringRef as C String.
Wouter van Oortmerssen [Thu, 31 Jan 2019 23:03:48 +0000 (23:03 +0000)]
Fixed hasLinkerPrivateGlobalPrefix treating StringRef as C String.

Reviewers: jgravelle-google, sbc100

Subscribers: aheejin, llvm-commits

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

llvm-svn: 352810

5 years agoRe-disable pch-from-libclang.c after 352803, some buildbots are still unhappy
Nico Weber [Thu, 31 Jan 2019 22:57:52 +0000 (22:57 +0000)]
Re-disable pch-from-libclang.c after 352803, some buildbots are still unhappy

llvm-svn: 352809

5 years ago[RISCV] Add RV64F codegen support
Alex Bradbury [Thu, 31 Jan 2019 22:48:38 +0000 (22:48 +0000)]
[RISCV] Add RV64F codegen support

This requires a little extra work due tothe fact i32 is not a legal type. When
call lowering happens post-legalisation (e.g. when an intrinsic was inserted
during legalisation). A bitcast from f32 to i32 can't be introduced. This is
similar to the challenges with RV32D. To handle this, we introduce
target-specific DAG nodes that perform bitcast+anyext for f32->i64 and
trunc+bitcast for i64->f32.

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

llvm-svn: 352807

5 years ago[WebAssembly] MC: Fix for outputing wasm object to /dev/null
Sam Clegg [Thu, 31 Jan 2019 22:38:22 +0000 (22:38 +0000)]
[WebAssembly] MC: Fix for outputing wasm object to /dev/null

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

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

llvm-svn: 352806

5 years ago[x86] add test for missed opportunity to use 'inc'; NFC
Sanjay Patel [Thu, 31 Jan 2019 22:33:11 +0000 (22:33 +0000)]
[x86] add test for missed opportunity to use 'inc'; NFC

llvm-svn: 352805

5 years ago[ASTDump] Make template specialization tests more exact
Stephen Kelly [Thu, 31 Jan 2019 22:28:38 +0000 (22:28 +0000)]
[ASTDump] Make template specialization tests more exact

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 352804

5 years agoMake clang/test/Index/pch-from-libclang.c pass in more places
Nico Weber [Thu, 31 Jan 2019 22:15:32 +0000 (22:15 +0000)]
Make clang/test/Index/pch-from-libclang.c pass in more places

- fixes the test on macOS with LLVM_ENABLE_PIC=OFF
- together with D57343, gets the test to pass on Windows
- makes it run everywhere (it seems to just pass on Linux)

The main change is to pull out the resource directory computation into a
function shared by all 3 places that do it. In CIndexer.cpp, this now works no
matter if libclang is in lib/ or bin/ or statically linked to a binary in bin/.

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

llvm-svn: 352803

5 years ago[Hexagon] Rename textually included file from .h to .inc
Richard Trieu [Thu, 31 Jan 2019 21:58:42 +0000 (21:58 +0000)]
[Hexagon] Rename textually included file from .h to .inc

llvm-svn: 352802

5 years agoDo not copy long double and 128-bit fp format from aux target for AMDGPU
Yaxun Liu [Thu, 31 Jan 2019 21:57:51 +0000 (21:57 +0000)]
Do not copy long double and 128-bit fp format from aux target for AMDGPU

rC352620 caused regressions because it copied floating point format from
aux target.

floating point format decides whether extended long double is supported.
It is x86_fp80 on x86 but IEEE double on amdgcn.

Document usage of long doubel type in HIP programming guide
https://github.com/ROCm-Developer-Tools/HIP/pull/890

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

llvm-svn: 352801

5 years agoRevert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."
James Y Knight [Thu, 31 Jan 2019 21:51:58 +0000 (21:51 +0000)]
Revert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."

This reverts commit f47d6b38c7a61d50db4566b02719de05492dcef1 (r352791).

Seems to run into compilation failures with GCC (but not clang, where
I tested it). Reverting while I investigate.

llvm-svn: 352800

5 years ago[CUDA] add support for the new kernel launch API in CUDA-9.2+.
Artem Belevich [Thu, 31 Jan 2019 21:34:03 +0000 (21:34 +0000)]
[CUDA] add support for the new kernel launch API in CUDA-9.2+.

Instead of calling CUDA runtime to arrange function arguments,
the new API constructs arguments in a local array and the kernels
are launched with __cudaLaunchKernel().

The old API has been deprecated and is expected to go away
in the next CUDA release.

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

llvm-svn: 352799

5 years ago[CUDA] Propagate detected version of CUDA to cc1
Artem Belevich [Thu, 31 Jan 2019 21:32:24 +0000 (21:32 +0000)]
[CUDA] Propagate detected version of CUDA to cc1

..and use it to control that parts of CUDA compilation
that depend on the specific version of CUDA SDK.

This patch has a placeholder for a 'new launch API' support
which is in a separate patch. The list will be further
extended in the upcoming patch to support CUDA-10.1.

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

llvm-svn: 352798

5 years ago[clangd] A code action to swap branches of an if statement
Ilya Biryukov [Thu, 31 Jan 2019 21:30:05 +0000 (21:30 +0000)]
[clangd] A code action to swap branches of an if statement

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: llvm-commits, mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 352796

5 years agoFix compilation error with GCC after r352791.
James Y Knight [Thu, 31 Jan 2019 21:21:57 +0000 (21:21 +0000)]
Fix compilation error with GCC after r352791.

llvm-svn: 352795

5 years ago[EarlyCSE & MSSA] Cleanup special handling for removing MemoryAccesses.
Alina Sbirlea [Thu, 31 Jan 2019 21:12:41 +0000 (21:12 +0000)]
[EarlyCSE & MSSA] Cleanup special handling for removing MemoryAccesses.

Summary: Moving special handling to MemorySSAUpdater in D57199.

Reviewers: gberry, george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 352794

5 years ago[WebAssembly] Add bulk memory target feature
Thomas Lively [Thu, 31 Jan 2019 21:02:19 +0000 (21:02 +0000)]
[WebAssembly] Add bulk memory target feature

Summary: Also clean up some preexisting target feature code.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, jfb

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

llvm-svn: 352793

5 years ago[DAGCombine] Avoid CombineZExtLogicopShiftLoad if there is free ZEXT
Guozhi Wei [Thu, 31 Jan 2019 20:46:42 +0000 (20:46 +0000)]
[DAGCombine] Avoid CombineZExtLogicopShiftLoad if there is free ZEXT

This patch fixes pr39098.

For the attached test case, CombineZExtLogicopShiftLoad can optimize it to

t25: i64 = Constant<1099511627775>
t35: i64 = Constant<0>
  t0: ch = EntryToken
t57: i64,ch = load<(load 4 from `i40* undef`, align 8), zext from i32> t0, undef:i64, undef:i64
    t58: i64 = srl t57, Constant:i8<1>
  t60: i64 = and t58, Constant:i64<524287>
t29: ch = store<(store 5 into `i40* undef`, align 8), trunc to i40> t57:1, t60, undef:i64, undef:i64

But later visitANDLike transforms it to

t25: i64 = Constant<1099511627775>
t35: i64 = Constant<0>
  t0: ch = EntryToken
t57: i64,ch = load<(load 4 from `i40* undef`, align 8), zext from i32> t0, undef:i64, undef:i64
      t61: i32 = truncate t57
    t63: i32 = srl t61, Constant:i8<1>
  t64: i32 = and t63, Constant:i32<524287>
t65: i64 = zero_extend t64
    t58: i64 = srl t57, Constant:i8<1>
  t60: i64 = and t58, Constant:i64<524287>
t29: ch = store<(store 5 into `i40* undef`, align 8), trunc to i40> t57:1, t60, undef:i64, undef:i64

And it triggers CombineZExtLogicopShiftLoad again, causes a dead loop.

Both forms should generate same instructions, CombineZExtLogicopShiftLoad generated IR looks cleaner. But it looks more difficult to prevent visitANDLike to do the transform, so I prevent CombineZExtLogicopShiftLoad to do the transform if the ZExt is free.

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

llvm-svn: 352792

5 years ago[opaque pointer types] Add a FunctionCallee wrapper type, and use it.
James Y Knight [Thu, 31 Jan 2019 20:35:56 +0000 (20:35 +0000)]
[opaque pointer types] Add a FunctionCallee wrapper type, and use it.

The FunctionCallee type is effectively a {FunctionType*,Value*} pair,
and is a useful convenience to enable code to continue passing the
result of getOrInsertFunction() through to EmitCall, even once pointer
types lose their pointee-type.

Then:
- update the CallInst/InvokeInst instruction creation functions to
  take a Callee,
- modify getOrInsertFunction to return FunctionCallee, and
- update all callers appropriately.

One area of particular note is the change to the sanitizer
code. Previously, they had been casting the result of
`getOrInsertFunction` to a `Function*` via
`checkSanitizerInterfaceFunction`, and storing that. That would report
an error if someone had already inserted a function declaraction with
a mismatching signature.

However, in general, LLVM allows for such mismatches, as
`getOrInsertFunction` will automatically insert a bitcast if
needed. As part of this cleanup, cause the sanitizer code to do the
same. (It will call its functions using the expected signature,
however they may have been declared.)

Finally, in a small number of locations, callers of
`getOrInsertFunction` actually were expecting/requiring that a brand
new function was being created. In such cases, I've switched them to
Function::Create instead.

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

llvm-svn: 352791

5 years ago[cmake] Note future cleanup in comment. NFC
Shoaib Meenai [Thu, 31 Jan 2019 20:32:45 +0000 (20:32 +0000)]
[cmake] Note future cleanup in comment. NFC

CMake 3.6 introduced CMAKE_TRY_COMPILE_PLATFORM_VARIABLES, which solves
precisely the problem that necessitated init_user_prop, so we can switch
over whenever we bump our minimum CMake requirement.

llvm-svn: 352790

5 years ago[fuzzer] Use RawPrint instead of Printf for instrumentation warning
Jonathan Metzman [Thu, 31 Jan 2019 20:32:20 +0000 (20:32 +0000)]
[fuzzer] Use RawPrint instead of Printf for instrumentation warning

Summary:
Use RawPrint instead of Printf for instrumentation warning because
Printf doesn't work on Win when instrumentation is being
initialized (since OutputFile is not yet initialized).

Reviewers: kcc

Reviewed By: kcc

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

llvm-svn: 352789

5 years ago[CodeComplete] Propagate preferred types through parser in more cases
Ilya Biryukov [Thu, 31 Jan 2019 20:20:32 +0000 (20:20 +0000)]
[CodeComplete] Propagate preferred types through parser in more cases

Preferred types are used by code completion for ranking. This commit
considerably increases the number of points in code where those types
are propagated.

In order to avoid complicating signatures of Parser's methods, a
preferred type is kept as a member variable in the parser and updated
during parsing.

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

llvm-svn: 352788

5 years ago[MemorySSA] Extend removeMemoryAccess API to optimize MemoryPhis.
Alina Sbirlea [Thu, 31 Jan 2019 20:13:47 +0000 (20:13 +0000)]
[MemorySSA] Extend removeMemoryAccess API to optimize MemoryPhis.

Summary:
EarlyCSE needs to optimize MemoryPhis after an access is removed and has
special handling for it. This should be handled by MemorySSA instead.
The default remains that MemoryPhis are *not* optimized after an access
is removed.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, llvm-commits, Prazek

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

llvm-svn: 352787

5 years ago[DAG][SystemZ] Define unwrapAddress for PCREL_WRAPPER.
Nirav Dave [Thu, 31 Jan 2019 19:58:34 +0000 (19:58 +0000)]
[DAG][SystemZ] Define unwrapAddress for PCREL_WRAPPER.

Summary:
Like with X86, this allows better DAG-level alias analysis and
alignment inference for wrapped addresses.

Reviewers: jonpa, uweigand

Reviewed By: uweigand

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 352786

5 years ago[ELF] Return the section name when calling getSymbolName on a section symbol.
Matt Davis [Thu, 31 Jan 2019 19:42:21 +0000 (19:42 +0000)]
[ELF] Return the section name when calling getSymbolName on a section symbol.

Summary:
Previously, llvm-nm would report symbols for .debug and .note sections as: '?' with an empty  section name:

```
00000000 ?
00000000 ?
...
```

With this patch the output more closely resembles GNU nm:
```
00000000 N .debug_abbrev
00000000 n .note.GNU-stack
...
```

This patch calls `getSectionName` for sections that belong to symbols of type `ELF::STT_SECTION`, which returns the name of the section from the section string table.

Reviewers: Bigcheese, davide, jhenderson

Reviewed By: davide, jhenderson

Subscribers: rupprecht, jhenderson, llvm-commits

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

llvm-svn: 352785

5 years ago[DAG] Aggressively cleanup dangling node in CombineZExtLogicopShiftLoad.
Nirav Dave [Thu, 31 Jan 2019 19:35:14 +0000 (19:35 +0000)]
[DAG] Aggressively cleanup dangling node in CombineZExtLogicopShiftLoad.

While dangling nodes will eventually be pruned when they are
considered, leaving them disables combines requiring single-use.

Reviewers: Carrot, spatel, craig.topper, RKSimon, efriedma

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 352784

5 years ago[Intrinsic] Expand SMULFIX to MUL, MULH[US], or [US]MUL_LOHI on vector arguments
Leonard Chan [Thu, 31 Jan 2019 19:15:37 +0000 (19:15 +0000)]
[Intrinsic] Expand SMULFIX to MUL, MULH[US], or [US]MUL_LOHI on vector arguments

r zero scale SMULFIX, expand into MUL which produces better code for X86.

For vector arguments, expand into MUL if SMULFIX is provided with a zero scale.
Otherwise, expand into MULH[US] or [US]MUL_LOHI.

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

llvm-svn: 352783

5 years agoRevert "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."
Craig Topper [Thu, 31 Jan 2019 19:05:22 +0000 (19:05 +0000)]
Revert "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."

This is causing a failure in chromium

llvm-svn: 352782

5 years agoFix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewe...
Marshall Clow [Thu, 31 Jan 2019 18:54:26 +0000 (18:54 +0000)]
Fix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewed as https://reviews.llvm.org/D57391 Thanks to Andrey Maksimov for the patch

llvm-svn: 352781

5 years ago[unittest] Fix scalar unit test.
Jonas Devlieghere [Thu, 31 Jan 2019 18:48:17 +0000 (18:48 +0000)]
[unittest] Fix scalar unit test.

The test was using ASSERT_EQ instead of ASSERT_STREQ which meant we were
comparing string addresses instead of the actual string. This caused the
test to fail with with the sanitizers enabled.

llvm-svn: 352780

5 years agoLower widenable_conditions in CGP
Philip Reames [Thu, 31 Jan 2019 18:45:46 +0000 (18:45 +0000)]
Lower widenable_conditions in CGP

This ensures that if we make it to the backend w/o lowering widenable_conditions first, that we generate correct code. Doing it in CGP - instead of isel - let's us fold control flow before hitting block local instruction selection.

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

llvm-svn: 352779

5 years ago[libFuzzer] relax a flaky test
Kostya Serebryany [Thu, 31 Jan 2019 18:40:12 +0000 (18:40 +0000)]
[libFuzzer] relax a flaky test

llvm-svn: 352778

5 years agoGlobalISel: Fix handling of vectors of pointers in clamp{Min,Max}NumElements
Matt Arsenault [Thu, 31 Jan 2019 18:01:49 +0000 (18:01 +0000)]
GlobalISel: Fix handling of vectors of pointers in clamp{Min,Max}NumElements

This avoids hitting the assert added in r352636 in a future commit.

llvm-svn: 352777

5 years ago[ADT] Fix a typo in isOSVersionLT that breaks the Micro version check
Bob Wilson [Thu, 31 Jan 2019 17:58:59 +0000 (17:58 +0000)]
[ADT] Fix a typo in isOSVersionLT that breaks the Micro version check

The original commit of this function (r129800 in 2011) had a typo where
part of the "Micro" version check was actually comparing against the "Minor"
version number.

llvm-svn: 352776

5 years agoTrim trailing whitespace. NFCI.
Simon Pilgrim [Thu, 31 Jan 2019 17:49:25 +0000 (17:49 +0000)]
Trim trailing whitespace. NFCI.

llvm-svn: 352775

5 years ago[X86][AVX] Fold concat(broadcast(x),broadcast(x)) -> broadcast(x)
Simon Pilgrim [Thu, 31 Jan 2019 17:48:35 +0000 (17:48 +0000)]
[X86][AVX] Fold concat(broadcast(x),broadcast(x)) -> broadcast(x)

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

llvm-svn: 352774

5 years ago[X86][AVX] insert_subvector(bitcast(v), bitcast(s), c1) -> bitcast(insert_subvector...
Simon Pilgrim [Thu, 31 Jan 2019 17:38:10 +0000 (17:38 +0000)]
[X86][AVX] insert_subvector(bitcast(v), bitcast(s), c1) -> bitcast(insert_subvector(v,s,c2))

Similar to what we already do in DAGCombiner, but this version also handles bitcasts from types with different scalar sizes, which x86 is better at handling.

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

llvm-svn: 352773

5 years agoFix use of non-existing variable in crashlog.py
Shafik Yaghmour [Thu, 31 Jan 2019 17:33:17 +0000 (17:33 +0000)]
Fix use of non-existing variable in crashlog.py

Summary:
The method find_matching_slice(self) uses uuid_str on one of the paths but the variable does not exist and so this results in a NameError exception if we take that path.

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

llvm-svn: 352772

5 years ago[CallSite removal] Remove CallSite uses from InstCombine.
Craig Topper [Thu, 31 Jan 2019 17:23:29 +0000 (17:23 +0000)]
[CallSite removal] Remove CallSite uses from InstCombine.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 352771

5 years agoRecommit "[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader"
Teresa Johnson [Thu, 31 Jan 2019 17:18:11 +0000 (17:18 +0000)]
Recommit "[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader"

Recommit of r352763 with fix for use after free.

llvm-svn: 352770

5 years agorevert r352766: [PatternMatch] add special-case uaddo matching for increment-by-one
Sanjay Patel [Thu, 31 Jan 2019 16:48:42 +0000 (16:48 +0000)]
revert r352766: [PatternMatch] add special-case uaddo matching for increment-by-one

Missed some regression test updates when testing this.

llvm-svn: 352769

5 years agoRevert "[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader"
Teresa Johnson [Thu, 31 Jan 2019 16:46:14 +0000 (16:46 +0000)]
Revert "[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader"

This reverts commit r352763.

Causing a couple bot failures, root cause pointed to by sanitizer bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/28909/steps/annotate/logs/stdio

Use after free. I understand the issue but will revert and test with fix
before recommitting.

llvm-svn: 352768

5 years ago[llvm-objcopy] Skip --localize-symbol for undefined symbols
Jordan Rupprecht [Thu, 31 Jan 2019 16:45:16 +0000 (16:45 +0000)]
[llvm-objcopy] Skip --localize-symbol for undefined symbols

Summary:
Include the symbol being defined in the list of requirements for using --localize-symbol.

This is used, for example, when someone is depending on two different projects that have the same (or close enough) method defined in each library, and using "-L sym" for a conflicting symbol in one of the libraries so that the definition from the other one is used. However, the library may have internal references to the symbol, which cause program crashes when those are used, i.e.:

```
$ cat foo.c
int foo() { return 5; }
$ cat bar.c
int foo();
int bar() { return 2 * foo(); }
$ cat foo2.c
int foo() { /* Safer implementation */ return 42; }
$ cat main.c
int bar();
int main() {
  __builtin_printf("bar = %d\n", bar());
  return 0;
}
$ ar rcs libfoo.a foo.o bar.o
$ ar rcs libfoo2.a foo2.o
# Picks the wrong foo() impl
$ clang main.o -lfoo -lfoo2 -L. -o main
# Picks the right foo() impl
$ objcopy -L foo libfoo.a && clang main.o -lfoo -lfoo2 -L. -o main
# Links somehow, but crashes at runtime
$ llvm-objcopy -L foo libfoo.a && clang main.o -lfoo -lfoo2 -L. -o main
```

Reviewers: jhenderson, alexshap, jakehehrlich, espindola

Subscribers: emaste, arichardson

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

llvm-svn: 352767

5 years ago[PatternMatch] add special-case uaddo matching for increment-by-one
Sanjay Patel [Thu, 31 Jan 2019 16:40:07 +0000 (16:40 +0000)]
[PatternMatch] add special-case uaddo matching for increment-by-one

This is the most important uaddo problem mentioned in PR31754:
https://bugs.llvm.org/show_bug.cgi?id=31754

We were failing to match the canonicalized pattern when it's an 'add 1' operation.
Pattern matching, however, shouldn't assume that we have canonicalized IR, so we
match 4 commuted variants of uaddo.

There's also a test with a crazy type to show that the existing CGP transform
based on this matcher is not limited by target legality checks, but that's a
different problem.

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

llvm-svn: 352766

5 years agolld-link: Allow mixing 'discard' and 'largest' comdat selections
Nico Weber [Thu, 31 Jan 2019 16:14:33 +0000 (16:14 +0000)]
lld-link: Allow mixing 'discard' and 'largest' comdat selections

cl.exe and clang-cl.exe put vftables in a 'discard' comdat when building with
RTTI disabled (/GR-) but in a 'largest' comdat when building with RTTI enabled.
To be able to link /GR- code with /GR code, lld-link needs to accept comdats
that have this type of comdat selection conflict.

For example, static libraries in the Visual Studio standard library are built
with /GR, and without this it's impossible to build client code with /GR- and
still link to the standard library.

link.exe also accepts merging 'discard' with 'largest', and it accepts merging
'largest' with any other selection type. lld-link is still a bit stricter since
it only allows merging 'largest' with 'discard' for symmetry.

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

llvm-svn: 352765

5 years ago[clangd] Append "(fix available)" to diagnostic message when fixes are present.
Eric Liu [Thu, 31 Jan 2019 16:09:25 +0000 (16:09 +0000)]
[clangd] Append "(fix available)" to diagnostic message when fixes are present.

Summary:
This would make diagnostic fixits more discoverable, especially for
plugins like YCM.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 352764

5 years ago[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader
Teresa Johnson [Thu, 31 Jan 2019 16:00:15 +0000 (16:00 +0000)]
[ThinLTO] Rename COMDATs for COFF when promoting/renaming COMDAT leader

Summary:
COFF requires that COMDAT name match that of the leader. When we promote
and rename an internal leader in ThinLTO due to an import, ensure we
subsequently rename the associated COMDAT. Similar to D31963 which did
this during ThinLTO module splitting.

Fixes PR40414.

Reviewers: pcc, inglorion

Subscribers: mehdi_amini, dexonsmith, dmajor, llvm-commits

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

llvm-svn: 352763

5 years ago[CGP] add more tests for uaddo; NFC
Sanjay Patel [Thu, 31 Jan 2019 15:48:46 +0000 (15:48 +0000)]
[CGP] add more tests for uaddo; NFC

llvm-svn: 352762

5 years agoAccomodate gcc 7.3.0's -Wdangling-else
Nico Weber [Thu, 31 Jan 2019 15:26:03 +0000 (15:26 +0000)]
Accomodate gcc 7.3.0's -Wdangling-else

llvm-svn: 352761

5 years ago[OpenCL] Fixed addr space manging test.
Anastasia Stulova [Thu, 31 Jan 2019 15:23:48 +0000 (15:23 +0000)]
[OpenCL] Fixed addr space manging test.

Fixed typo in the Filecheck directive and changed the
test to verify output correctly.

Fixes PR40029!

llvm-svn: 352760

5 years agogn build: Merge r352483
Nico Weber [Thu, 31 Jan 2019 15:23:02 +0000 (15:23 +0000)]
gn build: Merge r352483

llvm-svn: 352759

5 years agogn build: Merge r352681, r352739
Nico Weber [Thu, 31 Jan 2019 14:45:40 +0000 (14:45 +0000)]
gn build: Merge r352681, r352739

llvm-svn: 352758

5 years agoUpdate monorepo .arcconfig with new project callsign.
Ben Hamilton [Thu, 31 Jan 2019 14:34:59 +0000 (14:34 +0000)]
Update monorepo .arcconfig with new project callsign.

llvm-svn: 352757

5 years ago[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#3)
James Henderson [Thu, 31 Jan 2019 14:22:50 +0000 (14:22 +0000)]
[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#3)

This is the fourth (and final for now) of a series of patches
simplifying llvm-symbolizer tests. See r352752, r352753 and 352754 for
the previous ones. This patch splits out several more distinct test
cases from llvm-symbolizer.test into separate tests, and simplifies them
in various ways including:

1) Building a test case for spaces in path from source, rather than
   using a pre-canned binary. This allows deleting of said binary and the
   source it was built from.
2) Switching to specifying addresses and objects directly on the
   command-line rather than via stdin.

This also adds an explict test for the ability to specify a file and
address as a line in stdin, since the majority of the tests have been
migrated away from this approach, leaving this largely untested.

Reviewed by: dblaikie

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

llvm-svn: 352756

5 years agoRevert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of...
Eric Liu [Thu, 31 Jan 2019 14:20:02 +0000 (14:20 +0000)]
Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"

This reverts commit r352690. This causes clang to crash. Sent reproducer to the
author in the orginal commit.

llvm-svn: 352755

5 years ago[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#2)
James Henderson [Thu, 31 Jan 2019 14:17:33 +0000 (14:17 +0000)]
[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#2)

This is the third of a series of patches simplifying llvm-symbolizer
tests. See r352752 and r352753 for the previous two. This patch splits
out a number of distinct test cases from llvm-symbolizer.test into
separate tests, and simplifies them in various ways including:

1) using --obj/positional arguments for the input file and addresses
   instead of stdin,
2) using runtime-generated inputs rather than a pre-canned binary, and
3) testing more specifically (i.e. checking only what is interesting to
   the behaviour changed in the original commit for that test case).

This patch also removes the test case for using --obj. The
tools/llvm-symbolizer/basic.s test already tests this case. Finally,
this patch adds a simple test case to the demangle switch test case to
show that demangling happens by default.

See https://bugs.llvm.org/show_bug.cgi?id=40070#c1 for the motivation.

Reviewed by: dblaikie

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

llvm-svn: 352754

5 years ago[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#1)
James Henderson [Thu, 31 Jan 2019 14:11:17 +0000 (14:11 +0000)]
[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#1)

This is the second of a series of patches simplifying llvm-symbolizer
tests. See r352752 for the first. This one splits out 5 distinct test
cases from llvm-symbolizer.test into separate tests, and simplifies them
slightly by using --obj/positional arguments for the input file and
addresses instead of stdin.

See https://bugs.llvm.org/show_bug.cgi?id=40070#c1 for the motivation.

Reviewed by: dblaikie

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

llvm-svn: 352753

5 years ago[llvm-symbolizer][test] Simplify test input reading
James Henderson [Thu, 31 Jan 2019 14:04:47 +0000 (14:04 +0000)]
[llvm-symbolizer][test] Simplify test input reading

This change migrates most llvm-symbolizer tests away from reading input
via stdin and instead using --obj + positional arguments for the file
and addresses respectively, which makes the tests easier to read.

One exception is the test test/tools/llvm-symbolizer/pdb/pdb.test, which
was doing some manipulation on the input addresses. This patch
simplifies this somewhat, but it still reads from stdin.

More changes to follow to simplify/break-up other tests.

Reviewed by: dblaikie

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

llvm-svn: 352752

5 years ago[X86][AVX] Fold broadcast(bitcast(src)) -> bitcast(broadcast(src))
Simon Pilgrim [Thu, 31 Jan 2019 14:04:07 +0000 (14:04 +0000)]
[X86][AVX] Fold broadcast(bitcast(src)) -> bitcast(broadcast(src))

llvm-svn: 352751

5 years ago[CommandLine] Improve help text for cl::values style options
James Henderson [Thu, 31 Jan 2019 13:58:48 +0000 (13:58 +0000)]
[CommandLine] Improve help text for cl::values style options

In order to make an option value truly optional, both the ValueOptional
and an empty-named value are required. This empty-named value appears in
the command-line help text, which is not ideal.

This change improves the help text for these sort of options in a number
of ways:
1) ValueOptional options with an empty-named value now print their help
text twice: both without and then with '=<value>' after the name. The
latter version then lists the allowed values after it.
2) Empty-named values with no help text in ValueOptional options are not
listed in the permitted values.
3) Otherwise empty-named options are printed as =<empty> rather than
simply '='.
4) Option values without help text do not have the '-' separator
printed.

It also tweaks the llvm-symbolizer -functions help text to not print a
trailing ':' as that looks bad combined with 1) above.

Reviewed by: thopre, ruiu

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

llvm-svn: 352750

5 years ago[X86][AVX] Add PR34394 subvector broadcast test cases
Simon Pilgrim [Thu, 31 Jan 2019 13:32:09 +0000 (13:32 +0000)]
[X86][AVX] Add PR34394 subvector broadcast test cases

Tidyup check-prefixes at the same time

llvm-svn: 352749

5 years agoRevert "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 31 Jan 2019 13:31:33 +0000 (13:31 +0000)]
Revert "Support attribute used in member funcs of class templates"

This reverts commit 352740: broke swift build

llvm-svn: 352748

5 years agoRevert r352732: [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand
Jeremy Morse [Thu, 31 Jan 2019 12:44:14 +0000 (12:44 +0000)]
Revert r352732: [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand

This causes a failure on the following bot as well as our internal ones:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/23103

llvm-svn: 352747

5 years ago[llvm-strip] Add --strip-symbol
Eugene Leviant [Thu, 31 Jan 2019 12:16:20 +0000 (12:16 +0000)]
[llvm-strip] Add --strip-symbol

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

llvm-svn: 352746

5 years ago[X86] combineExtractWithShuffle - more aggressively peek through bitcasts
Simon Pilgrim [Thu, 31 Jan 2019 11:55:30 +0000 (11:55 +0000)]
[X86] combineExtractWithShuffle - more aggressively peek through bitcasts

Fixes regression introduced by rL352743

llvm-svn: 352745

5 years ago[LLDB] FreeBSD suppress compilation warning
David Carlier [Thu, 31 Jan 2019 11:54:58 +0000 (11:54 +0000)]
[LLDB] FreeBSD suppress compilation warning

Reviewers: labath, teemperor

Reviewed By: teemperor

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

M    source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

llvm-svn: 352744

5 years ago[X86][AVX] Enable AVX1 broadcasts in shuffle combining
Simon Pilgrim [Thu, 31 Jan 2019 11:41:10 +0000 (11:41 +0000)]
[X86][AVX] Enable AVX1 broadcasts in shuffle combining

Enables 32/64-bit scalar load broadcasts on AVX1 targets

The extractelement-load.ll regression will be fixed shortly in a followup commit.

llvm-svn: 352743

5 years ago[X86][AVX] Fold vt1 concat_vectors(vt2 undef, vt2 broadcast(x)) --> vt1 broadcast(x)
Simon Pilgrim [Thu, 31 Jan 2019 11:15:05 +0000 (11:15 +0000)]
[X86][AVX] Fold vt1 concat_vectors(vt2 undef, vt2 broadcast(x)) --> vt1 broadcast(x)

If we're not inserting the broadcast into the lowest subvector then we can avoid the insertion by just performing a larger broadcast.

Avoids a regression when we enable AVX1 broadcasts in shuffle combining

llvm-svn: 352742

5 years ago[clang-tidy] refactor bugprone-exception-escape analysis into class
Jonas Toth [Thu, 31 Jan 2019 10:46:37 +0000 (10:46 +0000)]
[clang-tidy] refactor bugprone-exception-escape analysis into class

Summary:
The check `bugprone-exception-escape` does an AST-based analysis to determine
if a function might throw an exception and warns based on that information.
The analysis part is refactored into a standalone class similiar to
`ExprMutAnalyzer` that is generally useful.
I intent to use that class in a new check to automatically introduce `noexcept`
if possible.

Reviewers: aaron.ballman, alexfh, hokein, baloghadamsoftware, lebedev.ri

Reviewed By: baloghadamsoftware, lebedev.ri

Subscribers: lebedev.ri, mgorny, xazax.hun, rnkovacs, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 352741

5 years agoSupport attribute used in member funcs of class templates
Rafael Auler [Thu, 31 Jan 2019 09:38:31 +0000 (09:38 +0000)]
Support attribute used in member funcs of class templates

Summary:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

llvm-svn: 352740

5 years agoDefault lowering for experimental.widenable.condition
Max Kazantsev [Thu, 31 Jan 2019 09:10:17 +0000 (09:10 +0000)]
Default lowering for experimental.widenable.condition

Introduces a pass that provides default lowering strategy for the
`experimental.widenable.condition` intrinsic, replacing all its uses with
`i1 true`.

Differential Revision: https://reviews.llvm.org/D56096
Reviewed By: reames

llvm-svn: 352739

5 years agoTest commit. NFCI.
Yevgeny Rouban [Thu, 31 Jan 2019 08:49:20 +0000 (08:49 +0000)]
Test commit. NFCI.

llvm-svn: 352738

5 years ago[ARM] Thumb2: ConstantMaterializationCost
Sjoerd Meijer [Thu, 31 Jan 2019 08:38:06 +0000 (08:38 +0000)]
[ARM] Thumb2: ConstantMaterializationCost

Constants can also be materialised using the negated value and a MVN, and this
case seem to have been missed for Thumb2. To check the constant materialisation
costs, we now call getT2SOImmVal twice, once for the original constant and then
also for its negated value, and this function checks if the constant can both
be splatted or rotated.

This was revealed by a test that optimises for minsize: instead of a LDR
literal pool load and having a literal pool entry, just a MVN with an immediate
is smaller (and also faster).

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

llvm-svn: 352737

5 years ago[SelectionDAG] Codesize: don't expand SHIFT to SHIFT_PARTS
Sjoerd Meijer [Thu, 31 Jan 2019 08:07:30 +0000 (08:07 +0000)]
[SelectionDAG] Codesize: don't expand SHIFT to SHIFT_PARTS

And instead just generate a libcall. My motivating example on ARM was a simple:

  shl i64 %A, %B

for which the code bloat is quite significant. For other targets that also
accept __int128/i128 such as AArch64 and X86, it is also beneficial for these
cases to generate a libcall when optimising for minsize. On these 64-bit targets,
the 64-bits shifts are of course unaffected because the SHIFT/SHIFT_PARTS
lowering operation action is not set to custom/expand.

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

llvm-svn: 352736

5 years agoFixup test after r352704 since it changes how paths may be emitted.
Douglas Yung [Thu, 31 Jan 2019 07:58:34 +0000 (07:58 +0000)]
Fixup test after r352704 since it changes how paths may be emitted.

On Unix/Mac OS X, normpath() returns the path unchanged (FileCheck), but
on case-insensitive filesystems (like NTFS on Windows), it converts the
path to lowercase (filecheck) which was causing the test to fail.

llvm-svn: 352735

5 years agoCommit tests for changes in revision D41940
Dmitry Venikov [Thu, 31 Jan 2019 07:38:19 +0000 (07:38 +0000)]
Commit tests for changes in revision D41940

llvm-svn: 352734

5 years agoRevert "[CMake] Unify scripts for generating VCS headers"
Petr Hosek [Thu, 31 Jan 2019 07:12:43 +0000 (07:12 +0000)]
Revert "[CMake] Unify scripts for generating VCS headers"

This reverts commits r352729 and r352731: this broke Sanitizer Windows bots

llvm-svn: 352733

5 years ago[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand
Kostya Serebryany [Thu, 31 Jan 2019 06:52:55 +0000 (06:52 +0000)]
[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand

llvm-svn: 352732

5 years ago[CMake] Migrate lldb to the new VCS script
Petr Hosek [Thu, 31 Jan 2019 06:47:10 +0000 (06:47 +0000)]
[CMake] Migrate lldb to the new VCS script

This was accidentaly omitted from r352729 and broke lldb bots.

llvm-svn: 352731

5 years ago[InstCombine] Missed optimization in math expression: simplify calls exp functions
Dmitry Venikov [Thu, 31 Jan 2019 06:28:10 +0000 (06:28 +0000)]
[InstCombine] Missed optimization in math expression: simplify calls exp functions

Summary: This patch enables folding following expressions under -ffast-math flag: exp(X) * exp(Y) -> exp(X + Y), exp2(X) * exp2(Y) -> exp2(X + Y). Motivation: https://bugs.llvm.org/show_bug.cgi?id=35594

Reviewers: hfinkel, spatel, efriedma, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 352730

5 years ago[CMake] Unify scripts for generating VCS headers
Petr Hosek [Thu, 31 Jan 2019 06:21:01 +0000 (06:21 +0000)]
[CMake] Unify scripts for generating VCS headers

Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang. They were both similar, but
different. They were both broken in their own ways, for example the one
used by Clang didn't properly handle monorepo resulting in an incorrect
version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM and Clang, ensures that the new script supports both
monorepo and standalone SVN and Git setups, and removes the old scripts.

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

llvm-svn: 352729

5 years ago[SCEV] Prohibit SCEV transformations for huge SCEVs
Max Kazantsev [Thu, 31 Jan 2019 06:19:25 +0000 (06:19 +0000)]
[SCEV] Prohibit SCEV transformations for huge SCEVs

Currently SCEV attempts to limit transformations so that they do not work with
big SCEVs (that may take almost infinite compile time). But for this, it uses heuristics
such as recursion depth and number of operands, which do not give us a guarantee
that we don't actually have big SCEVs. This situation is still possible, though it is not
likely to happen. However, the bug PR33494 showed a bunch of simple corner case
tests where we still produce huge SCEVs, even not reaching big recursion depth etc.

This patch introduces a concept of 'huge' SCEVs. A SCEV is huge if its expression
size (intoduced in D35989) exceeds some threshold value. We prohibit optimizing
transformations if any of SCEVs we are dealing with is huge. This gives us a reliable
check that we don't spend too much time working with them.

As the next step, we can possibly get rid of old limiting mechanisms, such as recursion
depth thresholds.

Differential Revision: https://reviews.llvm.org/D35990
Reviewed By: reames

llvm-svn: 352728

5 years agoAdd namespace to some types.
Richard Trieu [Thu, 31 Jan 2019 04:33:11 +0000 (04:33 +0000)]
Add namespace to some types.

llvm-svn: 352725