platform/upstream/llvm.git
6 years ago[OpenMP] Change hint parameter type for critical to uint32_t
Jonathan Peyton [Fri, 7 Sep 2018 18:46:40 +0000 (18:46 +0000)]
[OpenMP] Change hint parameter type for critical to uint32_t

Add atomic hint flags to the enum.
The hint parameter type was changed to uint32_t in __kmpc_critical_with_hint()

Patch by Olga Malysheva

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

llvm-svn: 341694

6 years ago[OpenMP] Synchronization hint constants added to headers
Jonathan Peyton [Fri, 7 Sep 2018 18:45:13 +0000 (18:45 +0000)]
[OpenMP] Synchronization hint constants added to headers

ident flags reserved for atomic hints.
This patch adds omp_sync_hint_t to omp.h and omp_sync_hint_kind to omp_lib.h.
For better maintainability the list of macros for ident flags was replaced with
a enum. The new KMP_IDENT_ATOMIC_HINT_MASK was added to the enum to
support possible future atomic hints.

Also fix omp_lib.h.var to be under 72 chars again after 5.0 OpenMP Memory commit

Patch by Olga Malysheva

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

llvm-svn: 341693

6 years ago[PGO][CHR] Build/warning fix
Hiroshi Yamauchi [Fri, 7 Sep 2018 18:44:53 +0000 (18:44 +0000)]
[PGO][CHR] Build/warning fix

llvm-svn: 341692

6 years ago[RISCV] Fix crash in decoding instruction with unknown floating point rounding mode
Ana Pazos [Fri, 7 Sep 2018 18:43:43 +0000 (18:43 +0000)]
[RISCV] Fix crash in decoding instruction with unknown floating point rounding mode

Summary:
Instead of crashing in printFRMArg, decode and warn about invalid instruction.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 341691

6 years agoNFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.
Jim Ingham [Fri, 7 Sep 2018 18:43:04 +0000 (18:43 +0000)]
NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.

In a subsequent commit, I will need to expose the search depth
to the SB API's, so I'm moving this define into lldb-enumerations
where it will get added to the lldb module.

llvm-svn: 341690

6 years ago[Error] Reintroduce type validation in createFileError()
Alexandre Ganea [Fri, 7 Sep 2018 18:32:59 +0000 (18:32 +0000)]
[Error] Reintroduce type validation in createFileError()

This prevents from using ErrorSuccess as an argument to createFileError().

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

llvm-svn: 341689

6 years ago[llvm-dwp] Clean up tests X86/*.test
Fangrui Song [Fri, 7 Sep 2018 18:29:20 +0000 (18:29 +0000)]
[llvm-dwp] Clean up tests X86/*.test

llvm-svn: 341688

6 years ago[OpenMP] Initial implementation of OMP 5.0 Memory Management routines
Jonathan Peyton [Fri, 7 Sep 2018 18:25:49 +0000 (18:25 +0000)]
[OpenMP] Initial implementation of OMP 5.0 Memory Management routines

Implemented omp_alloc, omp_free, omp_{set,get}_default_allocator entries,
and OMP_ALLOCATOR environment variable.

Added support for HBW memory on Linux if libmemkind.so library is accessible
(dynamic library only, no support for static libraries).
Only used stable API (hbwmalloc) of the memkind library
though we may consider using experimental API in future.

The ICV def-allocator-var is implemented per implicit task similar to
place-partition-var.  In the absence of a requested allocator, the uses the
default allocator.

Predefined allocators (the only ones currently available) are made similar
for C and Fortran, - pointers (long integers) with values 1 to 8.

Patch by Andrey Churbanov

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

llvm-svn: 341687

6 years ago[RISCV] Fix AddressSanitizer heap-buffer-overflow in disassembling
Ana Pazos [Fri, 7 Sep 2018 18:23:19 +0000 (18:23 +0000)]
[RISCV] Fix AddressSanitizer heap-buffer-overflow in disassembling

Summary:
RISCVDisassembler should check number of bytes available before reading them.
Crash noticed when enabling -DLLVM_USE_SANITIZER=Address.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 341686

6 years ago[Scalar] Commit the correct patch, forgot `git add`.
Davide Italiano [Fri, 7 Sep 2018 18:22:27 +0000 (18:22 +0000)]
[Scalar] Commit the correct patch, forgot `git add`.

<rdar://problem/44229924>

llvm-svn: 341685

6 years agoNFC: remove magic bool in LoopIdiomRecognize
JF Bastien [Fri, 7 Sep 2018 18:17:59 +0000 (18:17 +0000)]
NFC: remove magic bool in LoopIdiomRecognize

Use an enum class instead.

llvm-svn: 341684

6 years agoAdd input files to the "prepare swig bindings" step.
Jim Ingham [Fri, 7 Sep 2018 18:10:26 +0000 (18:10 +0000)]
Add input files to the "prepare swig bindings" step.

This build phase had no inputs, so you always had to manually
delete LLDBWrapPython.cpp to get it to rebuild.  Add the correct
inputs.

llvm-svn: 341683

6 years ago[Scalar] Fix undefined behaviour when converting double to long.
Davide Italiano [Fri, 7 Sep 2018 18:03:43 +0000 (18:03 +0000)]
[Scalar] Fix undefined behaviour when converting double to long.

This showed up in an Ubsan build of lldb (inside the CFAbsoluteTime
data formatter). As we only care about the bit pattern, we just
round to the nearest double, and truncate to a size that fits
in ulonglong_t.

<rdar://problem/44229924>

llvm-svn: 341682

6 years ago[PGO][CHR] Small cleanup.
Hiroshi Yamauchi [Fri, 7 Sep 2018 18:00:58 +0000 (18:00 +0000)]
[PGO][CHR] Small cleanup.

Summary:
Do away with demangling. It wasn't really necessary.
Declared some local functions to be static.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 341681

6 years ago[Bindings][Go] Fixed go.test failure due to C-API argument type mismatch.
Kristina Brooks [Fri, 7 Sep 2018 17:33:43 +0000 (17:33 +0000)]
[Bindings][Go] Fixed go.test failure due to C-API argument type mismatch.

go.test was failing previously with error,
Command Output (stderr):
dibuilder.go:301: cannot use C.uint(t.Encoding) (type C.uint) as type
C.LLVMDWARFTypeEncoding in argument to func literal
This patch fixes the argument type.

Patch by Chirag (Chirag Patel)

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

llvm-svn: 341680

6 years agoutils/abtest: Refactor and add bisection method
Matthias Braun [Fri, 7 Sep 2018 17:08:44 +0000 (17:08 +0000)]
utils/abtest: Refactor and add bisection method

- Refactor/rewrite most of the code. Also make sure it passes
  pycodestyle/pyflakes now
- Add a new mode that performs bisection on the search space. This
  should be faster in the common case where there is only a small number
  of files or functions actually leading to failure.
  The previous sequential behavior can still be accessed via `--seq`.

llvm-svn: 341679

6 years ago[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an...
Craig Topper [Fri, 7 Sep 2018 16:58:57 +0000 (16:58 +0000)]
[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an store instruction.

This is the clang side of D51769. The llvm intrinsics now return two results instead of using an out parameter.

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

llvm-svn: 341678

6 years ago[X86] Change the addcarry and subborrow intrinsics to return 2 results and remove...
Craig Topper [Fri, 7 Sep 2018 16:58:39 +0000 (16:58 +0000)]
[X86] Change the addcarry and subborrow intrinsics to return 2 results and remove the pointer argument.

We should represent the store directly in IR instead. This gives the middle end a chance to remove it if it can see a load from the same address.

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

llvm-svn: 341677

6 years ago[X86] Use regular expressions to make test immune to register allocation changes.
Craig Topper [Fri, 7 Sep 2018 16:58:36 +0000 (16:58 +0000)]
[X86] Use regular expressions to make test immune to register allocation changes.

llvm-svn: 341676

6 years ago[X86] Teach X86DAGToDAGISel::foldLoadStoreIntoMemOperand to handle loads in operand...
Craig Topper [Fri, 7 Sep 2018 16:27:55 +0000 (16:27 +0000)]
[X86] Teach X86DAGToDAGISel::foldLoadStoreIntoMemOperand to handle loads in operand 1 of commutable operations.

Previously we only handled loads in operand 0, but nothing guarantees the load will be operand 0 for commutable operations.

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

llvm-svn: 341675

6 years ago[InstCombine] Fold (min/max ~X, Y) -> ~(max/min X, ~Y) when Y is freely invertible
Craig Topper [Fri, 7 Sep 2018 16:19:50 +0000 (16:19 +0000)]
[InstCombine] Fold (min/max ~X, Y) -> ~(max/min X, ~Y) when Y is freely invertible

If the ~X wasn't able to simplify above the max/min, we might be able to simplify it by moving it below the max/min.

I had to modify the ~(min/max ~X, Y) transform to prevent getting stuck in a loop when we saw the new ~(max/min X, ~Y) before the ~Y had been folded away to remove the new not.

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

llvm-svn: 341674

6 years ago[LV] Fix code gen for conditionally executed loads and stores
Anna Thomas [Fri, 7 Sep 2018 15:53:48 +0000 (15:53 +0000)]
[LV] Fix code gen for conditionally executed loads and stores

Fix a latent bug in loop vectorizer which generates incorrect code for
memory accesses that are executed conditionally. As pointed in review,
this bug definitely affects uniform loads and may affect conditional
stores that should have turned into scatters as well).

The code gen for conditionally executed uniform loads on architectures
that support masked gather instructions is broken.

Without this patch, we were unconditionally executing the *conditional*
load in the vectorized version.

This patch does the following:
1. Uniform conditional loads on architectures with gather support will
   have correct code generated. In particular, the cost model
   (setCostBasedWideningDecision) is fixed.
2. For the recipes which are handled after the widening decision is set,
   we use the isScalarWithPredication(I, VF) form which is added in the
   patch.

3. Fix the vectorization cost model for scalarization
   (getMemInstScalarizationCost): implement and use isPredicatedInst to
   identify *all* predicated instructions, not just scalar+predicated. So,
   now the cost for scalarization will be increased for maskedloads/stores
   and gather/scatter operations. In short, we should be choosing the
   gather/scatter in place of scalarization on archs where it is
   profitable.
4. We needed to weaken the assert in useEmulatedMaskMemRefHack.

Reviewers: Ayal, hsaito, mkuper

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

llvm-svn: 341673

6 years agoMachO: Change getString16() back to inline function
Tom Stellard [Fri, 7 Sep 2018 15:51:52 +0000 (15:51 +0000)]
MachO: Change getString16() back to inline function

This was accidentally changed in r341670.

llvm-svn: 341672

6 years ago[asan] Update a vector's storage annotation during destruction. Reviewed as https...
Marshall Clow [Fri, 7 Sep 2018 15:47:59 +0000 (15:47 +0000)]
[asan] Update a vector's storage annotation during destruction. Reviewed as https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch.

llvm-svn: 341671

6 years agoMachO: Fix out-of-bounds memory access in getString16
Tom Stellard [Fri, 7 Sep 2018 15:42:01 +0000 (15:42 +0000)]
MachO: Fix out-of-bounds memory access in getString16

Summary:
This fixes the following tests when gcc is compiled with gcc8:

lld :: mach-o/do-not-emit-unwind-fde-arm64.yaml
lld :: mach-o/eh-frame-relocs-arm64.yaml

llvm.org/PR38096

Reviewers: lhames, kledzik, javed.absar

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 341670

6 years agoHot cold splitting pass
Aditya Kumar [Fri, 7 Sep 2018 15:03:49 +0000 (15:03 +0000)]
Hot cold splitting pass

Find cold blocks based on profile information (or optionally with static analysis).
Forward propagate profile information to all cold-blocks.
Outline a cold region.
Set calling conv and prof hint for the callsite of the outlined function.

Worked in collaboration with: Sebastian Pop <s.pop@samsung.com>
Differential Revision: https://reviews.llvm.org/D50658

llvm-svn: 341669

6 years agoRevert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."
Alexey Bataev [Fri, 7 Sep 2018 14:50:25 +0000 (14:50 +0000)]
Revert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."

Still need the RTTI for NVPTX target to pass sema checks.

llvm-svn: 341668

6 years ago[ARC] Make char unsigned by default
Alexander Polyakov [Fri, 7 Sep 2018 14:45:32 +0000 (14:45 +0000)]
[ARC] Make char unsigned by default

Summary: This patch specifies 'char' default sign on ARC.

Reviewers: tatyana-krasnukha, clayborg

Reviewed By: tatyana-krasnukha, clayborg

Subscribers: clayborg, lldb-commits

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

llvm-svn: 341667

6 years ago[InstCombine] Do not fold scalar ops over select with vector condition.
Florian Hahn [Fri, 7 Sep 2018 14:40:06 +0000 (14:40 +0000)]
[InstCombine] Do not fold scalar ops over select with vector condition.

If OtherOpT or OtherOpF have scalar types and the condition is a vector,
we would create an invalid select.

Reviewers: spatel, john.brawn, mssimpso, craig.topper

Reviewed By: spatel

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

llvm-svn: 341666

6 years ago[CodeComplete] Clearly distinguish signature help and code completion.
Ilya Biryukov [Fri, 7 Sep 2018 14:04:39 +0000 (14:04 +0000)]
[CodeComplete] Clearly distinguish signature help and code completion.

Summary:
Code completion in clang is actually a mix of two features:
- Code completion is a familiar feature. Results are exposed via the
  CodeCompleteConsumer::ProcessCodeCompleteResults callback.
- Signature help figures out if the current expression is an argument of
  some function call and shows corresponding signatures if so.
  Results are exposed via CodeCompleteConsumer::ProcessOverloadCandidates.

This patch refactors the implementation to untangle those two from each
other and makes some naming tweaks to avoid confusion when reading the
code.

The refactoring is required for signature help fixes, see D51038.

The only intended behavior change is the order of callbacks.
ProcessOverloadCandidates is now called before ProcessCodeCompleteResults.

Reviewers: sammccall, kadircet

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341660

6 years ago[DebugInfo] Handle stack slot offsets for spilled sub-registers in LDV
David Stenberg [Fri, 7 Sep 2018 13:54:07 +0000 (13:54 +0000)]
[DebugInfo] Handle stack slot offsets for spilled sub-registers in LDV

Summary:
Extend LDV so that stack slot offsets for spilled sub-registers
are added to the emitted debug locations. This is accomplished
by querying InstrInfo::getStackSlotRange().

With this change, LDV will add a DW_OP_plus_uconst operation to
the expression if a sub-register is spilled. Later on, PEI will
add an offset operation for the stack slot, meaning that we will
get expressions of the forms:

 * {DW_OP_constu #fp-offset, DW_OP_minus,
    DW_OP_plus_uconst #subreg-offset}

 * {DW_OP_plus_const #fp-offset,
    DW_OP_minus, DW_OP_plus_uconst #subreg-offset}

The two offset operations should ideally be merged.

Reviewers: rnk, aprantl, stoklund

Reviewed By: aprantl

Subscribers: dblaikie, bjope, nemanjai, JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 341659

6 years agoAdd support for getRegisterByName.
Sid Manning [Fri, 7 Sep 2018 13:36:21 +0000 (13:36 +0000)]
Add support for getRegisterByName.

Support required to build the Hexagon Linux kernel.

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

llvm-svn: 341658

6 years ago[X86][SSE] Add additional fadd/fsub(x, bitcast_fneg(y)) tests with different integer...
Simon Pilgrim [Fri, 7 Sep 2018 13:27:07 +0000 (13:27 +0000)]
[X86][SSE] Add additional fadd/fsub(x, bitcast_fneg(y)) tests with different integer bitwidths

llvm-svn: 341657

6 years ago[libclang] Return the proper pointee type for 'auto' deduced to pointer
Ivan Donchevskii [Fri, 7 Sep 2018 13:23:51 +0000 (13:23 +0000)]
[libclang] Return the proper pointee type for 'auto' deduced to pointer

Currently the resulting type is always invalid in such case.

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

llvm-svn: 341656

6 years agoDifferential Revision: https://reviews.llvm.org/D50246
Kristina Brooks [Fri, 7 Sep 2018 13:03:31 +0000 (13:03 +0000)]
Differential Revision: https://reviews.llvm.org/D50246

[RISCV] Add support for computing sysroot for riscv32-unknown-elf

Extends r338385 to allow the driver to compute the sysroot when an explicit path is not provided. This allows the linker to find C runtime files and the correct include directory for header files.

Patch by lewis-revill (Lewis Revill)

llvm-svn: 341655

6 years agoReland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler
Nico Weber [Fri, 7 Sep 2018 12:47:02 +0000 (12:47 +0000)]
Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler

The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
<stdin>:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' treated as the '/U' option [-Wslash-u-filename]

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

llvm-svn: 341654

6 years agoFix for https://bugs.llvm.org/show_bug.cgi?id=38839:
Andrey Churbanov [Fri, 7 Sep 2018 12:22:04 +0000 (12:22 +0000)]
Fix for https://bugs.llvm.org/show_bug.cgi?id=38839:

Changed style of declarations to be less than 72 char each.

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

llvm-svn: 341653

6 years ago[DAGCombiner] foldBitcastedFPLogic - Add basic vector support
Simon Pilgrim [Fri, 7 Sep 2018 12:13:45 +0000 (12:13 +0000)]
[DAGCombiner] foldBitcastedFPLogic - Add basic vector support

Add support for bitcasts from float type to an integer type of the same element bitwidth.

There maybe cases where we need to support different widths (e.g. as SSE __m128i is treated as v2i64) - but I haven't seen cases of this in the wild yet.

llvm-svn: 341652

6 years ago[NewGVN] Mark function as changed if we erase instructions.
Florian Hahn [Fri, 7 Sep 2018 11:41:34 +0000 (11:41 +0000)]
[NewGVN] Mark function as changed if we erase instructions.

Currently eliminateInstructions only returns true if any instruction got
replaced. In the test case for this patch, we eliminate the trivially
dead calls, for which eliminateInstructions not do a replacement and the
function is not marked as changed, which is why the inliner crashes
while traversing the call graph.

Alternatively we could also change eliminateInstructions to return true
in case we mark instructions for deletion, but that's slightly more code
and doing it at the place where the replacement happens seems safer.

Fixes PR37517.

Reviewers: davide, mcrosier, efriedma, bjope

Reviewed By: bjope

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

llvm-svn: 341651

6 years ago[X86][SSE] Add fadd/fsub(x, bitcast_fneg(y)) tests
Simon Pilgrim [Fri, 7 Sep 2018 11:24:43 +0000 (11:24 +0000)]
[X86][SSE] Add fadd/fsub(x, bitcast_fneg(y)) tests

Show missing vector support

llvm-svn: 341650

6 years ago[dsymutil] Prevent non-determinism due to threading.
Jonas Devlieghere [Fri, 7 Sep 2018 10:29:22 +0000 (10:29 +0000)]
[dsymutil] Prevent non-determinism due to threading.

Before this patch, analyzeContext called getCanonicalDIEOffset(), for
which the result depends on the timings of the setCanonicalDIEOffset()
calls in the cloneLambda. This can lead to slightly different output
between runs due to threading.

To prevent this from happening, we now record the output debug info size
after importing the modules (before any concurrent processing takes
place). This value, named the ModulesEndOffset is used to compare the
canonical DIE offset against. If the value is greater than this offset,
the canonical DIE offset has been updated during cloning, and should
therefore not be considered for pruning.

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

llvm-svn: 341649

6 years agoRevert "Revert "Revert "[analyzer] Add coverage information to plist output, update...
Simon Pilgrim [Fri, 7 Sep 2018 10:27:16 +0000 (10:27 +0000)]
Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests"""

Reverts analyzer tests from rL341627 again as they still broke windows buildbots

llvm-svn: 341648

6 years ago[XRay] XRAY_NEVER_INSTRUMENT more functions, consolidate allocators
Dean Michael Berris [Fri, 7 Sep 2018 10:16:14 +0000 (10:16 +0000)]
[XRay] XRAY_NEVER_INSTRUMENT more functions, consolidate allocators

Summary:
In this change we apply `XRAY_NEVER_INSTRUMENT` to more functions in the
profiling implementation to ensure that these never get instrumented if
the compiler used to build the library is capable of doing XRay
instrumentation.

We also consolidate all the allocators into a single header
(xray_allocator.h) which sidestep the use of the internal allocator
implementation in sanitizer_common.

This addresses more cases mentioned in llvm.org/PR38577.

Reviewers: mboerger, eizan

Subscribers: llvm-commits

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

llvm-svn: 341647

6 years ago[MSan] don't access MsanCtorFunction when using KMSAN
Alexander Potapenko [Fri, 7 Sep 2018 09:56:36 +0000 (09:56 +0000)]
[MSan] don't access MsanCtorFunction when using KMSAN

MSan has found a use of uninitialized memory in MSan, fix it.

llvm-svn: 341646

6 years ago[clangd] Canonicalize include paths in clangd.
Eric Liu [Fri, 7 Sep 2018 09:40:36 +0000 (09:40 +0000)]
[clangd] Canonicalize include paths in clangd.

Get rid of "../"  and "../../".

llvm-svn: 341645

6 years agoReplaces __inline by __inline__ / C89 compatible
Diogo N. Sampaio [Fri, 7 Sep 2018 09:37:27 +0000 (09:37 +0000)]
Replaces __inline by __inline__ / C89 compatible

llvm-svn: 341644

6 years ago[clang-tidy] Abseil: Allow macros inside of absl to use internal absl things
Benjamin Kramer [Fri, 7 Sep 2018 09:25:23 +0000 (09:25 +0000)]
[clang-tidy] Abseil: Allow macros inside of absl to use internal absl things

llvm-svn: 341643

6 years agoARM: fix Thumb2 CodeGen for ldrex with folded frame-index.
Tim Northover [Fri, 7 Sep 2018 09:21:25 +0000 (09:21 +0000)]
ARM: fix Thumb2 CodeGen for ldrex with folded frame-index.

Because t2LDREX (& t2STREX) were marked as AddrModeNone, but did allow a
FrameIndex operand, rewriteT2FrameIndex asserted. This gives them a
proper addressing-mode and tells the rewriter about it so that encodable
offsets are exploited and others are rejected.

Should fix PR38828.

llvm-svn: 341642

6 years ago[MSan] add KMSAN support to Clang driver
Alexander Potapenko [Fri, 7 Sep 2018 09:21:09 +0000 (09:21 +0000)]
[MSan] add KMSAN support to Clang driver

Boilerplate code for using KMSAN instrumentation in Clang.

We add a new command line flag, -fsanitize=kernel-memory, with a
corresponding SanitizerKind::KernelMemory, which, along with
SanitizerKind::Memory, maps to the memory_sanitizer feature.

KMSAN is only supported on x86_64 Linux.

It's incompatible with other sanitizers, but supports code coverage
instrumentation.

llvm-svn: 341641

6 years ago[clangd] NFC: Document URIDistance
Kirill Bobyrev [Fri, 7 Sep 2018 09:18:58 +0000 (09:18 +0000)]
[clangd] NFC: Document URIDistance

`URIDistance` constructor should mention that `Sources` must contain
*absolute paths*, not URIs. This is not very clear when looking at the
interface, especially given that `distance(...)` accepts `URI`, not an
absolute path which can give the wrong impression.

Reviewed By: sammccall

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

llvm-svn: 341639

6 years ago[MSan] Define %clang_kmsan for KMSAN tests
Alexander Potapenko [Fri, 7 Sep 2018 09:17:12 +0000 (09:17 +0000)]
[MSan] Define %clang_kmsan for KMSAN tests

llvm-svn: 341638

6 years ago[MSan] Add KMSAN instrumentation to MSan pass
Alexander Potapenko [Fri, 7 Sep 2018 09:10:30 +0000 (09:10 +0000)]
[MSan] Add KMSAN instrumentation to MSan pass

Introduce the -msan-kernel flag, which enables the kernel instrumentation.

The main differences between KMSAN and MSan instrumentations are:

- KMSAN implies msan-track-origins=2, msan-keep-going=true;
- there're no explicit accesses to shadow and origin memory.
  Shadow and origin values for a particular X-byte memory location are
  read and written via pointers returned by
  __msan_metadata_ptr_for_load_X(u8 *addr) and
  __msan_store_shadow_origin_X(u8 *addr, uptr shadow, uptr origin);
- TLS variables are stored in a single struct in per-task storage. A call
  to a function returning that struct is inserted into every instrumented
  function before the entry block;
- __msan_warning() takes a 32-bit origin parameter;
- local variables are poisoned with __msan_poison_alloca() upon function
  entry and unpoisoned with __msan_unpoison_alloca() before leaving the
  function;
- the pass doesn't declare any global variables or add global constructors
  to the translation unit.

llvm-svn: 341637

6 years ago[AMDGPU] Preliminary patch for divergence driven instruction selection. Fold immediat...
Alexander Timofeev [Fri, 7 Sep 2018 09:05:34 +0000 (09:05 +0000)]
[AMDGPU] Preliminary patch for divergence driven instruction selection. Fold immediate SMRD offset.

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

Reviewer: rampitec
llvm-svn: 341636

6 years ago[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).
Puyan Lotfi [Fri, 7 Sep 2018 08:10:22 +0000 (08:10 +0000)]
[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).

  Third Attempt:
    - Alignment issues resolved.
    - zlib::isAvailable() detected.
    - ArrayRef misuse fixed.

  Usage:

  llvm-objcopy --compress-debug-sections=zlib foo.o
  llvm-objcopy --compress-debug-sections=zlib-gnu foo.o

  In both cases the debug section contents is compressed with zlib. In the GNU
  style case the header is the "ZLIB" magic string followed by the uint64 big-
  endian decompressed size. In the non-GNU mode the header is the
  Elf(32|64)_Chdr.

  Decompression support is coming soon.

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

llvm-svn: 341635

6 years ago[PowerPC] Combine ADD to ADDZE
QingShan Zhang [Fri, 7 Sep 2018 07:56:05 +0000 (07:56 +0000)]
[PowerPC] Combine ADD to ADDZE

On the ppc64le platform, if ir has the following form,

define i64 @addze1(i64 %x, i64 %z) local_unnamed_addr #0 {
entry:
  %cmp = icmp ne i64 %z, CONSTANT      (-32767 <= CONSTANT <= 32768)
  %conv1 = zext i1 %cmp to i64
  %add = add nsw i64 %conv1, %x
  ret i64 %add
}
we can optimize it to the form below.

                                when C == 0
                            --> addze X, (addic Z, -1))
                           /
add X, (zext(setne Z, C))--
                           \    when -32768 <= -C <= 32767 && C != 0
                            --> addze X, (addic (addi Z, -C), -1)

Patch By: HLJ2009 (Li Jia He)
Differential Revision: https://reviews.llvm.org/D51403
Reviewed By: Nemanjai

llvm-svn: 341634

6 years ago[IndVars] Set Changed when we delete dead instructions. PR38855
Max Kazantsev [Fri, 7 Sep 2018 07:23:39 +0000 (07:23 +0000)]
[IndVars] Set Changed when we delete dead instructions. PR38855

IndVars does not set `Changed` flag when it eliminates dead instructions. As result,
it may make IR modifications and report that it has done nothing. It leads to inconsistent
preserved analyzes results.

Differential Revision: https://reviews.llvm.org/D51770
Reviewed By: skatkov

llvm-svn: 341633

6 years ago[libfuzzer] Enable trace-malloc-unballanced.test on Windows.
Jonathan Metzman [Fri, 7 Sep 2018 04:28:54 +0000 (04:28 +0000)]
[libfuzzer] Enable trace-malloc-unballanced.test on Windows.

Summary:
Enables trace-malloc-unbalanced.test on Windows, fixing two problems it had with Windows before.
The first fix is specifying python instead of relying on a script's shebang since they can't be used on Windows.
The second fix is making the regex tolerate windows' implementation of the "%p" format string.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: morehouse

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

llvm-svn: 341632

6 years agoRevert "[XRay] Add a BlockVerifier visitor for FDR Records"
Dean Michael Berris [Fri, 7 Sep 2018 03:38:26 +0000 (03:38 +0000)]
Revert "[XRay] Add a BlockVerifier visitor for FDR Records"

This reverts commit r341628.

llvm-svn: 341631

6 years ago[X86] Add more test cases for missed opportunities for using RMW form of ADC.
Craig Topper [Fri, 7 Sep 2018 02:39:56 +0000 (02:39 +0000)]
[X86] Add more test cases for missed opportunities for using RMW form of ADC.

llvm-svn: 341630

6 years ago[Sema] Check that the destructor for each element of class type is
Akira Hatanaka [Fri, 7 Sep 2018 02:38:01 +0000 (02:38 +0000)]
[Sema] Check that the destructor for each element of class type is
accessible from the context where aggregate initialization occurs.

rdar://problem/38168772

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

llvm-svn: 341629

6 years ago[XRay] Add a BlockVerifier visitor for FDR Records
Dean Michael Berris [Fri, 7 Sep 2018 02:25:06 +0000 (02:25 +0000)]
[XRay] Add a BlockVerifier visitor for FDR Records

Summary:
This patch implements a `BlockVerifier` type which enforces the
invariants of the log structure of FDR mode logs on a per-block basis.
This ensures that the data we encounter from an FDR mode log
semantically correct (i.e. that records follow the documented "grammar"
for FDR mode log records).

This is another part of the refactoring of D50441.

Reviewers: mboerger, eizan

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 341628

6 years agoRevert "Revert "[analyzer] Add coverage information to plist output, update tests""
George Karpenkov [Fri, 7 Sep 2018 02:02:35 +0000 (02:02 +0000)]
Revert "Revert "[analyzer] Add coverage information to plist output, update tests""

This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc.

Reverting the revert, fixing tests.

llvm-svn: 341627

6 years agoRevert "[analyzer] Add coverage information to plist output, update tests"
George Karpenkov [Fri, 7 Sep 2018 01:39:23 +0000 (01:39 +0000)]
Revert "[analyzer] Add coverage information to plist output, update tests"

This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e.

Temporary revert until the tests are fixed.

llvm-svn: 341626

6 years ago[hwasan] relax the rint-memory-usage.c test further
Kostya Serebryany [Fri, 7 Sep 2018 01:36:34 +0000 (01:36 +0000)]
[hwasan] relax the rint-memory-usage.c test further

llvm-svn: 341625

6 years ago[X86] Fix some incorrect comments. NFC
Craig Topper [Fri, 7 Sep 2018 01:29:42 +0000 (01:29 +0000)]
[X86] Fix some incorrect comments. NFC

llvm-svn: 341624

6 years agoEnable the fp-armv8 disassembler feature when disassembling Cortex-M
Jason Molenda [Fri, 7 Sep 2018 01:28:48 +0000 (01:28 +0000)]
Enable the fp-armv8 disassembler feature when disassembling Cortex-M
code.  This will enable disassembly of the optional subset of
neon that some Cortex cores support.  Add a unit test to check
that a few of these instructions disassemble as expected.

<rdar://problem/26674303>

llvm-svn: 341623

6 years ago[libfuzzer] Use cl driver mode for tests and enable another test on Windows
Jonathan Metzman [Fri, 7 Sep 2018 01:11:31 +0000 (01:11 +0000)]
[libfuzzer] Use cl driver mode for tests and enable another test on Windows

Summary:
When targeting MSVC: compile using clang's cl driver mode (this is needed for
libfuzzer's exit_on_src_pos feature). Don't use -lstdc++ when linking,
it isn't needed and causes a warning.
On Windows: Fix exit_on_src_pos.test by making sure debug info isn't
overwritten during compilation of second binary by using .exe extension.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: aprantl, JDevlieghere

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

llvm-svn: 341622

6 years ago[analyzer] Add coverage information to plist output, update tests
George Karpenkov [Fri, 7 Sep 2018 00:44:17 +0000 (00:44 +0000)]
[analyzer] Add coverage information to plist output, update tests

Split tests which were still using FileCheck to compare plists.

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

llvm-svn: 341621

6 years ago[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&
George Karpenkov [Fri, 7 Sep 2018 00:43:55 +0000 (00:43 +0000)]
[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&

When object is owned elsewhere

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

llvm-svn: 341620

6 years ago[analyzer] Executed lines: store file IDs, not hashes.
George Karpenkov [Fri, 7 Sep 2018 00:43:37 +0000 (00:43 +0000)]
[analyzer] Executed lines: store file IDs, not hashes.

Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames.

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

llvm-svn: 341619

6 years ago[analyzer] Do not add invalid source location to the coverage information
George Karpenkov [Fri, 7 Sep 2018 00:43:17 +0000 (00:43 +0000)]
[analyzer] Do not add invalid source location to the coverage information

Invalid source locations may arise from generated code.

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

llvm-svn: 341618

6 years ago[analyzer] Push updating-the-executed-lines logic into the BugReporter.
George Karpenkov [Fri, 7 Sep 2018 00:42:53 +0000 (00:42 +0000)]
[analyzer] Push updating-the-executed-lines logic into the BugReporter.

So it can be reused across different consumers.

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

llvm-svn: 341617

6 years ago[analyzer] Skip printing trivial nodes in exploded graph
George Karpenkov [Fri, 7 Sep 2018 00:42:32 +0000 (00:42 +0000)]
[analyzer] Skip printing trivial nodes in exploded graph

A node is considered to be trivial if it only has one successor, one
predecessor, and a state equal to the predecessor.
Can drastically (> 2x) reduce the size of the generated exploded
graph.

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

llvm-svn: 341616

6 years ago[hwasan] make the print-memory-usage.c less agressive: do not assume that malloc...
Kostya Serebryany [Fri, 7 Sep 2018 00:38:31 +0000 (00:38 +0000)]
[hwasan] make the print-memory-usage.c less agressive: do not assume that malloc can't happen before main

llvm-svn: 341615

6 years ago[llvm-strip] -p test fix for windows buildbots
Jordan Rupprecht [Fri, 7 Sep 2018 00:28:54 +0000 (00:28 +0000)]
[llvm-strip] -p test fix for windows buildbots

Windows ls prints dates as "1997-05-05" instead of "May 05 1997", so only check for a leading space.

llvm-svn: 341614

6 years agoRevert: [llvm-objcopy] Dwarf .debug section compression (Second Attempt).
Puyan Lotfi [Fri, 7 Sep 2018 00:28:25 +0000 (00:28 +0000)]
Revert: [llvm-objcopy] Dwarf .debug section compression (Second Attempt).

Various bots still fail for unknown reason.

llvm-svn: 341613

6 years ago[hwasan] Fix malloc overflow detection.
Evgeniy Stepanov [Fri, 7 Sep 2018 00:27:11 +0000 (00:27 +0000)]
[hwasan] Fix malloc overflow detection.

Check size limit before rounding up, otherwise malloc((size_t)-1)
would happily allocate 0 bytes.

Steal a nice test case from scudo.

llvm-svn: 341612

6 years ago[ELF] Check if LinkSec is nullptr when initializing SHF_LINK_ORDER sections
Fangrui Song [Fri, 7 Sep 2018 00:18:07 +0000 (00:18 +0000)]
[ELF] Check if LinkSec is nullptr when initializing SHF_LINK_ORDER sections

Summary: This protects lld from a null pointer dereference when a faulty input file has such invalid sh_link fields.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 341611

6 years ago[hwasan] change the thread list so that main_thread can also be removed
Kostya Serebryany [Fri, 7 Sep 2018 00:16:55 +0000 (00:16 +0000)]
[hwasan] change the thread list so that main_thread can also be removed

llvm-svn: 341610

6 years ago[PDB] Rename some files in the native reader.
Zachary Turner [Fri, 7 Sep 2018 00:12:56 +0000 (00:12 +0000)]
[PDB] Rename some files in the native reader.

By calling these NativeType<foo>.cpp, they will all be sorted
together, and it also distinguishes the types from the symbols.

llvm-svn: 341609

6 years ago[PDB] Create a SymbolCache class.
Zachary Turner [Fri, 7 Sep 2018 00:12:34 +0000 (00:12 +0000)]
[PDB] Create a SymbolCache class.

Part of the responsibility of the native PDB reader is to cache
symbols the first time they are accessed, so they can then be
looked up by an ID.  Furthermore, we need to resolve type indices
to records that we vend to the user, and other things.  Previously
this code was all thrown together a bit haphazardly in the native
session class, but it makes sense to collect all of this into a
single class whose sole responsibility is to manage the collection
of known symbols.

llvm-svn: 341608

6 years ago[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).
Puyan Lotfi [Thu, 6 Sep 2018 23:59:50 +0000 (23:59 +0000)]
[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).

  Second Attempt. Alignment issues resolved. zlib::isAvailable() detected.

  Usage:

  llvm-objcopy --compress-debug-sections=zlib foo.o
  llvm-objcopy --compress-debug-sections=zlib-gnu foo.o

  In both cases the debug section contents is compressed with zlib. In the GNU
  style case the header is the "ZLIB" magic string followed by the uint64 big-
  endian decompressed size. In the non-GNU mode the header is the
  Elf(32|64)_Chdr.

  Decompression support is coming soon.

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

llvm-svn: 341607

6 years ago[X86] Add RMW ADC patterns with load in operand 1.
Craig Topper [Thu, 6 Sep 2018 23:55:36 +0000 (23:55 +0000)]
[X86] Add RMW ADC patterns with load in operand 1.

ADC is commutable and the load could be in either operand, but we were only checking operand 0.

Ideally we'd mark X86adc_flag as commutable and tablegen would automatically do this, but the EFLAGS register mention is preventing it.

llvm-svn: 341606

6 years ago[X86] Add a test case showing failure to use the RMW form of ADC when the load is...
Craig Topper [Thu, 6 Sep 2018 23:55:34 +0000 (23:55 +0000)]
[X86] Add a test case showing failure to use the RMW form of ADC when the load is in operand 1 going into isel.

The ADC instruction is commutable, but we only have RMW isel patterns with a load on the left hand side. Nothing will canonicalize loads to the LHS on these ops. So we need two patterns.

llvm-svn: 341605

6 years agoFix SampleProf code on LLP64 platforms with stoull
Reid Kleckner [Thu, 6 Sep 2018 23:35:58 +0000 (23:35 +0000)]
Fix SampleProf code on LLP64 platforms with stoull

Otherwise, stoul will throw an out of range exception if the integer
doesn't fit in a 32-bit number.

llvm-svn: 341604

6 years ago[analyzer] [NFC] Move dumping program point into a separate function
George Karpenkov [Thu, 6 Sep 2018 23:08:27 +0000 (23:08 +0000)]
[analyzer] [NFC] Move dumping program point into a separate function

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

llvm-svn: 341603

6 years ago[analyzer] Dump stable identifiers for exploded nodes
George Karpenkov [Thu, 6 Sep 2018 23:08:07 +0000 (23:08 +0000)]
[analyzer] Dump stable identifiers for exploded nodes

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

llvm-svn: 341602

6 years ago[analyzer] Remove traces of ubigraph visualization
George Karpenkov [Thu, 6 Sep 2018 23:07:47 +0000 (23:07 +0000)]
[analyzer] Remove traces of ubigraph visualization

Ubigraph project has been dead since about 2008, and to the best of my
knowledge, no one was using it.
Previously, I wasn't able to launch the existing binary at all.

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

llvm-svn: 341601

6 years ago[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
George Karpenkov [Thu, 6 Sep 2018 23:07:26 +0000 (23:07 +0000)]
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph

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

llvm-svn: 341600

6 years agoProvide a method for generating deterministic IDs for pointers allocated in BumpPtrAl...
George Karpenkov [Thu, 6 Sep 2018 23:07:05 +0000 (23:07 +0000)]
Provide a method for generating deterministic IDs for pointers allocated in BumpPtrAllocator

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

llvm-svn: 341599

6 years ago[hwasan] Remove allocator interceptors.
Evgeniy Stepanov [Thu, 6 Sep 2018 22:53:08 +0000 (22:53 +0000)]
[hwasan] Remove allocator interceptors.

Summary:
When building without COMPILER_RT_HWASAN_WITH_INTERCEPTORS, skip
interceptors for malloc/free/etc and only export their versions with
__sanitizer_ prefix.

Also remove a hack in mallinfo() interceptor that does not apply to
hwasan.

Reviewers: kcc

Subscribers: kubamracek, krytarowski, llvm-commits

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

llvm-svn: 341598

6 years agoFix error with SmallString implicit conversion.
Zachary Turner [Thu, 6 Sep 2018 22:47:32 +0000 (22:47 +0000)]
Fix error with SmallString implicit conversion.

llvm-svn: 341597

6 years ago[X86] Add isel patterns for commuting X86adc_flag with a load in the LHS.
Craig Topper [Thu, 6 Sep 2018 22:41:44 +0000 (22:41 +0000)]
[X86] Add isel patterns for commuting X86adc_flag with a load in the LHS.

The peephole pass likely gets this normally, but we should be doing it during isel.

Ideally we'd just make the X86adc_flag pattern SDNPCommutable, but the tablegen doesn't handle that when one of the operands is a register reference.

llvm-svn: 341596

6 years ago[llvm-strip] Fix -p test to check for explicit spaces around dates, to avoid when...
Jordan Rupprecht [Thu, 6 Sep 2018 22:34:48 +0000 (22:34 +0000)]
[llvm-strip] Fix -p test to check for explicit spaces around dates, to avoid when the filename happens to contain 1995/1997.

llvm-svn: 341595

6 years ago[hwasan] fix pthread_exit
Kostya Serebryany [Thu, 6 Sep 2018 22:13:43 +0000 (22:13 +0000)]
[hwasan] fix pthread_exit

llvm-svn: 341594

6 years agoThe initial .text section generated in object files was missing the
Eric Christopher [Thu, 6 Sep 2018 22:09:31 +0000 (22:09 +0000)]
The initial .text section generated in object files was missing the
SHF_ARM_PURECODE flag when being built with the -mexecute-only flag.
All code sections of an ELF must have the flag set for the final .text
section to be execute-only, otherwise the flag gets removed.

A HasData flag is added to MCSection to aid in the determination that
the section is empty. A virtual setTargetSectionFlags is added to
MCELFObjectTargetWriter to allow subclasses to set target specific
section flags to be added to sections which we then use in the ARM
backend to set SHF_ARM_PURECODE.

Patch by Ivan Lozano!

Reviewed By: echristo

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

llvm-svn: 341593

6 years ago[hwasan] introduce __hwasan_print_memory_usage
Kostya Serebryany [Thu, 6 Sep 2018 22:08:41 +0000 (22:08 +0000)]
[hwasan] introduce __hwasan_print_memory_usage

llvm-svn: 341592

6 years ago[SampleFDO] Make sample profile loader unaware of compact format change.
Wei Mi [Thu, 6 Sep 2018 22:03:37 +0000 (22:03 +0000)]
[SampleFDO] Make sample profile loader unaware of compact format change.

The patch tries to make sample profile loader independent of profile format
change. It moves compact format related code into FunctionSamples and
SampleProfileReader classes, and sample profile loader only has to interact
with those two classes and will be unaware of profile format changes.

The cleanup also contain some fixes to further remove the difference between
compactbinary format and binary format. After the cleanup using different
formats originated from the same profile will generate the same binaries,
which we verified by compiling two large server benchmarks w/wo thinlto.

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

llvm-svn: 341591

6 years agoFix a configure issue with Visual Studio generators.
Zachary Turner [Thu, 6 Sep 2018 22:00:38 +0000 (22:00 +0000)]
Fix a configure issue with Visual Studio generators.

We can't put the unittest source dir map in the configuration
specific directory because VS doesn't have a configure-specific
directory, instead it only knows this at runtime.  So we have
to remove this from the path.  This in turn means that the path
will be slightly different in VS configurations vs non vs
configurations.  In the former, the source map will be in the
parent directory of the executable, and in the latter it will
be in the same directory as the executable.  So check both.

llvm-svn: 341590

6 years agoRevert r341413
Scott Linder [Thu, 6 Sep 2018 21:38:56 +0000 (21:38 +0000)]
Revert r341413

Causes a regression in expensive checks.

llvm-svn: 341589