platform/upstream/llvm.git
6 years ago[ubsan] Merge ubsan_standalone_cxx shared library.
Evgeniy Stepanov [Thu, 28 Sep 2017 00:31:09 +0000 (00:31 +0000)]
[ubsan] Merge ubsan_standalone_cxx shared library.

Summary:
Link everything, including the C++ bits, in the single
ubsan_standalone SHARED library. This matches ASan setup.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits, mgorny

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

llvm-svn: 314369

6 years agoFix a UBsan bot.
Rui Ueyama [Thu, 28 Sep 2017 00:27:39 +0000 (00:27 +0000)]
Fix a UBsan bot.

If we do not initialize Prefix here, Prefix.data() returns a nullptr.
Later, it is passed to memcpy. memcpy's behavior is undefined if src (or
dst) is a nullptr even if a given size is 0. That's why this code
triggered UBsan.

llvm-svn: 314368

6 years ago[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.
Davide Italiano [Thu, 28 Sep 2017 00:24:20 +0000 (00:24 +0000)]
[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.

llvm-svn: 314367

6 years agoChange build-llvm.py and build-lldb-llvm-clang's patching mechanisms to
Jason Molenda [Wed, 27 Sep 2017 23:44:54 +0000 (23:44 +0000)]
Change build-llvm.py and build-lldb-llvm-clang's patching mechanisms to
assume git-style diffs.  Committing for Francis Ricci.

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

llvm-svn: 314366

6 years agoASan allocates a global data initialization array at the tail end of each
Dmitry Mikulin [Wed, 27 Sep 2017 23:32:01 +0000 (23:32 +0000)]
ASan allocates a global data initialization array at the tail end of each
compunit's .data section. This vector is not poisoned. Because of this the
first symbol of the following section has no left red zone. As a result, ASan
cannot detect underflow for such symbols.

Poison ASan allocated metadata, it should not be accessible to user code.

This fix does not eliminate the problem with missing left red zones but it
reduces the set of vulnerable symbols from first symbols in each input data
section to first symbols in the output section of the binary.

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

llvm-svn: 314365

6 years ago[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output
Eli Friedman [Wed, 27 Sep 2017 23:29:37 +0000 (23:29 +0000)]
[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output

Patch by Zbigniew Sarbinowski!

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

llvm-svn: 314364

6 years ago[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What...
Eugene Zelenko [Wed, 27 Sep 2017 23:26:01 +0000 (23:26 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 314363

6 years agoCheck for overflows when calculating the offset in GetGEPCost.
Justin Lebar [Wed, 27 Sep 2017 23:16:56 +0000 (23:16 +0000)]
Check for overflows when calculating the offset in GetGEPCost.

Summary:
This avoids C++ UB if the GEP is weird and the calculation overflows
int64_t, and it's also observable in the cost model's results.

Such GEPs are almost surely not valid pointers, but LLVM nonetheless
generates them sometimes.

Reviewers: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 314362

6 years agoReverted r313993.
Galina Kistanova [Wed, 27 Sep 2017 23:09:14 +0000 (23:09 +0000)]
Reverted r313993.

This patch produces a crash and hexagon_vector_loop_carried_reuse_constant.ll test fails on Windows (llvm-clang-x86_64-expensive-checks-win build bot).

llvm-svn: 314361

6 years agoRevert r314017 '[InstCombine] Simplify check for RHS being a splat constant in foldIC...
Craig Topper [Wed, 27 Sep 2017 22:57:18 +0000 (22:57 +0000)]
Revert r314017 '[InstCombine] Simplify check for RHS being a splat constant in foldICmpUsingKnownBits by just checking Op1Min==Op1Max rather than going through m_APInt.'

This reverts r314017 and similar code added in later commits. It seems to not work for pointer compares and is causing a bot failure for the last several days.

llvm-svn: 314360

6 years agoUpdate the description of AVR32 for the ELFDumper
Dylan McKay [Wed, 27 Sep 2017 22:39:37 +0000 (22:39 +0000)]
Update the description of AVR32 for the ELFDumper

AVR32 is an unrelated architecture with 32-bit addressing.

llvm-svn: 314359

6 years agoAdd support for running the lldb testsuite against an apple watch
Jason Molenda [Wed, 27 Sep 2017 22:12:54 +0000 (22:12 +0000)]
Add support for running the lldb testsuite against an apple watch
running watchos.  These tests cannot run on normal customer devices,
but I hope to some day have a public facing bot running against a
device.

llvm-svn: 314355

6 years ago[AVR] Update data layout to match current LLVM trunk
Dylan McKay [Wed, 27 Sep 2017 22:09:01 +0000 (22:09 +0000)]
[AVR] Update data layout to match current LLVM trunk

The data layout was changed in r314179 to fix atomic loads and stores.

llvm-svn: 314354

6 years agoFix -Wunused-variable for Release build.
Rui Ueyama [Wed, 27 Sep 2017 22:03:15 +0000 (22:03 +0000)]
Fix -Wunused-variable for Release build.

llvm-svn: 314353

6 years agoReturn the LoopUnrollResult from tryToUnrollLoop; NFC
Sanjoy Das [Wed, 27 Sep 2017 21:45:22 +0000 (21:45 +0000)]
Return the LoopUnrollResult from tryToUnrollLoop; NFC

I will use this in a later change.

llvm-svn: 314352

6 years agoLoopDeletion: use return value instead of passing in LPMUpdater; NFC
Sanjoy Das [Wed, 27 Sep 2017 21:45:21 +0000 (21:45 +0000)]
LoopDeletion: use return value instead of passing in LPMUpdater; NFC

I will use this refactoring in a later patch.

llvm-svn: 314351

6 years agoRename LoopUnrollStatus to LoopUnrollResult; NFC
Sanjoy Das [Wed, 27 Sep 2017 21:45:19 +0000 (21:45 +0000)]
Rename LoopUnrollStatus to LoopUnrollResult; NFC

A "Result" suffix is more appropriate here

llvm-svn: 314350

6 years agoFix off-by-one error in TarWriter.
Rui Ueyama [Wed, 27 Sep 2017 21:38:02 +0000 (21:38 +0000)]
Fix off-by-one error in TarWriter.

The tar format originally supported up to 99 byte filename. The two
extensions are proposed later: Ustar or PAX.

In the UStar extension, a pathanme is split at a '/' and its "prefix"
and "suffix" are stored in different locations in the tar header. Since
"prefix" can be up to 155 byte, it can represent up to 254 byte
filename (but exact limit depends on the location of '/' character in
a pathname.)

Our TarWriter first attempt to use UStar extension and then fallback to
PAX extension.

But there's a bug in UStar header creation. "Suffix" part must be a NUL-
terminated string, but we didn't handle it correctly. As a result, if
your filename just 100 characters long, the last character was droppped.

This patch fixes the issue.

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

llvm-svn: 314349

6 years ago[CMake] Fix typo: "in-tree" -> "in-source" (NFC)
Brian Gesiak [Wed, 27 Sep 2017 21:37:33 +0000 (21:37 +0000)]
[CMake] Fix typo: "in-tree" -> "in-source" (NFC)

Summary:
*In-source builds* of LLVM, in which a user invokes `cmake` from within the
LLVM source directory, or invokes `cmake -B/path/to/source/dir/of/llvm`,
are explicitly checked for and disallowed by LLVM's `CMakeLists.txt`.

*In-tree builds*, on the other hand, refer to when the source directories
of projects such as Clang are nested within the `llvm/tools` source
directory. These are not disallowed, and are in fact a common way of
building LLVM and Clang.

Revise the comment to match the logic underneath it: it checks for an
"in-source build", not an "in-tree build".

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny

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

llvm-svn: 314348

6 years agoRevert "Add support for custom loaders to symbolizer"
Francis Ricci [Wed, 27 Sep 2017 21:35:33 +0000 (21:35 +0000)]
Revert "Add support for custom loaders to symbolizer"

This broke the windows buildbots, revert for now.

This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7.

llvm-svn: 314347

6 years agoCleanup some problems with LLVM_ENABLE_DUMP in release builds, and
Don Hinton [Wed, 27 Sep 2017 21:19:56 +0000 (21:19 +0000)]
Cleanup some problems with LLVM_ENABLE_DUMP in release builds, and
always set LLVM_ENABLE_DUMP=ON for +Asserts builds.

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

llvm-svn: 314346

6 years agoDo not remove a target file in FileOutputBuffer::create().
Rui Ueyama [Wed, 27 Sep 2017 21:19:24 +0000 (21:19 +0000)]
Do not remove a target file in FileOutputBuffer::create().

FileOutputBuffer::create() attempts to remove a target file if the file
is a regular one, which results in an unexpected result in a failure
scenario.

If something goes wrong and the user of FileOutputBuffer decides to not
call commit(), it leaves nothing. An existing file is removed, and no
new file is created.

What we should do is to atomically replace an existing file with a new
file using rename(), so that it wouldn't remove an existing file without
creating a new one.

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

llvm-svn: 314345

6 years ago[scudo] Temporary disabling the valloc test on armhf
Kostya Kortchinsky [Wed, 27 Sep 2017 21:10:25 +0000 (21:10 +0000)]
[scudo] Temporary disabling the valloc test on armhf

Summary:
Weird failure where `errno != ENOMEM` on valloc failure. The returned pointer
is null since it passes the previous assert, so this shouldn't happen.

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/10931
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2469

Disabling until we figure out what's going on.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: aemerson, srhines, llvm-commits, kristof.beyls

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

llvm-svn: 314344

6 years agoUpdate the Objective-C runtime interface code to handle objc objects
Jason Molenda [Wed, 27 Sep 2017 20:56:32 +0000 (20:56 +0000)]
Update the Objective-C runtime interface code to handle objc objects
whose isa is an index instead of a pointer.  Currently, this type
of isa encoding is only used on watchos.
<rdar://problem/34675497>

llvm-svn: 314343

6 years agoAdd support for custom loaders to symbolizer
Francis Ricci [Wed, 27 Sep 2017 20:56:04 +0000 (20:56 +0000)]
Add support for custom loaders to symbolizer

Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60
llvm-svn: 314342

6 years ago[MachineOutliner] AArch64: Avoid saving + restoring LR if possible
Jessica Paquette [Wed, 27 Sep 2017 20:47:39 +0000 (20:47 +0000)]
[MachineOutliner] AArch64: Avoid saving + restoring LR if possible

This commit allows the outliner to avoid saving and restoring the link register
on AArch64 when it is dead within an entire class of candidates.

This introduces changes to the way the outliner interfaces with the target.
For example, the target now interfaces with the outliner using a
MachineOutlinerInfo struct rather than by using getOutliningCallOverhead and
getOutliningFrameOverhead.

This also improves several comments on the outliner's cost model.

https://reviews.llvm.org/D36721

llvm-svn: 314341

6 years agoRemove unnecessary semicolons
Jonathan Peyton [Wed, 27 Sep 2017 20:36:27 +0000 (20:36 +0000)]
Remove unnecessary semicolons

Removes semicolons after if {} blocks, function definitions, etc.
I was able to apply the large OMPT patch cleanly on top of this one
with no conflicts.

llvm-svn: 314340

6 years agoRevert r314249 "Recommit r314151 "[X86] Make all the NOREX CodeGenOnly instructions...
Craig Topper [Wed, 27 Sep 2017 20:34:17 +0000 (20:34 +0000)]
Revert r314249 "Recommit r314151 "[X86] Make all the NOREX CodeGenOnly instructions into postRA pseudos like the NOREX version of TEST."""

This caused PR34751

llvm-svn: 314339

6 years agoRevert r314248 "[X86] Don't emit X86::MOV8rr_NOREX from X86InstrInfo::copyPhysReg."
Craig Topper [Wed, 27 Sep 2017 20:34:13 +0000 (20:34 +0000)]
Revert r314248 "[X86] Don't emit X86::MOV8rr_NOREX from X86InstrInfo::copyPhysReg."

This contributed to PR34751

llvm-svn: 314338

6 years ago[X86][SSE] Pull out variable shuffle mask combine logic. NFCI.
Simon Pilgrim [Wed, 27 Sep 2017 20:19:53 +0000 (20:19 +0000)]
[X86][SSE] Pull out variable shuffle mask combine logic. NFCI.

Hopefully this will make it easier to vary the combine depth threshold per-target.

llvm-svn: 314337

6 years agoAdd support for remembering origins to ExternalASTMerger
Sean Callanan [Wed, 27 Sep 2017 19:57:58 +0000 (19:57 +0000)]
Add support for remembering origins to ExternalASTMerger

ExternalASTMerger has hitherto relied on being able to look up
any Decl through its named DeclContext chain. This works for
many cases, but causes problems for function-local structs,
which cannot be looked up in their containing FunctionDecl. An
example case is

void f() {
  { struct S { int a; }; }
  { struct S { bool b; }; }
}

It is not possible to lookup either of the two Ses individually
(or even to provide enough information to disambiguate) after
parsing is over; and there is typically no need to, since they
are invisible to the outside world.

However, ExternalASTMerger needs to be able to complete either
S on demand. This led to an XFAIL on test/Import/local-struct,
which this patch removes. The way the patch works is:

It defines a new data structure, ExternalASTMerger::OriginMap,
which clients are expected to maintain (default-constructing
if the origin does not have an ExternalASTMerger servicing it)
As DeclContexts are imported, if they cannot be looked up by
name they are placed in the OriginMap. This allows
ExternalASTMerger to complete them later if necessary.
As DeclContexts are imported from an origin that already has
its own OriginMap, the origins are forwarded – but only for
those DeclContexts that are actually used. This keeps the
amount of stored data minimal.

The patch also applies several improvements from review:

- Thoroughly documents the interface to ExternalASTMerger;
- Adds optional logging to help track what's going on; and
- Cleans up a bunch of braces and dangling elses.

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

llvm-svn: 314336

6 years ago[CodeGen] Emit necessary .note sections for -fsplit-stack
Than McIntosh [Wed, 27 Sep 2017 19:34:00 +0000 (19:34 +0000)]
[CodeGen] Emit necessary .note sections for -fsplit-stack

Summary:
According to https://gcc.gnu.org/wiki/SplitStacks, the linker expects a zero-sized .note.GNU-split-stack section if split-stack is used (and also .note.GNU-no-split-stack section if it also contains non-split-stack functions), so it can handle the cases where a split-stack function calls non-split-stack function.

This change adds the sections if needed.

Fixes PR #34670.

Reviewers: thanm, rnk, luqmana

Reviewed By: rnk

Subscribers: llvm-commits

Patch by Cherry Zhang <cherryyz@google.com>

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

llvm-svn: 314335

6 years ago[CUDA] Work around conflicting function definitions in CUDA-9 headers.
Artem Belevich [Wed, 27 Sep 2017 19:07:15 +0000 (19:07 +0000)]
[CUDA] Work around conflicting function definitions in CUDA-9 headers.

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

llvm-svn: 314334

6 years ago[builtins] ARM: Revert r314284, r314285 and r314289
Manoj Gupta [Wed, 27 Sep 2017 19:06:47 +0000 (19:06 +0000)]
[builtins] ARM: Revert r314284, r314285 and r314289

Revert r314284, r314285 and r314289 because of a reported
breakage in armv7k watchos builder.

llvm-svn: 314333

6 years ago[X86] Rewrite the zero vector checks in lowerV2X128VectorShuffle to use the Zeroable...
Craig Topper [Wed, 27 Sep 2017 18:56:20 +0000 (18:56 +0000)]
[X86] Rewrite the zero vector checks in lowerV2X128VectorShuffle to use the Zeroable APInt

We already have zeroable bits in an APInt. We might as well use that instead of checking for an all zero BUILD_VECTOR.

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

llvm-svn: 314332

6 years ago[X86] In combineLoopSADPattern, pad result with zeros and use full size add instead...
Craig Topper [Wed, 27 Sep 2017 18:36:45 +0000 (18:36 +0000)]
[X86] In combineLoopSADPattern, pad result with zeros and use full size add instead of using a smaller add and inserting.

In some cases the result psadbw is smaller than the type of the add that started the match. Currently in these cases we are using a smaller add and inserting the result.

If we instead combine the psadbw with zeros and use the full size add we can take advantage of implicit zeroing we get if we emit a narrower move before the add.

In a future patch, I want to make isel aware that the psadbw itself already zeroed the upper bits and remove the move entirely.

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

llvm-svn: 314331

6 years ago[OpenMP] Fix translation of target args
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:36 +0000 (18:12 +0000)]
[OpenMP] Fix translation of target args

ToolChain::TranslateArgs() returns nullptr if no changes are performed.
This would currently mean that OpenMPArgs are lost. Patch fixes this
by falling back to simply using OpenMPArgs in that case.

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

llvm-svn: 314330

6 years ago[OpenMP] Fix passing of -m arguments to device toolchain
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:34 +0000 (18:12 +0000)]
[OpenMP] Fix passing of -m arguments to device toolchain

AuxTriple is not set if host and device share a toolchain. Also,
removing an argument modifies the DAL which needs to be returned
for future use.
(Move tests back to offload-openmp.c as they are not related to GPUs.)

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

llvm-svn: 314329

6 years ago[OpenMP] Fix memory leak when translating arguments
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:31 +0000 (18:12 +0000)]
[OpenMP] Fix memory leak when translating arguments

Parsing the argument after -Xopenmp-target allocates memory that needs
to be freed. Associate it with the final DerivedArgList after we know
which one will be used.

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

llvm-svn: 314328

6 years agoclang-format/java: Unbreak genenrics formatting after r299952.
Nico Weber [Wed, 27 Sep 2017 17:57:50 +0000 (17:57 +0000)]
clang-format/java: Unbreak genenrics formatting after r299952.

https://reviews.llvm.org/rL299952 merged '>>>' tokens into a single
JavaRightLogicalShift token. This broke formatting of generics nested more than
two deep, e.g. Foo<Bar<Baz>>> because the '>>>' now weren't three '>' for
parseAngle().

Luckily, just deleting JavaRightLogicalShift fixes things without breaking the
test added in r299952, so do that.

https://reviews.llvm.org/D38291

llvm-svn: 314325

6 years ago[SLP] Fix crash on propagate IR flags for undef operands of min/max
Alexey Bataev [Wed, 27 Sep 2017 17:42:49 +0000 (17:42 +0000)]
[SLP] Fix crash on propagate IR flags for undef operands of min/max
reductions.

If both operands of the newly created SelectInst are Undefs the
resulting operation is also Undef, not SelectInst. It may cause crashes
when trying to propagate IR flags because function expects exactly
SelectInst instruction, nothing else.

llvm-svn: 314323

6 years ago[ARM] builtins: Replace abort by assert in clear_cache.
Manoj Gupta [Wed, 27 Sep 2017 17:36:25 +0000 (17:36 +0000)]
[ARM] builtins: Replace abort by assert in clear_cache.

Summary:
__builtion___clear_cache maps to clear_cache function. On Linux,
clear_cache functions makes a syscall and does an abort if syscall fails.
Replace the abort by an assert so that non-debug builds do not abort
if the syscall fails.

Fixes PR34588.

Reviewers: rengolin, compnerd, srhines, peter.smith, joerg

Reviewed By: rengolin

Subscribers: aemerson, kristof.beyls, llvm-commits

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

llvm-svn: 314322

6 years ago[support] mapped_file_region: and fix the windows code too
Roman Lebedev [Wed, 27 Sep 2017 17:24:34 +0000 (17:24 +0000)]
[support] mapped_file_region: and fix the windows code too

Followup for r314312 / r314313
Sorry, i really failed to fully grep all the codebase :/

llvm-svn: 314321

6 years ago[InstCombine] Gating select arithmetic optimization.
Chad Rosier [Wed, 27 Sep 2017 17:16:51 +0000 (17:16 +0000)]
[InstCombine] Gating select arithmetic optimization.

These changes faciliate positive behavior for arithmetic based select
expressions that match its translation criteria, keeping code size gated to
neutral or improved scenarios.

Patch by Michael Berg <michael_c_berg@apple.com>!

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

llvm-svn: 314320

6 years ago[AArch64][Falkor] Ignore SP based loads in HW prefetch fixups.
Geoff Berry [Wed, 27 Sep 2017 17:14:10 +0000 (17:14 +0000)]
[AArch64][Falkor] Ignore SP based loads in HW prefetch fixups.

Reviewers: mcrosier

Subscribers: aemerson, rengolin, javed.absar, kristof.beyls

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

llvm-svn: 314319

6 years ago[Sanitizer] Disable compact size class tests on Android
Alex Shlyapnikov [Wed, 27 Sep 2017 17:10:49 +0000 (17:10 +0000)]
[Sanitizer] Disable compact size class tests on Android

Fixing test failure on Android introduced in D38245. Compact size class
maps defined there are not to be used on Android.

llvm-svn: 314318

6 years ago[OpenCL] Fixed CL version in failing test.
Anastasia Stulova [Wed, 27 Sep 2017 17:03:35 +0000 (17:03 +0000)]
[OpenCL] Fixed CL version in failing test.

llvm-svn: 314317

6 years ago[Misched] : Fix typo in comment. NFC.
Javed Absar [Wed, 27 Sep 2017 16:39:17 +0000 (16:39 +0000)]
[Misched] : Fix typo in comment. NFC.

llvm-svn: 314316

6 years ago[SLP] fix typos/formatting; NFC
Sanjay Patel [Wed, 27 Sep 2017 16:32:56 +0000 (16:32 +0000)]
[SLP] fix typos/formatting; NFC

llvm-svn: 314315

6 years agoRevert "[llvm-cov] Create directory structure when filtering using -name*= options"
Sean Eveson [Wed, 27 Sep 2017 16:20:07 +0000 (16:20 +0000)]
Revert "[llvm-cov] Create directory structure when filtering using -name*= options"

Test failures.

llvm-svn: 314314

6 years ago[Support] mapped_file_region::size() returns size_t
Roman Lebedev [Wed, 27 Sep 2017 16:08:33 +0000 (16:08 +0000)]
[Support] mapped_file_region::size() returns size_t

Fixup last commit, found by clang-stage1-cmake-RA-incremental bot.

llvm-svn: 314313

6 years ago[Support] mapped_file_region: store size as size_t
Roman Lebedev [Wed, 27 Sep 2017 15:59:16 +0000 (15:59 +0000)]
[Support] mapped_file_region: store size as size_t

Summary:
Found when testing stage-2 build with D38101.

```
In file included from /build/llvm/lib/Support/Path.cpp:1045:
/build/llvm/lib/Support/Unix/Path.inc:648:14: error: comparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare]
  if (length > std::numeric_limits<size_t>::max()) {
      ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

`size_t` is `uint64_t` here, apparently, thus any `uint64_t` value
always fits into `size_t`.

Initial patch was to use some preprocessor logic to
not check if the size is known to fit at compile time.
But Zachary Turner suggested using this approach.

Reviewers: Bigcheese, rafael, zturner, mehdi_amini

Reviewed by (via email): zturner

Subscribers: llvm-commits

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

llvm-svn: 314312

6 years ago[Sanitizers] Allocator: new "release memory to OS" implementation
Alex Shlyapnikov [Wed, 27 Sep 2017 15:38:05 +0000 (15:38 +0000)]
[Sanitizers] Allocator: new "release memory to OS" implementation

Summary:
The current implementation of the allocator returning freed memory
back to OS (controlled by allocator_release_to_os_interval_ms flag)
requires sorting of the free chunks list, which has two major issues,
first, when free list grows to millions of chunks, sorting, even the
fastest one, is just too slow, and second, sorting chunks in place
is unacceptable for Scudo allocator as it makes allocations more
predictable and less secure.

The proposed approach is linear in complexity (altough requires quite
a bit more temporary memory). The idea is to count the number of free
chunks on each memory page and release pages containing free chunks
only. It requires one iteration over the free list of chunks and one
iteration over the array of page counters. The obvious disadvantage
is the allocation of the array of the counters, but even in the worst
case we support (4T allocator space, 64 buckets, 16 bytes bucket size,
full free list, which leads to 2 bytes per page counter and ~17M page
counters), requires just about 34Mb of the intermediate buffer (comparing
to ~64Gb of actually allocated chunks) and usually it stays under 100K
and released after each use. It is expected to be a relatively rare event,
releasing memory back to OS, keeping the buffer between those runs
and added complexity of the bookkeeping seems unnesessary here (it can
always be improved later, though, never say never).

The most interesting problem here is how to calculate the number of chunks
falling into each memory page in the bucket. Skipping all the details,
there are three cases when the number of chunks per page is constant:
  1) P >= C, P % C == 0 --> N = P / C
  2) C > P , C % P == 0 --> N = 1
  3) C <= P, P % C != 0 && C % (P % C) == 0 --> N = P / C + 1
where P is page size, C is chunk size and N is the number of chunks per
page and the rest of the cases, where the number of chunks per page is
calculated on the go, during the page counter array iteration.

Among the rest, there are still cases where N can be deduced from the
page index, but they require not that much less calculations per page
than the current "brute force" way and 2/3 of the buckets fall into
the first three categories anyway, so, for the sake of simplicity,
it was decided to stick to those two variations. It can always be
refined and improved later, should we see that brute force way slows
us down unacceptably.

Reviewers: eugenis, cryptoad, dvyukov

Subscribers: kubamracek, mehdi_amini, llvm-commits

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

llvm-svn: 314311

6 years ago[llvm-cov] Create directory structure when filtering using -name*= options
Sean Eveson [Wed, 27 Sep 2017 15:37:40 +0000 (15:37 +0000)]
[llvm-cov] Create directory structure when filtering using -name*= options

Before this change using any of the -name*= command line options with an output
directory would result in a single file (functions.txt/functions.html)
containing the coverage for those specific functions. Now you get the same
directory structure as when not using any -name*= options.

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

llvm-svn: 314310

6 years ago[clangd] Handle InitializeParams and store rootUri
Marc-Andre Laperle [Wed, 27 Sep 2017 15:31:17 +0000 (15:31 +0000)]
[clangd] Handle InitializeParams and store rootUri

Summary:
The root Uri is the workspace location and will be useful in the context of
indexing. We could also add more things to InitializeParams in order to
configure Clangd for C/C++ sepecific extensions.

Reviewers: ilya-biryukov, bkramer, krasimir, Nebiroth

Reviewed By: ilya-biryukov

Subscribers: ilya-biryukov

Tags: #clang-tools-extra

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

llvm-svn: 314309

6 years ago[SimplifyCFG] add a struct to house optional folds (PR34603)
Sanjay Patel [Wed, 27 Sep 2017 14:54:16 +0000 (14:54 +0000)]
[SimplifyCFG] add a struct to house optional folds (PR34603)

This was intended to be no-functional-change, but it's not - there's a test diff.

So I thought I should stop here and post it as-is to see if this looks like what was expected
based on the discussion in PR34603:
https://bugs.llvm.org/show_bug.cgi?id=34603

Notes:
 1. The test improvement occurs because the existing 'LateSimplifyCFG' marker is not carried
    through the recursive calls to 'SimplifyCFG()->SimplifyCFGOpt().run()->SimplifyCFG()'.
    The parameter isn't passed down, so we pick up the default value from the function signature
    after the first level. I assumed that was a bug, so I've passed 'Options' down in all of the
    'SimplifyCFG' calls.

 2. I split 'LateSimplifyCFG' into 2 bits: ConvertSwitchToLookupTable and KeepCanonicalLoops.
    This would theoretically allow us to differentiate the transforms controlled by those params
    independently.

 3. We could stash the optional AssumptionCache pointer and 'LoopHeaders' pointer in the struct too.
    I just stopped here to minimize the diffs.

 4. Similarly, I stopped short of messing with the pass manager layer. I have another question that
    could wait for the follow-up: why is the new pass manager creating the pass with LateSimplifyCFG
    set to true no matter where in the pipeline it's creating SimplifyCFG passes?

    // Create an early function pass manager to cleanup the output of the
    // frontend.
    EarlyFPM.addPass(SimplifyCFGPass());

    -->

    /// \brief Construct a pass with the default thresholds
    /// and switch optimizations.
    SimplifyCFGPass::SimplifyCFGPass()
       : BonusInstThreshold(UserBonusInstThreshold),
         LateSimplifyCFG(true) {}   <-- switches get converted to lookup tables and loops may not be in canonical form

    If this is unintended, then it's possible that the current behavior of dropping the 'LateSimplifyCFG'
    setting via recursion was masking this bug.

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

llvm-svn: 314308

6 years ago[InlineCost] add visitSelectInst()
Haicheng Wu [Wed, 27 Sep 2017 14:44:56 +0000 (14:44 +0000)]
[InlineCost] add visitSelectInst()

InlineCost can understand Select IR now.  This patch finds free Select IRs and
continue the propagation of SimplifiedValues, ConstantOffsetPtrs, and
SROAArgValues.

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

llvm-svn: 314307

6 years ago[X86][SKX][KNL] Updated regression tests to use -mattr instead of -mcpu flag.NFC.
Gadi Haber [Wed, 27 Sep 2017 14:44:15 +0000 (14:44 +0000)]
[X86][SKX][KNL] Updated regression tests to use -mattr instead of -mcpu flag.NFC.

NFC.
 Updated 8 regression tests to use -mattr instead of -mcpu flag as follows:
 -mcpu=knl --> -mattr=+avx512f
 -mcpu=skx --> -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq

The updates are as part of the preparation of a large commit to add all instruction scheduling for the SKX target.

Reviewers: delena, zvi, RKSimon
Differential Revision: https://reviews.llvm.org/D38222

Change-Id: I2381c9b5bb75ecacfca017243c22d054f6eddd14
llvm-svn: 314306

6 years agoX86 Tests: Unsigned saturation subtraction tests. NFC.
Zvi Rackover [Wed, 27 Sep 2017 14:38:05 +0000 (14:38 +0000)]
X86 Tests: Unsigned saturation subtraction tests. NFC.

Summary:
Adding tests for D37534.

Commit on behalf of julia.koval@intel.com

Reviewers: n.bozhenov, zvi, spatel, DavidKreitzer

Reviewed By: zvi

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

llvm-svn: 314305

6 years ago[OpenCL] Handle address space conversion while setting type alignment.
Anastasia Stulova [Wed, 27 Sep 2017 14:37:00 +0000 (14:37 +0000)]
[OpenCL] Handle address space conversion while setting type alignment.

Added missing addrspacecast case in alignment computation
logic of pointer type emission in IR generation.

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

llvm-svn: 314304

6 years ago[OpenMP] Add an additional test for D34888
Gheorghe-Teodor Bercea [Wed, 27 Sep 2017 14:31:08 +0000 (14:31 +0000)]
[OpenMP] Add an additional test for D34888

Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905

Reviewers: Hahnfeld, carlo.bertolli, caomhin, ABataev

Reviewed By: Hahnfeld

Subscribers: tra, cfe-commits

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

llvm-svn: 314303

6 years agorevert rL314300
Coby Tayree [Wed, 27 Sep 2017 13:02:44 +0000 (13:02 +0000)]
revert rL314300
accidently added only tests w/o the respective changes..

llvm-svn: 314302

6 years agoTypo: const MCSchedModel SchedModel -> const MCSchedModel &SchedModel
Krzysztof Parzyszek [Wed, 27 Sep 2017 12:48:48 +0000 (12:48 +0000)]
Typo: const MCSchedModel SchedModel -> const MCSchedModel &SchedModel

llvm-svn: 314301

6 years ago[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediat...
Coby Tayree [Wed, 27 Sep 2017 12:36:54 +0000 (12:36 +0000)]
[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions

Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized.
supersedes D33277, D35775
Corrsponds with D37412, D37413

llvm-svn: 314300

6 years ago[RegAllocGreedy] Fix spelling error, "inteference" -> "interference", NFC
Mikael Holmen [Wed, 27 Sep 2017 11:27:50 +0000 (11:27 +0000)]
[RegAllocGreedy] Fix spelling error, "inteference" -> "interference", NFC

llvm-svn: 314299

6 years ago[analyzer] Fix an outdated comment in a test. NFC.
Artem Dergachev [Wed, 27 Sep 2017 10:59:06 +0000 (10:59 +0000)]
[analyzer] Fix an outdated comment in a test. NFC.

llvm-svn: 314298

6 years ago[PowerPC] eliminate unconditional branch to the next instruction
Hiroshi Inoue [Wed, 27 Sep 2017 10:33:02 +0000 (10:33 +0000)]
[PowerPC] eliminate unconditional branch to the next instruction

This patch makes analyzeBranch eliminate unconditional branch to the next instruction.
After basic blocks are re-organized by optimizers, such as machine block placement, a BB may end with an unconditional branch to the next (fallthrough) BB. This patch removes such redundant branch instruction.

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

llvm-svn: 314297

6 years ago[Misched]: Remove double call getMicroOpFactor.NFC.
Javed Absar [Wed, 27 Sep 2017 10:31:58 +0000 (10:31 +0000)]
[Misched]: Remove double call getMicroOpFactor.NFC.

Reviewed by: @MatzeB
Differential Revision: https://reviews.llvm.org/D38176

llvm-svn: 314296

6 years ago[X86][AsmParser] fix PR32035
Coby Tayree [Wed, 27 Sep 2017 10:29:29 +0000 (10:29 +0000)]
[X86][AsmParser] fix PR32035

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

llvm-svn: 314295

6 years ago[test] Don't verify .debug_line offsets in bitcode tests.
Jonas Devlieghere [Wed, 27 Sep 2017 10:23:34 +0000 (10:23 +0000)]
[test] Don't verify .debug_line offsets in bitcode tests.

The exact values of the .debug_line offsets should not be hard-coded in
the checks for bitcode tests.

Fixes: http://bb.pgr.jp/builders/test-llvm-i686-linux-RA/builds/543
llvm-svn: 314294

6 years ago[X86][AVX] Improve (i4 bitcast (v4i1 x)) handling for 256-bit vector compare results.
Simon Pilgrim [Wed, 27 Sep 2017 10:10:17 +0000 (10:10 +0000)]
[X86][AVX] Improve (i4 bitcast (v4i1 x)) handling for 256-bit vector compare results.

As commented on D37849 and rL313547, AVX1 targets were missing a chance to use vmovmskpd for v4f64/v4i64 results for bool vector bitcasts

llvm-svn: 314293

6 years agoUse const where possible. NFCI.
Simon Pilgrim [Wed, 27 Sep 2017 10:03:17 +0000 (10:03 +0000)]
Use const where possible. NFCI.

llvm-svn: 314292

6 years ago[dwarfdump] Fix printing of .debug_line offset.
Jonas Devlieghere [Wed, 27 Sep 2017 10:00:27 +0000 (10:00 +0000)]
[dwarfdump] Fix printing of .debug_line offset.

Fixes 32-bit buildbots:
  http://bb.pgr.jp/builders/test-llvm-i686-linux-RA/builds/542
  http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/11533
  http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/11494

llvm-svn: 314291

6 years ago[analyzer] Match more patterns in bugreporter::getDerefExpr() API.
Artem Dergachev [Wed, 27 Sep 2017 09:50:45 +0000 (09:50 +0000)]
[analyzer] Match more patterns in bugreporter::getDerefExpr() API.

This function can now track null pointer through simple pointer arithmetic,
such as '*&*(p + 2)' => 'p' and so on, displaying intermediate diagnostic pieces
for the user to understand where the null pointer is coming from.

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

llvm-svn: 314290

6 years ago[builtins] fix build error on non-ARM for r314285.
Manoj Gupta [Wed, 27 Sep 2017 09:49:32 +0000 (09:49 +0000)]
[builtins] fix build error on non-ARM for r314285.

llvm-svn: 314289

6 years ago[dwarfdump] Add support for -debug-line=OFFSET
Jonas Devlieghere [Wed, 27 Sep 2017 09:33:45 +0000 (09:33 +0000)]
[dwarfdump] Add support for -debug-line=OFFSET

This patch adds support for passing an offset to -debug-line.

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

llvm-svn: 314288

6 years ago[analyzer] Fix and refactor bugreporter::getDerefExpr() API.
Artem Dergachev [Wed, 27 Sep 2017 09:33:37 +0000 (09:33 +0000)]
[analyzer] Fix and refactor bugreporter::getDerefExpr() API.

This API is used by checkers (and other entities) in order to track where does
a value originate from, by jumping from an expression value of which is equal
to that value to the expression from which this value has "appeared". For
example, it may be an lvalue from which the rvalue was loaded, or a function
call from which the dereferenced pointer was returned.

The function now avoids incorrectly unwrapping implicit lvalue-to-rvalue casts,
which caused crashes and incorrect intermediate diagnostic pieces. It also no
longer relies on how the expression is written when guessing what it means.

Fixes pr34373 and pr34731.

rdar://problem/33594502

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

llvm-svn: 314287

6 years ago[dwarfdump] Add support for -debug-loc=OFFSET
Jonas Devlieghere [Wed, 27 Sep 2017 09:33:36 +0000 (09:33 +0000)]
[dwarfdump] Add support for -debug-loc=OFFSET

This patch adds support for passing an offset to -debug-loc.

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

llvm-svn: 314286

6 years ago[Builtins] ARM: Fix assembling files in thumb mode.
Manoj Gupta [Wed, 27 Sep 2017 09:33:14 +0000 (09:33 +0000)]
[Builtins] ARM: Fix assembling files in thumb mode.

Summary:
clang does not assemble files in thumb mode unless .thumb declaration
is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that
files are assembled correctly.

Fixes PR 34715.

Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin

Reviewed By: compnerd

Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 314285

6 years ago[Builtins] ARM: Fix msr assembly instruction use for Thumb2.
Manoj Gupta [Wed, 27 Sep 2017 09:29:57 +0000 (09:29 +0000)]
[Builtins] ARM: Fix msr assembly instruction use for Thumb2.

Summary:
MSR instruction in Thumb2 does not support immediate operand.
Fix this by moving the condition for V7-M to Thumb2 since V7-M support
Thumb2 only. With this change, aeabi_cfcmp.s and aeabi_cdcmp.S files can
be assembled in Thumb2 mode. (This is split out from the review D38227).

Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, kristof.beyls

Reviewed By: compnerd

Subscribers: aemerson, javed.absar, llvm-commits

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

llvm-svn: 314284

6 years ago[ELF] - Detemplate of HashTableSection<ELFT>
George Rimar [Wed, 27 Sep 2017 09:14:59 +0000 (09:14 +0000)]
[ELF] - Detemplate of HashTableSection<ELFT>

Detemplation of one more synthetic section.

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

llvm-svn: 314283

6 years ago[ELF] - Speedup -r and --emit-relocs
George Rimar [Wed, 27 Sep 2017 09:08:53 +0000 (09:08 +0000)]
[ELF] - Speedup -r and --emit-relocs

This is "Bug 34688 - lld much slower than bfd when linking the linux kernel"

Inside copyRelocations() we have O(N*M) algorithm, where N - amount of
relocations and M - amount of symbols in symbol table. It isincredibly slow
for linking linux kernel.

Patch creates local search tables to speedup.
With this fix link time goes for me from 12.95s to 0.55s what is almost 23x
faster. (used release LLD).

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

llvm-svn: 314282

6 years ago[llvm-cov] Improve const-correctness of filters. NFC.
Sean Eveson [Wed, 27 Sep 2017 08:32:36 +0000 (08:32 +0000)]
[llvm-cov] Improve const-correctness of filters. NFC.

llvm-svn: 314281

6 years ago[ARM] isTruncateFree fix
Sam Parker [Wed, 27 Sep 2017 08:30:45 +0000 (08:30 +0000)]
[ARM] isTruncateFree fix

I implemented isTruncateFree in rL313533, this patch fixes the logic
to match my comment, as the previous logic was too general. Now the
only truncates that are free are i64 -> i32.

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

llvm-svn: 314280

6 years ago[clang-format] Fix FixNamespaceComments when BraceWrapping AfterNamespace is true.
Marek Kurdej [Wed, 27 Sep 2017 07:51:51 +0000 (07:51 +0000)]
[clang-format] Fix FixNamespaceComments when BraceWrapping AfterNamespace is true.

Summary:
NamespaceEndCommentsFixer did not fix namespace comments when the brace opening the namespace was not on the same line as the "namespace" keyword.
It occurs in Allman, GNU and Linux styles and whenever BraceWrapping.AfterNamespace is true.

Before:
```lang=cpp
    namespace a
    {
    void f();
    void g();
    }
```

After:
```lang=cpp
    namespace a
    {
    void f();
    void g();
    } // namespace a
```

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 314279

6 years ago[XRay] initialize all members of YAMLXRayRecord for -Wmissing-field-initializers
Martin Pelikan [Wed, 27 Sep 2017 07:30:48 +0000 (07:30 +0000)]
[XRay] initialize all members of YAMLXRayRecord for -Wmissing-field-initializers

llvm-svn: 314278

6 years ago[X86] Fix SJLJ struct offsets for x86_64
Martin Storsjo [Wed, 27 Sep 2017 06:08:23 +0000 (06:08 +0000)]
[X86] Fix SJLJ struct offsets for x86_64

This is necessary, but not sufficient, for having working SJLJ exception
handling on x86_64.

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

llvm-svn: 314277

6 years ago[X86] Remove erroneous callsite offsetting in SJLJ landing pads
Martin Storsjo [Wed, 27 Sep 2017 06:08:16 +0000 (06:08 +0000)]
[X86] Remove erroneous callsite offsetting in SJLJ landing pads

The callsite value is already stored indexed from 0 in
the _Unwind_Context struct. When accessed via the functions
_Unwind_GetIP and _Unwind_SetIP, the value is indexed from 1,
but those functions handle the offseting. When reading directly
from the struct here, we shouldn't subtract 1.

This matches the code generated by the ARM target, where SJLJ
exception handling is used by default on iOS.

This makes clang-built object files for 32 bit x86 mingw work when
linked with libgcc/libstdc++.

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

llvm-svn: 314276

6 years ago[X86] Correct byte offsets and data types in a comment. NFC.
Martin Storsjo [Wed, 27 Sep 2017 06:08:04 +0000 (06:08 +0000)]
[X86] Correct byte offsets and data types in a comment. NFC.

This matches the types of the struct members defined in
lib/CodeGen/SjLjEHPrepare.cpp, and the definition of this struct in libgcc.

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

llvm-svn: 314275

6 years ago[X86] Use extract128BitVector in LowerMULH so we can extract from constant build...
Craig Topper [Wed, 27 Sep 2017 06:04:55 +0000 (06:04 +0000)]
[X86] Use extract128BitVector in LowerMULH so we can extract from constant build vectors.

llvm-svn: 314274

6 years agoMemorySSAUpdater: Only add phis to insertedphis if we actually inserted them, not...
Daniel Berlin [Wed, 27 Sep 2017 05:35:19 +0000 (05:35 +0000)]
MemorySSAUpdater: Only add phis to insertedphis if we actually inserted them, not if we just found existing ones

llvm-svn: 314273

6 years ago[X86] Add avx512bw command lines to the 256-bit vector idiv tests.
Craig Topper [Wed, 27 Sep 2017 05:17:15 +0000 (05:17 +0000)]
[X86] Add avx512bw command lines to the 256-bit vector idiv tests.

Some of the operations are being sign extended to 512 bits with avx512bw.

llvm-svn: 314272

6 years ago[SelectionDAG] Make NewSDValueDbgMsg print target specific nodes correctly by passing...
Craig Topper [Wed, 27 Sep 2017 05:17:14 +0000 (05:17 +0000)]
[SelectionDAG] Make NewSDValueDbgMsg print target specific nodes correctly by passing in the SelectionDAG.

llvm-svn: 314271

6 years ago[XRay] fix the -Werror build by handling all enum cases in switches
Martin Pelikan [Wed, 27 Sep 2017 05:10:31 +0000 (05:10 +0000)]
[XRay] fix the -Werror build by handling all enum cases in switches

Followup to D32840.

llvm-svn: 314270

6 years ago[XRay] convert FDR arg1 log entries
Martin Pelikan [Wed, 27 Sep 2017 04:48:03 +0000 (04:48 +0000)]
[XRay] convert FDR arg1 log entries

Summary:
A new FDR metadata record will support logging a function call argument;
appending multiple metadata records will represent a sequence of arguments
meaning that "holes" are not representable by the buffer format.  Each
call argument is currently a 64-bit value (useful for "this" pointers and
synchronization objects).

If present, we put this argument to the function call "entry" record it
belongs to, and alter its type to notify the user of its presence.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 314269

6 years agoAdd test forgotten in r314262.
Erich Keane [Wed, 27 Sep 2017 03:23:02 +0000 (03:23 +0000)]
Add test forgotten in r314262.

llvm-svn: 314268

6 years agoFix capitalization of a bunch of parameters in SemaDeclAttr [NFC]
Erich Keane [Wed, 27 Sep 2017 03:20:13 +0000 (03:20 +0000)]
Fix capitalization of a bunch of parameters in SemaDeclAttr [NFC]

llvm-svn: 314267

6 years ago[SimplifyIndVar] Constant fold IV users
Hongbin Zheng [Wed, 27 Sep 2017 03:11:46 +0000 (03:11 +0000)]
[SimplifyIndVar] Constant fold IV users

This patch tries to transform cases like:

for (unsigned i = 0; i < N; i += 2) {
  bool c0 = (i & 0x1) == 0;
  bool c1 = ((i + 1) & 0x1) == 1;
}
To

for (unsigned i = 0; i < N; i += 2) {
  bool c0 = true;
  bool c1 = true;
}

This commit also update test/Transforms/IndVarSimplify/replace-srem-by-urem.ll to prevent constant folding.

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

llvm-svn: 314266

6 years agoUpdate ABIMacOSX_arm::PrepareTrivialCall to correctly align the
Jason Molenda [Wed, 27 Sep 2017 02:49:18 +0000 (02:49 +0000)]
Update ABIMacOSX_arm::PrepareTrivialCall to correctly align the
stack pointer for apple's armv7 ABI.  When in a frameless function
or in a prologue/epilogue where sp wasn't properly aligned, we could
try to make function calls with an unaligned sp; the expression
would crash.

llvm-svn: 314265

6 years ago[clang-format] Adjust space around &/&& of structured bindings
Chih-Hung Hsieh [Wed, 27 Sep 2017 00:58:45 +0000 (00:58 +0000)]
[clang-format] Adjust space around &/&& of structured bindings

Keep space before or after the &/&& tokens, but not both. For example,
  auto [x,y] = a;
  auto &[xr, yr] = a; // LLVM style
  auto& [xr, yr] = a; // google style

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

llvm-svn: 314264