platform/upstream/llvm.git
6 years ago[TableGen] Pass string/vector types by const reference (PR37666). NFCI
Simon Pilgrim [Tue, 14 Aug 2018 11:17:38 +0000 (11:17 +0000)]
[TableGen] Pass string/vector types by const reference (PR37666). NFCI

llvm-svn: 339670

6 years agoFix: ConstString::GetConstCStringAndSetMangledCounterPart() should update the value...
Stefan Granitz [Tue, 14 Aug 2018 11:07:18 +0000 (11:07 +0000)]
Fix: ConstString::GetConstCStringAndSetMangledCounterPart() should update the value if the key exists already

Summary:
This issue came up because it caused problems in our unit tests. The StringPool did connect counterparts only once and silently ignored the values passed in subsequent calls.
The simplest solution for the unit tests would be silent overwrite. In practice, however, it seems useful to assert that we never overwrite a different mangled counterpart.
If we ever have mangled counterparts for other languages than C++, this makes it more likely to notice collisions.

I added an assertion that allows the following cases:
* inserting a new value
* overwriting the empty string
* overwriting with an identical value

I fixed the unit tests, which used "random" strings and thus produced collisions.
It would be even better if there was a way to reset or isolate the StringPool, but that's a different story.

Reviewers: jingham, friss, labath

Subscribers: lldb-commits

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

llvm-svn: 339669

6 years ago[gnu-objc] Make selector order deterministic.
David Chisnall [Tue, 14 Aug 2018 10:05:25 +0000 (10:05 +0000)]
[gnu-objc] Make selector order deterministic.

Summary:
This probably fixes PR35277, though there may be other sources of
nondeterminism (this was the only case of iterating over a DenseMap).

It's difficult to provide a test case for this, because it shows up only
on systems with ASLR enabled.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: bmwiedemann, mgrang, cfe-commits

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

llvm-svn: 339668

6 years agoAdd a stub mangling for ObjC selectors in the Microsoft ABI.
David Chisnall [Tue, 14 Aug 2018 10:04:36 +0000 (10:04 +0000)]
Add a stub mangling for ObjC selectors in the Microsoft ABI.

This mangling is used only for outlined SEH finally blocks, which have
internal linkage.

This fixes the failure of CodeGenObjC/2007-04-03-ObjcEH.m on builds with
expensive checks enabled, on Windows.  This test should probably be
specifying a triple: it currently picks up whatever the host environment
is using.  Unfortunately, I have no idea what it is trying to test,
because it contains no comments and predates Clang having working
Objective-C IR generation.

llvm-svn: 339667

6 years agoFix MSVC "compiler limit: blocks nested too deeply" error. NFCI.
Simon Pilgrim [Tue, 14 Aug 2018 10:04:14 +0000 (10:04 +0000)]
Fix MSVC "compiler limit: blocks nested too deeply" error. NFCI.

MSVC only accepts if-else chains up to 127 blocks long. I've had to merge a number of intrinsic cases together to get back below this limit, resulting in some duplication of string matches; this shouldn't cause any notable increase in runtime (and even then only for old IR, nothing that clang currently emits).

llvm-svn: 339666

6 years ago[clangd] Show non-instantiated decls in signatureHelp
Ilya Biryukov [Tue, 14 Aug 2018 09:36:32 +0000 (09:36 +0000)]
[clangd] Show non-instantiated decls in signatureHelp

Summary:
To avoid producing very verbose output in substitutions involving
typedefs, e.g.
  T -> std::vector<std::string>::iterator
gets turned into an unreadable mess when printed out for libstdc++,
result contains internal types (std::__Vector_iterator<...>) and
expanded well-defined typedefs (std::basic_string<char>).

Until we improve the presentation code in clang, going with
non-instantiated decls looks like a better UX trade-off.

Reviewers: hokein, ioeric, kadircet

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 339665

6 years ago[XRay][clang] Add more test cases of -fxray-modes= (NFC)
Dean Michael Berris [Tue, 14 Aug 2018 09:16:37 +0000 (09:16 +0000)]
[XRay][clang] Add more test cases of -fxray-modes= (NFC)

This confirms expectations for multiple values provided through the
driver when selecting specific modes and the order of appearance of
individual values for the `-fxray-modes=` flag.

This change just adds more test cases to an existing test file.

llvm-svn: 339662

6 years ago[X86] Constant folding of adds/subs intrinsics
Tomasz Krupa [Tue, 14 Aug 2018 09:04:01 +0000 (09:04 +0000)]
[X86] Constant folding of adds/subs intrinsics

Summary: This adds constant folding of signed add/sub with saturation intrinsics.

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

Reviewed By: craig.topper

Subscribers: rnk, llvm-commits

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

llvm-svn: 339659

6 years ago[analyzer] Made a buildbot happy.
Kristof Umann [Tue, 14 Aug 2018 08:38:35 +0000 (08:38 +0000)]
[analyzer] Made a buildbot happy.

llvm-svn: 339655

6 years ago[RISCV] Fix incorrect use of MCInstBuilder
Roger Ferrer Ibanez [Tue, 14 Aug 2018 08:30:42 +0000 (08:30 +0000)]
[RISCV] Fix incorrect use of MCInstBuilder

This is a fix for r339314.

MCInstBuilder uses the named parameter idiom and an 'operator MCInst&' to ease
the creation of MCInsts. As the object of MCInstBuilder owns the MCInst is
manipulating, the lifetime of the MCInst is bound to that of MCInstBuilder.

In r339314 I bound a reference to the MCInst in an initializer. The
temporary of MCInstBuilder (and also its MCInst) is destroyed at the end of
the declaration leading to a dangling reference.

Fix this by using MCInstBuilder inside an argument of a function call.
Temporaries in function calls are destroyed in the enclosing full expression,
so the the reference to MCInst is still valid when emitToStreamer executes.

llvm-svn: 339654

6 years ago[analyzer][UninitializedObjectChecker] Void pointers are casted back to their dynamic...
Kristof Umann [Tue, 14 Aug 2018 08:20:51 +0000 (08:20 +0000)]
[analyzer][UninitializedObjectChecker] Void pointers are casted back to their dynamic type in note message

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

llvm-svn: 339653

6 years agoTest commit: fix punctuation
Chih-Mao Chen [Tue, 14 Aug 2018 08:08:39 +0000 (08:08 +0000)]
Test commit: fix punctuation

llvm-svn: 339652

6 years ago[X86] Lowering addus/subus intrinsics to native IR
Tomasz Krupa [Tue, 14 Aug 2018 08:01:38 +0000 (08:01 +0000)]
[X86] Lowering addus/subus intrinsics to native IR

Summary: This is the patch that lowers x86 intrinsics to native IR in order to enable optimizations.

Reviewers: craig.topper, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: cfe-commits

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

llvm-svn: 339651

6 years ago[X86] Lowering addus/subus intrinsics to native IR
Tomasz Krupa [Tue, 14 Aug 2018 08:00:56 +0000 (08:00 +0000)]
[X86] Lowering addus/subus intrinsics to native IR

Summary: This revision improves previous version (rL330322) which has been reverted due to crashes.

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Reviewers: craig.topper, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mike.dvoretsky, DavidKreitzer, sroland, llvm-commits

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

llvm-svn: 339650

6 years ago[PDB] Parse UDT symbols and pointers to members (combined patch)
Aleksandr Urakov [Tue, 14 Aug 2018 07:57:44 +0000 (07:57 +0000)]
[PDB] Parse UDT symbols and pointers to members (combined patch)

Summary:
In this patch I've tried to combine the best ideas from D49368 and D49410,
so it implements following:

- Completion of UDTs from a PDB with a filling of a layout info;
- Pointers to members;
- Fixes the bug relating to a virtual base offset reading from `vbtable`.
  The offset was treated as an unsigned, but it can be a negative sometimes.
- Support of MSInheritance attribute

Reviewers: asmith, zturner, rnk, labath, clayborg, lldb-commits

Reviewed By: zturner

Subscribers: aleksandr.urakov, stella.stamenova, JDevlieghere, lldb-commits

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

llvm-svn: 339649

6 years ago[ARM] ParallelDSP: add option to enable/disable the pass
Sjoerd Meijer [Tue, 14 Aug 2018 07:43:49 +0000 (07:43 +0000)]
[ARM] ParallelDSP: add option to enable/disable the pass

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

llvm-svn: 339645

6 years ago[NFC] Modify comment to make it more precise
Max Kazantsev [Tue, 14 Aug 2018 07:40:08 +0000 (07:40 +0000)]
[NFC] Modify comment to make it more precise

llvm-svn: 339644

6 years ago[NFC] Add comprehensive test of AliasSetTracker with guards
Max Kazantsev [Tue, 14 Aug 2018 06:37:39 +0000 (06:37 +0000)]
[NFC] Add comprehensive test of AliasSetTracker with guards

llvm-svn: 339643

6 years ago[cmake] Add MINGW_LIBRARIES to the linker flags
Martin Storsjo [Tue, 14 Aug 2018 06:13:36 +0000 (06:13 +0000)]
[cmake] Add MINGW_LIBRARIES to the linker flags

This is essential when building with -nodefaultlibs.

In some CMake versions (noticed in 3.5.1), the same libraries are
picked up from CMAKE_REQUIRED_LIBRARIES in some exceptional situations
(if CXX probing failed, due to libc++ not being built yet, the libraries
from CMAKE_REQUIRED_LIBRARIES are used for linking the target library),
but not at all in other newer CMake versions (3.10).

This is similar to what already is done in libcxxabi in SVN r302760
and libcxx in SVN r312498.

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

llvm-svn: 339642

6 years ago[CStringSyntaxChecker] Check strlcat sizeof check
David Carlier [Tue, 14 Aug 2018 05:12:53 +0000 (05:12 +0000)]
[CStringSyntaxChecker] Check strlcat sizeof check

- Assuming strlcat is used with strlcpy we check as we can if the last argument does not equal os not larger than the buffer.
- Advising the proper usual pattern.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

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

llvm-svn: 339641

6 years ago[ThinLTO] Fix printing of WPD remarks
Teresa Johnson [Tue, 14 Aug 2018 03:00:16 +0000 (03:00 +0000)]
[ThinLTO] Fix printing of WPD remarks

Summary:
When WPD is performed in a ThinLTO backend, the function may be created
if it isn't already in that module. Module::getOrInsertFunction may
add a bitcast, in which case the returned Constant is not a Function and
doesn't have a name. Invoke stripPointerCasts() on the returned value
where we access its name.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 339640

6 years ago[CMake] Split -gx strip flag into -g -x
Petr Hosek [Tue, 14 Aug 2018 02:00:21 +0000 (02:00 +0000)]
[CMake] Split -gx strip flag into -g -x

llvm-strip doesn't handle -gx spelling, so we need to split these
as two separate flags.

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

llvm-svn: 339639

6 years agoRevert r339623 "Model type attributes as regular Attrs."
Reid Kleckner [Tue, 14 Aug 2018 01:55:37 +0000 (01:55 +0000)]
Revert r339623 "Model type attributes as regular Attrs."

This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid
in some way, but we put a lot of work into accepting it, and I'm sure
rejecting it was not an intended consequence of this refactoring. :)

llvm-svn: 339638

6 years ago[ThinLTO] Handle optional args in assembly format for ConstVCalls
Teresa Johnson [Tue, 14 Aug 2018 01:49:33 +0000 (01:49 +0000)]
[ThinLTO] Handle optional args in assembly format for ConstVCalls

Summary:
The AsmWriter was only writing the Args for a ConstVCall if it was
non-empty, however, the LLParser was always expecting it. To aid
in making it optional, surround the ConstVCall VFuncId and Args in
parentheses when writing, then make the Args optional when reading.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 339637

6 years ago[BasicAA] Don't assume tail calls with byval don't alias allocas
Reid Kleckner [Tue, 14 Aug 2018 01:24:35 +0000 (01:24 +0000)]
[BasicAA] Don't assume tail calls with byval don't alias allocas

Summary:
Calls marked 'tail' cannot read or write allocas from the current frame
because the current frame might be destroyed by the time they run.
However, a tail call may use an alloca with byval. Calling with byval
copies the contents of the alloca into argument registers or stack
slots, so there is no lifetime issue. Tail calls never modify allocas,
so we can return just ModRefInfo::Ref.

Fixes PR38466, a longstanding bug.

Reviewers: hfinkel, nlewycky, gbiv, george.burgess.iv

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 339636

6 years agoRevert r339490 to match revert of llvm r339474 in r339630.
Richard Smith [Tue, 14 Aug 2018 01:23:54 +0000 (01:23 +0000)]
Revert r339490 to match revert of llvm r339474 in r339630.

llvm-svn: 339635

6 years agoMove test inputs into Inputs directory.
Richard Smith [Tue, 14 Aug 2018 00:18:48 +0000 (00:18 +0000)]
Move test inputs into Inputs directory.

We don't need a new ExpectedOutputs/ convention. Expected outputs are
just another form of test input.

llvm-svn: 339634

6 years ago[CodeGen] Before returning a copy/dispose helper function, bitcast it to
Akira Hatanaka [Tue, 14 Aug 2018 00:15:42 +0000 (00:15 +0000)]
[CodeGen] Before returning a copy/dispose helper function, bitcast it to
a void pointer type.

This fixes a bug introduced in r339438.

llvm-svn: 339633

6 years agoFix check strings in test/CodeGenObjC/arc-blocks.m in preperation for
Akira Hatanaka [Tue, 14 Aug 2018 00:15:41 +0000 (00:15 +0000)]
Fix check strings in test/CodeGenObjC/arc-blocks.m in preperation for
fixing a bug introduced in r339438.

Check the descriptor global variables in the IR at both -O0 and -O2.

llvm-svn: 339632

6 years ago[analyzer] Fix UninitializedObjectChecker to not crash on uninitialized "id" fields
George Karpenkov [Mon, 13 Aug 2018 23:32:15 +0000 (23:32 +0000)]
[analyzer] Fix UninitializedObjectChecker to not crash on uninitialized "id" fields

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

llvm-svn: 339631

6 years agoRevert "[WebAssembly] Added default stack-only instruction mode for MC."
Wouter van Oortmerssen [Mon, 13 Aug 2018 23:12:49 +0000 (23:12 +0000)]
Revert "[WebAssembly] Added default stack-only instruction mode for MC."

This reverts commit 917a99b71ce21c975be7bfbf66f4040f965d9f3c.

llvm-svn: 339630

6 years ago[analyzer] [NFC] Introduce separate targets for testing the analyzer: check-clang...
George Karpenkov [Mon, 13 Aug 2018 23:12:43 +0000 (23:12 +0000)]
[analyzer] [NFC] Introduce separate targets for testing the analyzer: check-clang-analyzer and check-clang-analyzer-z3

Current testing setup for analyzer tests with Z3 is rather inconvenient:

There's no way to run the analyzer tests separately (I use
LIT_FILTER=Analysis ninja check-clang, but a direct target is nicer).

When Clang is built with Z3 support, there's no way to *not* run tests
with Z3 solver, and this is often desired, as tests with Z3 solver take
a very long time.

This patch introduces two extra targets:

 - check-clang-analyzer
 - check-clang-analyzer-z3

which solve those problems.

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

llvm-svn: 339629

6 years ago[Support] NFC: Allow modifying access/modification times independently in sys::fs...
Jordan Rupprecht [Mon, 13 Aug 2018 23:03:45 +0000 (23:03 +0000)]
[Support] NFC: Allow modifying access/modification times independently in sys::fs::setLastModificationAndAccessTime.

Summary:
Add an overload to sys::fs::setLastModificationAndAccessTime that allows setting last access and modification times separately. This will allow tools to use this API when they want to preserve both the access and modification times from an input file, which may be different.

Also note that both the POSIX (futimens/futimes) and Windows (SetFileTime) APIs take the two timestamps in the order of (1) access (2) modification time, so this renames the method to "setLastAccessAndModificationTime" to make it clear which timestamp is which.

For existing callers, the 1-arg overload just sets both timestamps to the same thing.

Subscribers: llvm-commits

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

llvm-svn: 339628

6 years ago[AST] Minor formatting cleanup [NFC]
Philip Reames [Mon, 13 Aug 2018 22:34:14 +0000 (22:34 +0000)]
[AST] Minor formatting cleanup [NFC]

llvm-svn: 339627

6 years agoSupport shared objects for split stack.
Sterling Augustine [Mon, 13 Aug 2018 22:29:15 +0000 (22:29 +0000)]
Support shared objects for split stack.

llvm-svn: 339626

6 years ago[AST] Cleanup code by using MemoryLocation utility [NFC]
Philip Reames [Mon, 13 Aug 2018 22:25:16 +0000 (22:25 +0000)]
[AST] Cleanup code by using MemoryLocation utility [NFC]

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

llvm-svn: 339625

6 years agoFix Clang warnings and bad #include filenames in r339595 and r339599.
Richard Smith [Mon, 13 Aug 2018 22:07:11 +0000 (22:07 +0000)]
Fix Clang warnings and bad #include filenames in r339595 and r339599.

llvm-svn: 339624

6 years agoModel type attributes as regular Attrs.
Richard Smith [Mon, 13 Aug 2018 22:07:09 +0000 (22:07 +0000)]
Model type attributes as regular Attrs.

Specifically, AttributedType now tracks a regular attr::Kind rather than
having its own parallel Kind enumeration, and AttributedTypeLoc now
holds an Attr* instead of holding an ad-hoc collection of Attr fields.

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

llvm-svn: 339623

6 years ago[X86] Don't ignore 0x66 prefix on relative jumps in 64-bit mode. Fix opcode selection...
Craig Topper [Mon, 13 Aug 2018 22:06:28 +0000 (22:06 +0000)]
[X86] Don't ignore 0x66 prefix on relative jumps in 64-bit mode. Fix opcode selection of relative jumps in 16-bit mode. Treat jno/jo like other jcc instructions.

The behavior in 64-bit mode is different between Intel and AMD CPUs. Intel ignores the 0x66 prefix. AMD does not. objump doesn't ignore the 0x66 prefix. Since LLVM aims to match objdump behavior, we should do the same.

While I was trying to fix this I had change brtarget16/32 to use ENCODING_IW/ID instead of ENCODING_Iv to get the 0x66+REX.W case to act sort of sanely. It's still wrong, but that's a problem for another day.

The change in encoding exposed the fact that 16-bit mode disassembly of relative jumps was creating JMP_4 with a 2 byte immediate. It should have been JMP_2. From just printing you can't tell the difference, but if you dumped the encoding it wouldn't have matched what we started with.

While fixing that, it exposed that jo/jno opcodes were missing from the switch that this patch deleted and there were no test cases for them.

Fixes PR38537.

llvm-svn: 339622

6 years ago[InstCombine] Re-land: Optimize redundant 'signed truncation check pattern'.
Roman Lebedev [Mon, 13 Aug 2018 21:54:37 +0000 (21:54 +0000)]
[InstCombine] Re-land: Optimize redundant 'signed truncation check pattern'.

Summary:
This comes with `Implicit Conversion Sanitizer - integer sign change` (D50250):
```
signed char test(unsigned int x) { return x; }
```
`clang++ -fsanitize=implicit-conversion -S -emit-llvm -o - /tmp/test.cpp -O3`
* Old: {F6904292}
* With this patch: {F6904294}

General pattern:
  X & Y

Where `Y` is checking that all the high bits (covered by a mask `4294967168`)
are uniform, i.e.  `%arg & 4294967168`  can be either  `4294967168`  or  `0`
Pattern can be one of:
  %t = add        i32 %arg,    128
  %r = icmp   ult i32 %t,      256
Or
  %t0 = shl       i32 %arg,    24
  %t1 = ashr      i32 %t0,     24
  %r  = icmp  eq  i32 %t1,     %arg
Or
  %t0 = trunc     i32 %arg  to i8
  %t1 = sext      i8  %t0   to i32
  %r  = icmp  eq  i32 %t1,     %arg
This pattern is a signed truncation check.

And `X` is checking that some bit in that same mask is zero.
I.e. can be one of:
  %r = icmp sgt i32   %arg,    -1
Or
  %t = and      i32   %arg,    2147483648
  %r = icmp eq  i32   %t,      0

Since we are checking that all the bits in that mask are the same,
and a particular bit is zero, what we are really checking is that all the
masked bits are zero.
So this should be transformed to:
  %r = icmp ult i32 %arg, 128

The transform itself ended up being rather horrible, even though i omitted some cases.
Surely there is some infrastructure that can help clean this up that i missed?

https://rise4fun.com/Alive/3Ou

The initial commit (rL339610)
was reverted, since the first assert was being triggered.
The @positive_with_extra_and test now has coverage for that case.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: RKSimon, erichkeane, vsk, llvm-commits

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

llvm-svn: 339621

6 years agoRevert "[clang-doc] Updating BitcodeReader to use llvm::Error"
Julie Hockett [Mon, 13 Aug 2018 21:51:48 +0000 (21:51 +0000)]
Revert "[clang-doc] Updating BitcodeReader to use llvm::Error"

This reverts commit r339617 for breaking bots.

llvm-svn: 339620

6 years ago[NFC][InstCombine] Add a test for D50465 that used to assert
Roman Lebedev [Mon, 13 Aug 2018 21:49:33 +0000 (21:49 +0000)]
[NFC][InstCombine] Add a test for D50465 that used to assert

This is valid to fold, too.
https://rise4fun.com/Alive/0lz

llvm-svn: 339619

6 years ago[SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds (retry r339608)
Sanjay Patel [Mon, 13 Aug 2018 21:49:19 +0000 (21:49 +0000)]
[SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds (retry r339608)

Even though this code is below a function called optimizeFloatingPointLibCall(),
we apparently can't guarantee that we're dealing with FPMathOperators, so bail
out immediately if that's not true.

llvm-svn: 339618

6 years ago[clang-doc] Updating BitcodeReader to use llvm::Error
Julie Hockett [Mon, 13 Aug 2018 21:39:03 +0000 (21:39 +0000)]
[clang-doc] Updating BitcodeReader to use llvm::Error

llvm-svn: 339617

6 years ago[llvm-objcopy] NFC: Fix minor formatting issues
Jordan Rupprecht [Mon, 13 Aug 2018 21:30:27 +0000 (21:30 +0000)]
[llvm-objcopy] NFC: Fix minor formatting issues

llvm-svn: 339616

6 years agoUpdate TestTargetXMLArch.py test for llvm triple change with unspecified
Jason Molenda [Mon, 13 Aug 2018 21:20:29 +0000 (21:20 +0000)]
Update TestTargetXMLArch.py test for llvm triple change with unspecified
components in r339294.

llvm-svn: 339615

6 years ago[hwasan] Provide __sanitizer_* aliases to allocator functions.
Evgeniy Stepanov [Mon, 13 Aug 2018 21:07:27 +0000 (21:07 +0000)]
[hwasan] Provide __sanitizer_* aliases to allocator functions.

Summary:
Export __sanitizer_malloc, etc as aliases to malloc, etc.
This way users can wrap sanitizer malloc, even in fully static binaries.

Both jemalloc and tcmalloc provide similar aliases (je_* and tc_*).

Reviewers: vitalybuka, kcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 339614

6 years agoConvert if/else to a switch. NFC.
Akira Hatanaka [Mon, 13 Aug 2018 20:59:57 +0000 (20:59 +0000)]
Convert if/else to a switch. NFC.

llvm-svn: 339613

6 years agoRevert "[InstCombine] Optimize redundant 'signed truncation check pattern'."
Roman Lebedev [Mon, 13 Aug 2018 20:46:22 +0000 (20:46 +0000)]
Revert "[InstCombine] Optimize redundant 'signed truncation check pattern'."

At least one buildbot was able to actually trigger that assert
on the top of the function. Will investigate.

This reverts commit r339610.

llvm-svn: 339612

6 years agoAdded test for Core/Range class.
Raphael Isemann [Mon, 13 Aug 2018 20:43:06 +0000 (20:43 +0000)]
Added test for Core/Range class.

Summary:
We can optimize and refactor some of the classes in RangeMap.h, but first
we should have some tests for all the data structures in there. This adds a first
batch of tests for the Range class itself.

There are some unexpected results happening when mixing invalid and valid ranges, so
I added some FIXME's for that in the tests.

Reviewers: vsk

Reviewed By: vsk

Subscribers: mgorny, lldb-commits

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

llvm-svn: 339611

6 years ago[InstCombine] Optimize redundant 'signed truncation check pattern'.
Roman Lebedev [Mon, 13 Aug 2018 20:33:08 +0000 (20:33 +0000)]
[InstCombine] Optimize redundant 'signed truncation check pattern'.

Summary:
This comes with `Implicit Conversion Sanitizer - integer sign change` (D50250):
```
signed char test(unsigned int x) { return x; }
```
`clang++ -fsanitize=implicit-conversion -S -emit-llvm -o - /tmp/test.cpp -O3`
* Old: {F6904292}
* With this patch: {F6904294}

General pattern:
  X & Y

Where `Y` is checking that all the high bits (covered by a mask `4294967168`)
are uniform, i.e.  `%arg & 4294967168`  can be either  `4294967168`  or  `0`
Pattern can be one of:
  %t = add        i32 %arg,    128
  %r = icmp   ult i32 %t,      256
Or
  %t0 = shl       i32 %arg,    24
  %t1 = ashr      i32 %t0,     24
  %r  = icmp  eq  i32 %t1,     %arg
Or
  %t0 = trunc     i32 %arg  to i8
  %t1 = sext      i8  %t0   to i32
  %r  = icmp  eq  i32 %t1,     %arg
This pattern is a signed truncation check.

And `X` is checking that some bit in that same mask is zero.
I.e. can be one of:
  %r = icmp sgt i32   %arg,    -1
Or
  %t = and      i32   %arg,    2147483648
  %r = icmp eq  i32   %t,      0

Since we are checking that all the bits in that mask are the same,
and a particular bit is zero, what we are really checking is that all the
masked bits are zero.
So this should be transformed to:
  %r = icmp ult i32 %arg, 128

https://rise4fun.com/Alive/3Ou

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: RKSimon, erichkeane, vsk, llvm-commits

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

llvm-svn: 339610

6 years agorevert r339608 - [SimplifyLibCalls] don't drop fast-math-flags on trig reflection...
Sanjay Patel [Mon, 13 Aug 2018 20:20:38 +0000 (20:20 +0000)]
revert r339608 - [SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds

Can't set the builder flags without knowing this is an FPMathOperator. I'll add a test
for that and try again.

llvm-svn: 339609

6 years ago[SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds
Sanjay Patel [Mon, 13 Aug 2018 20:14:27 +0000 (20:14 +0000)]
[SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds

llvm-svn: 339608

6 years ago[hwasan] Handle missing /proc/self/maps.
Evgeniy Stepanov [Mon, 13 Aug 2018 20:04:48 +0000 (20:04 +0000)]
[hwasan] Handle missing /proc/self/maps.

Summary:
Don't crash when /proc/self/maps is inaccessible from main thread.
It's not a big deal, really.

Reviewers: vitalybuka, kcc

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 339607

6 years ago[hwasan] Allow optional early shadow setup.
Evgeniy Stepanov [Mon, 13 Aug 2018 19:57:11 +0000 (19:57 +0000)]
[hwasan] Allow optional early shadow setup.

Summary:
Provide __hwasan_shadow_init that can be used to initialize shadow w/o touching libc.
It can be used to bootstrap an unusual case of fully-static executable with
hwasan-instrumented libc, which needs to run hwasan code before it is ready to serve
user calls like madvise().

Reviewers: vitalybuka, kcc

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 339606

6 years agoNFC: Add a test to LV showing that reduction is not possible when reduction var is...
Anna Thomas [Mon, 13 Aug 2018 19:55:25 +0000 (19:55 +0000)]
NFC: Add a test to LV showing that reduction is not possible when reduction var is reset in the loop

Added a test case to reduction showing where it's illegal to identify
vectorize a loop.
Resetting the reduction var during loop iterations disallows us from
widening the dependency cycle to VF, thereby making it illegal to
vectorize the loop.

llvm-svn: 339605

6 years ago[SimplifyLibCalls] add reflection fold for -sin(-x) (PR38458)
Sanjay Patel [Mon, 13 Aug 2018 19:24:41 +0000 (19:24 +0000)]
[SimplifyLibCalls] add reflection fold for -sin(-x) (PR38458)

This is a very partial fix for the reported problem. I suspect
we do not get this fold in most motivating cases because most of
the time, the libcall would have been replaced by an intrinsic,
and that optimization is handled elsewhere...but maybe it should
be handled here?

llvm-svn: 339604

6 years ago[OPENMP] Fix emission of the loop doacross constructs.
Alexey Bataev [Mon, 13 Aug 2018 19:04:24 +0000 (19:04 +0000)]
[OPENMP] Fix emission of the loop doacross constructs.

The number of loops associated with the OpenMP loop constructs should
not be considered as the number loops to collapse.

llvm-svn: 339603

6 years ago[InstCombine][NFC] Tests for 'signed truncation check' optimization
Roman Lebedev [Mon, 13 Aug 2018 18:51:09 +0000 (18:51 +0000)]
[InstCombine][NFC] Tests for 'signed truncation check' optimization

See D50465 for the actual opt itself.

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

llvm-svn: 339602

6 years ago[analyzer][UninitializedObjectChecker] Refactoring p5.: Handle pedantic mode in the...
Kristof Umann [Mon, 13 Aug 2018 18:48:34 +0000 (18:48 +0000)]
[analyzer][UninitializedObjectChecker] Refactoring p5.: Handle pedantic mode in the checker class only

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

llvm-svn: 339601

6 years ago[CodeGen] Fix assert in SelectionDAG::computeKnownBits
Scott Linder [Mon, 13 Aug 2018 18:44:21 +0000 (18:44 +0000)]
[CodeGen] Fix assert in SelectionDAG::computeKnownBits

Fix SelectionDAG::computeKnownBits asserting when handling EXTRACT_SUBVECTOR
when zero extending the demanded elements mask if it is already as long as the
source vector.

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

llvm-svn: 339600

6 years ago[analyzer][UninitializedObjectChecker] Refactoring p4.: Wrap FieldRegions and reduce...
Kristof Umann [Mon, 13 Aug 2018 18:43:08 +0000 (18:43 +0000)]
[analyzer][UninitializedObjectChecker] Refactoring p4.: Wrap FieldRegions and reduce weight on FieldChainInfo

Before this patch, FieldChainInfo used a spaghetti: it took care of way too many cases,
even though it was always meant as a lightweight wrapper around
ImmutableList<const FieldRegion *>.
This problem is solved by introducing a lightweight polymorphic wrapper around const
FieldRegion *, FieldNode. It is an interface that abstracts away special cases like
pointers/references, objects that need to be casted to another type for a proper note
messages.

Changes to FieldChainInfo:

  * Now wraps ImmutableList<const FieldNode &>.
  * Any pointer/reference related fields and methods were removed
  * Got a new add method. This replaces it's former constructors as a way to create a
    new FieldChainInfo objects with a new element.

Changes to FindUninitializedField:

  * In order not to deal with dynamic memory management, when an uninitialized field is
    found, the note message for it is constructed and is stored instead of a
    FieldChainInfo object. (see doc around addFieldToUninits).

Some of the test files are changed too, from now on uninitialized pointees of references
always print "uninitialized pointee" instead of "uninitialized field" (which should've
really been like this from the beginning).

I also updated every comment according to these changes.

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

llvm-svn: 339599

6 years ago[InstCombine] add more tests for trig reflections; NFC (PR38458)
Sanjay Patel [Mon, 13 Aug 2018 18:34:32 +0000 (18:34 +0000)]
[InstCombine] add more tests for trig reflections; NFC (PR38458)

llvm-svn: 339598

6 years agoEnforce instantiation of template multiversion functions
Erich Keane [Mon, 13 Aug 2018 18:33:20 +0000 (18:33 +0000)]
Enforce instantiation of template multiversion functions

Multiversioned member functions inside of a template type were
not properly being emitted.  The solution to this is to simply
ensure that their bodies are correctly evaluated/assigned during
template instantiation.

llvm-svn: 339597

6 years ago[analyzer][UninitializedObjectChecker] Refactoring p3.: printTail moved out from...
Kristof Umann [Mon, 13 Aug 2018 18:22:22 +0000 (18:22 +0000)]
[analyzer][UninitializedObjectChecker] Refactoring p3.: printTail moved out from FieldChainInfo

This is a standalone part of the effort to reduce FieldChainInfos inteerface.

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

llvm-svn: 339596

6 years ago[analyzer][UninitializedObjectChecker] Refactoring p2.: Moving pointer chasing to...
Kristof Umann [Mon, 13 Aug 2018 18:17:05 +0000 (18:17 +0000)]
[analyzer][UninitializedObjectChecker] Refactoring p2.: Moving pointer chasing to a separate file

In this patch, the following classes and functions have been moved to a header file:

    FieldChainInfo
    FindUninitializedFields
    isPrimitiveType

This also meant that they moved from anonymous namespace to clang::ento.

Code related to pointer chasing now relies in its own file.

There's absolutely no functional change in this patch -- its literally just copy pasting.

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

llvm-svn: 339595

6 years ago[llvm-mca] Propagate fatal llvm-mca errors from library classes to driver.
Matt Davis [Mon, 13 Aug 2018 18:11:48 +0000 (18:11 +0000)]
[llvm-mca] Propagate fatal llvm-mca errors from library classes to driver.

Summary:
This patch introduces error handling to propagate the errors from llvm-mca library classes (or what will become library classes) up to the driver.  This patch also introduces an enum to make clearer the intention of the return value for Stage::execute.

This supports PR38101.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: llvm-commits, tschuett, gbedwell

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

llvm-svn: 339594

6 years ago[Sema] fix -Wfloat-conversion test case.
Nick Desaulniers [Mon, 13 Aug 2018 18:07:50 +0000 (18:07 +0000)]
[Sema] fix -Wfloat-conversion test case.

Summary:
Fixes r339581 ("[SEMA] add more -Wfloat-conversion to
compound assigment analysis").

This test case was caught in postsubmit testing.

Reviewers: aaron.ballman, gkistanova

Reviewed By: aaron.ballman

Subscribers: cfe-commits, srhines

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

llvm-svn: 339593

6 years ago[clang-doc] Pass over function-internal declarations
Julie Hockett [Mon, 13 Aug 2018 18:05:50 +0000 (18:05 +0000)]
[clang-doc] Pass over function-internal declarations

llvm-svn: 339592

6 years ago[analyzer][UninitializedObjectChecker] Refactoring p1.: ImmutableList factory is...
Kristof Umann [Mon, 13 Aug 2018 17:55:52 +0000 (17:55 +0000)]
[analyzer][UninitializedObjectChecker] Refactoring p1.: ImmutableList factory is no longer static

This patch is the first part of a series of patches to refactor UninitializedObjectChecker. The goal of this effort is to

    Separate pointer chasing from the rest of the checker,
    Increase readability and reliability,
    Don't impact performance (too bad).

In this one, ImmutableList's factory is moved to FindUninitializedFields.

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

llvm-svn: 339591

6 years ago[Documentation] Remove unnecessary placeholder, grammar fix in Release Notes.
Eugene Zelenko [Mon, 13 Aug 2018 17:55:48 +0000 (17:55 +0000)]
[Documentation] Remove unnecessary placeholder, grammar fix in Release Notes.

llvm-svn: 339590

6 years ago[X86][BtVer2] Use NoSchedPredicate to model default transitions in variant scheduling...
Andrea Di Biagio [Mon, 13 Aug 2018 17:52:39 +0000 (17:52 +0000)]
[X86][BtVer2] Use NoSchedPredicate to model default transitions in variant scheduling classes. NFC.

llvm-svn: 339589

6 years ago[SimplifyLibCalls] reduce code for optimizeCos; NFCI
Sanjay Patel [Mon, 13 Aug 2018 17:40:49 +0000 (17:40 +0000)]
[SimplifyLibCalls] reduce code for optimizeCos; NFCI

llvm-svn: 339588

6 years agoAttempt to fix some MSVC build errors.
Erik Pilkington [Mon, 13 Aug 2018 17:39:19 +0000 (17:39 +0000)]
Attempt to fix some MSVC build errors.

llvm-svn: 339587

6 years ago[ADT] Implemented unittests for ImmutableList
Kristof Umann [Mon, 13 Aug 2018 17:32:48 +0000 (17:32 +0000)]
[ADT] Implemented unittests for ImmutableList

Also fixed a typo that wasn't discovered as `create` was never instantiated.

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

llvm-svn: 339586

6 years ago[OMPT] Make omp_control_tool() compliant when called from Fortran programs
Jonathan Peyton [Mon, 13 Aug 2018 17:26:18 +0000 (17:26 +0000)]
[OMPT] Make omp_control_tool() compliant when called from Fortran programs

This change fixes an incorrect behavior of the omp_control_tool function when
called from Fortran applications.  A tool callback function for this event is
supposed to get NULL for the third argument according to the specification, but
the current implementation just passes a garbage value. A possible fix is to use
the OPTIONAL attribute for the third argument.

Patch by Hansang Bae

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

llvm-svn: 339585

6 years ago[InstCombine] Limit simplifyAllocaArraySize constant folding to values that fit into...
Simon Pilgrim [Mon, 13 Aug 2018 16:50:20 +0000 (16:50 +0000)]
[InstCombine] Limit simplifyAllocaArraySize constant folding to values that fit into a uint64_t

Fixes OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5223

llvm-svn: 339584

6 years agoStraight forward FastDemangle replacement in SubsPrimitiveParmItanium
Stefan Granitz [Mon, 13 Aug 2018 16:45:06 +0000 (16:45 +0000)]
Straight forward FastDemangle replacement in SubsPrimitiveParmItanium

Summary:
Removing FastDemangle will greatly reduce maintenance efforts. This patch replaces the last point of use in LLDB. Semantics should be kept intact.

Once this is agreed upon, we can:
* Remove the FastDemangle sources
* Add more features e.g. substitutions in template parameters, considering all variations, etc.

Depends on LLVM patch https://reviews.llvm.org/D50586

Reviewers: erik.pilkington, friss, jingham, JDevlieghere

Subscribers: kristof.beyls, chrib, lldb-commits

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

llvm-svn: 339583

6 years ago[AST] Update/correct the static_asserts for the bit-fields in Type
Bruno Ricci [Mon, 13 Aug 2018 16:40:57 +0000 (16:40 +0000)]
[AST] Update/correct the static_asserts for the bit-fields in Type

The current static_assert only checks that ObjCObjectTypeBitfields
fits into an unsigned. However it turns out that FunctionTypeBitfields
do not currently fits into an unsigned. Therefore the anonymous
union containing the bit-fields always use 8 bytes instead of 4.

This patch removes the lone misguided static_assert and systematically
checks the size of each bit-field.

Reviewed By: erichkeane

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

llvm-svn: 339582

6 years ago[SEMA] add more -Wfloat-conversion to compound assigment analysis
Nick Desaulniers [Mon, 13 Aug 2018 16:38:07 +0000 (16:38 +0000)]
[SEMA] add more -Wfloat-conversion to compound assigment analysis

Summary: Fixes Bug: https://bugs.llvm.org/show_bug.cgi?id=27061

Reviewers: aaron.ballman, acoomans

Reviewed By: aaron.ballman, acoomans

Subscribers: acoomans, cfe-commits, srhines, pirama

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

llvm-svn: 339581

6 years ago[itanium demangler] Add llvm::itaniumFindTypesInMangledName()
Erik Pilkington [Mon, 13 Aug 2018 16:37:47 +0000 (16:37 +0000)]
[itanium demangler] Add llvm::itaniumFindTypesInMangledName()

This function calls a callback whenever a <type> is parsed.

This is necessary to implement FindAlternateFunctionManglings in LLDB, which
uses a similar hack in FastDemangle. Once that function has been updated to use
this version, FastDemangle can finally be removed.

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

llvm-svn: 339580

6 years ago[InstCombine] auto-generate full checks and add cos intrinsic test; NFC
Sanjay Patel [Mon, 13 Aug 2018 16:29:01 +0000 (16:29 +0000)]
[InstCombine] auto-generate full checks and add cos intrinsic test; NFC

llvm-svn: 339579

6 years ago[SLC] Expand simplification of pow() for vector types
Evandro Menezes [Mon, 13 Aug 2018 16:12:37 +0000 (16:12 +0000)]
[SLC] Expand simplification of pow() for vector types

Also consider vector constants when simplifying `pow()`.

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

llvm-svn: 339578

6 years ago[Tablegen] Replace uses of formatted_raw_ostream with raw_ostream in the predicate...
Andrea Di Biagio [Mon, 13 Aug 2018 15:13:35 +0000 (15:13 +0000)]
[Tablegen] Replace uses of formatted_raw_ostream with raw_ostream in the predicate expander. NFCI

This is a follow-up of r339552.

As pointed out by Craig in D50566, we don't need a formatted_raw_ostream to
indent strings. We can use instead raw_ostream::indent().

Internally, class PredicateExpander already keeps track of the current
indentation level. Also, the grammar for predicates is well parenthesized, and
therefore we don't need to use a formatted_raw_ostream to continuously track the
column number. Instead we can safely replace all the uses of
formatted_raw_ostream::PadToColumn() with uses of raw_ostream::indent().

By replacing formatted_raw_ostream with a simpler raw_ostream, we also avoid the
implicit check on the newline character on every print to stream.

No functional change intended.

llvm-svn: 339577

6 years ago[Hexagon] Silence -Wuninitialized warning from GCC 5.4, NFC
Krzysztof Parzyszek [Mon, 13 Aug 2018 15:08:25 +0000 (15:08 +0000)]
[Hexagon] Silence -Wuninitialized warning from GCC 5.4, NFC

Patch by Kim Gräsman.

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

llvm-svn: 339576

6 years ago[sanitizer] Remove st(X) from the clobber list in 32-bit x86 atomics
Kostya Kortchinsky [Mon, 13 Aug 2018 15:01:24 +0000 (15:01 +0000)]
[sanitizer] Remove st(X) from the clobber list in 32-bit x86 atomics

Summary:
When compiling with `WERROR=ON` & a recent clang, having the `st(?)` registers
in the clobber list produces a fatal error (except `st(7)` for some reason):
```
.../sanitizer_common/sanitizer_atomic_clang_x86.h:98:9: error: inline asm clobber list contains reserved registers: ST0, ST1, ST2, ST3, ST4, ST5, ST6 [-Werror,-Winline-asm]
        "movq %1, %%mm0;"  // Use mmx reg for 64-bit atomic moves
        ^
<inline asm>:1:1: note: instantiated into assembly here
        movq 8(%esp), %mm0;movq %mm0, (%esi);emms;
^
.../sanitizer_common/sanitizer_atomic_clang_x86.h:98:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
        "movq %1, %%mm0;"  // Use mmx reg for 64-bit atomic moves
        ^
<inline asm>:1:1: note: instantiated into assembly here
        movq 8(%esp), %mm0;movq %mm0, (%esi);emms;
^
```
As far as I can tell, they were in there due to the use of the `emms`
instruction, but removing the clobber doesn't appear to have a functional
impact. I am unsure if there is a better way to address this.

Reviewers: eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, delcypher, jfb, llvm-commits, #sanitizers

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

llvm-svn: 339575

6 years agoRevert "[OPENMP] Fix emission of the loop doacross constructs."
Alexey Bataev [Mon, 13 Aug 2018 14:42:18 +0000 (14:42 +0000)]
Revert "[OPENMP] Fix emission of the loop doacross constructs."

This reverts commit r339568 because of the problems with the buildbots.

llvm-svn: 339574

6 years ago[clang-format] Fix comment, NFC
Krasimir Georgiev [Mon, 13 Aug 2018 14:32:29 +0000 (14:32 +0000)]
[clang-format] Fix comment, NFC

llvm-svn: 339573

6 years agoFix lint tests for D50449
Kadir Cetinkaya [Mon, 13 Aug 2018 14:32:19 +0000 (14:32 +0000)]
Fix lint tests for D50449

Reviewers: ilya-biryukov, hokein

Reviewed By: hokein

Subscribers: hokein, ioeric, jkorous, arphaman, cfe-commits

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

llvm-svn: 339572

6 years ago[clang-tidy] Recognize [[clang::reinitializes]] attribute in bugprone-use-after-move
Martin Bohme [Mon, 13 Aug 2018 14:24:52 +0000 (14:24 +0000)]
[clang-tidy] Recognize [[clang::reinitializes]] attribute in bugprone-use-after-move

Summary:
This allows member functions to be marked as reinitializing the object. After a
moved-from object has been reinitialized, the check will no longer consider it
to be in an indeterminate state.

The patch that adds the attribute itself is at https://reviews.llvm.org/D49911

Reviewers: ilya-biryukov, aaron.ballman, alexfh, hokein, rsmith

Reviewed By: aaron.ballman

Subscribers: dblaikie, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 339571

6 years agoRevert "[Sparc] Add support for the cycle counter available in GR740"
Daniel Cederman [Mon, 13 Aug 2018 14:18:09 +0000 (14:18 +0000)]
Revert "[Sparc] Add support for the cycle counter available in GR740"

It breaks when using EXPENSIVE_CHECKS with the error message
"Bad machine code: Using an undefined physical register".

llvm-svn: 339570

6 years agoSummary:Add clang::reinitializes attribute
Martin Bohme [Mon, 13 Aug 2018 14:11:03 +0000 (14:11 +0000)]
Summary:Add clang::reinitializes attribute

Summary:
This is for use by clang-tidy's bugprone-use-after-move check -- see
corresponding clang-tidy patch at https://reviews.llvm.org/D49910.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 339569

6 years ago[OPENMP] Fix emission of the loop doacross constructs.
Alexey Bataev [Mon, 13 Aug 2018 14:05:43 +0000 (14:05 +0000)]
[OPENMP] Fix emission of the loop doacross constructs.

The number of loops associated with the OpenMP loop constructs should
not be considered as the number loops to collapse.

llvm-svn: 339568

6 years agoCheck for tied operands
Sid Manning [Mon, 13 Aug 2018 14:01:25 +0000 (14:01 +0000)]
Check for tied operands

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

llvm-svn: 339567

6 years ago[LLD][ELF] - Remove dead code from handleTlsRelocation. NFC.
George Rimar [Mon, 13 Aug 2018 13:59:06 +0000 (13:59 +0000)]
[LLD][ELF] - Remove dead code from handleTlsRelocation. NFC.

Code is dead because R_TLSDESC_CALL is already handled in the
following block of the code:
https://github.com/llvm-mirror/lld/blob/master/ELF/Relocations.cpp#L231

llvm-svn: 339566

6 years ago[SystemZ] Increase the amount of inlining.
Jonas Paulsson [Mon, 13 Aug 2018 13:31:30 +0000 (13:31 +0000)]
[SystemZ]  Increase the amount of inlining.

Implement getInliningThresholdMultiplier() and have it return 3.

Review: Ulrich Weigand
llvm-svn: 339563

6 years ago[X86] Add tests showing missing div/rem 0, X -> 0 combines
Simon Pilgrim [Mon, 13 Aug 2018 13:29:54 +0000 (13:29 +0000)]
[X86] Add tests showing missing div/rem 0, X -> 0 combines

llvm-svn: 339562

6 years ago[DAGCombiner] simplifyDivRem - add comment describing divide by undef/zero combine...
Simon Pilgrim [Mon, 13 Aug 2018 13:12:25 +0000 (13:12 +0000)]
[DAGCombiner] simplifyDivRem - add comment describing divide by undef/zero combine. NFC.

llvm-svn: 339561

6 years ago[ASTImporter] Improved import of friend templates.
Balazs Keri [Mon, 13 Aug 2018 13:08:37 +0000 (13:08 +0000)]
[ASTImporter] Improved import of friend templates.

Summary:
When importing a friend class template declaration,
this declaration should not be merged with any other existing declaration
for the same type. Otherwise the getFriendDecl of the FriendDecl can point
to an other already referenced declaration, this case causes problems.
Additionally the previous decl of class templates is set at import.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 339560

6 years ago[CMake] Fix bug in `add_weak_symbols()` function.
Dan Liew [Mon, 13 Aug 2018 12:59:38 +0000 (12:59 +0000)]
[CMake] Fix bug in `add_weak_symbols()` function.

Previously the the `weak_symbols.txt` files could be modified and the
build system wouldn't update the link flags automatically. Instead the
developer had to know to reconfigure CMake manually.

This is now fixed by telling CMake that the file being used to
read weak symbols from is a configure-time dependency.

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

llvm-svn: 339559