platform/upstream/llvm.git
6 years ago[ScopInfo] Completely remove MemoryAccesses when their parent statement is removed.
Michael Kruse [Mon, 9 Apr 2018 23:13:05 +0000 (23:13 +0000)]
[ScopInfo] Completely remove MemoryAccesses when their parent statement is removed.

Removing a statement left its MemoryAccesses in some lists and maps of
the SCoP.  Which lists depends on at which phase of the SCoP
construction the statement is deleted.  Follow-up passes could still see
the already deleted MemoryAccesses by iterating through these
lists/maps, resulting in an access violation.

When removing a ScopStmt, also remove all its MemoryAccesses by using
the same mechnism that removes a MemoryAccess.

llvm-svn: 329640

6 years ago[ScopInfo] Actually remove from list.
Michael Kruse [Mon, 9 Apr 2018 23:13:01 +0000 (23:13 +0000)]
[ScopInfo] Actually remove from list.

std::remove, despite its name, does not remove elements from a list, but
only moves them to the end of a list.  Call erase() to shorten the
vector to the remaining elements.

Test case included in next commit.

llvm-svn: 329639

6 years ago[MemorySSA] remove cruft; NFC.
George Burgess IV [Mon, 9 Apr 2018 23:09:27 +0000 (23:09 +0000)]
[MemorySSA] remove cruft; NFC.

The caching walker used to hold its own caches, which made its `reset()`
function meaningful. Since caching has been moved out of it, there's no
reason to continue to have these cache-related methods.

Similarly, the EXPENSIVE_CHECKS block that's getting removed used to
rerun the query with caching disabled. Since that's how we always do
queries now, it's redundant.

llvm-svn: 329638

6 years agoAdd --warn-backrefs to maintain compatibility with other linkers
Rui Ueyama [Mon, 9 Apr 2018 23:05:48 +0000 (23:05 +0000)]
Add --warn-backrefs to maintain compatibility with other linkers

I'm proposing a new command line flag, --warn-backrefs in this patch.
The flag and the feature proposed below don't exist in GNU linkers
nor the current lld.

--warn-backrefs is an option to detect reverse or cyclic dependencies
between static archives, and it can be used to keep your program
compatible with GNU linkers after you switch to lld. I'll explain the
feature and why you may find it useful below.

lld's symbol resolution semantics is more relaxed than traditional
Unix linkers. Therefore,

  ld.lld foo.a bar.o

succeeds even if bar.o contains an undefined symbol that have to be
resolved by some object file in foo.a. Traditional Unix linkers
don't allow this kind of backward reference, as they visit each
file only once from left to right in the command line while
resolving all undefined symbol at the moment of visiting.

In the above case, since there's no undefined symbol when a linker
visits foo.a, no files are pulled out from foo.a, and because the
linker forgets about foo.a after visiting, it can't resolve
undefined symbols that could have been resolved otherwise.

That lld accepts more relaxed form means (besides it makes more
sense) that you can accidentally write a command line or a build
file that works only with lld, even if you have a plan to
distribute it to wider users who may be using GNU linkers.  With
--check-library-dependency, you can detect a library order that
doesn't work with other Unix linkers.

The option is also useful to detect cyclic dependencies between
static archives. Again, lld accepts

  ld.lld foo.a bar.a

even if foo.a and bar.a depend on each other. With --warn-backrefs
it is handled as an error.

Here is how the option works. We assign a group ID to each file. A
file with a smaller group ID can pull out object files from an
archive file with an equal or greater group ID. Otherwise, it is a
reverse dependency and an error.

A file outside --{start,end}-group gets a fresh ID when
instantiated. All files within the same --{start,end}-group get the
same group ID. E.g.

  ld.lld A B --start-group C D --end-group E

A and B form group 0, C, D and their member object files form group
1, and E forms group 2. I think that you can see how this group
assignment rule simulates the traditional linker's semantics.

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

llvm-svn: 329636

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 22:48:22 +0000 (22:48 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

This reapplies r329617. r329617 didn't specify the underlying type for
enum ArgPassingKind, which caused regression tests to fail on a windows
bot.

rdar://problem/39194693

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

llvm-svn: 329635

6 years agoGetRandom / OpenBSD, using getentropy to get high quality randomness
Vitaly Buka [Mon, 9 Apr 2018 22:46:40 +0000 (22:46 +0000)]
GetRandom / OpenBSD, using getentropy to get high quality randomness

Summary:
- getentropy presence since late 2014, safe to use.
- guarantees to delivers good random data up to 256 bytes.
- fall back to /dev/urandom as long the buffer is correct.

Patch by David CARLIER

Reviewers: kubamracek, vitalybuka

Reviewed By: vitalybuka

Subscribers: cryptoad, llvm-commits, #sanitizers

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

llvm-svn: 329633

6 years ago[MemorySSA] Remove redundant assert; NFC
George Burgess IV [Mon, 9 Apr 2018 22:45:14 +0000 (22:45 +0000)]
[MemorySSA] Remove redundant assert; NFC

The `if (!Def && !Use) return nullptr;` right above this assert sort of
defeats the purpose.

llvm-svn: 329632

6 years agolibFuzzer, OpenBSD support
Vitaly Buka [Mon, 9 Apr 2018 22:38:26 +0000 (22:38 +0000)]
libFuzzer, OpenBSD support

Summary:
- Enabling libfuzzer on OpenBSD
- OpenBSD can t support asan, msan ... the tests can t be run.

Patch by David CARLIER

Reviewers: eugenis, phosek, vitalybuka

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 329631

6 years ago[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Mon, 9 Apr 2018 22:14:10 +0000 (22:14 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

llvm-svn: 329630

6 years ago[CFI] Disable CFI checks for __cxa_decrement_exception_refcount
Vlad Tsyrklevich [Mon, 9 Apr 2018 22:11:28 +0000 (22:11 +0000)]
[CFI] Disable CFI checks for __cxa_decrement_exception_refcount

Summary:
exception_header->exceptionDestructor is a void(*)(void*) function
pointer; however, it can point to destructors like std::
exception::~exception that don't match that type signature.

Reviewers: pcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: kcc, christof, cfe-commits

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

llvm-svn: 329629

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Mon, 9 Apr 2018 21:54:38 +0000 (21:54 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 329628

6 years agoRevert "[ObjC++] Never pass structs that transitively contain __weak fields in"
Akira Hatanaka [Mon, 9 Apr 2018 21:47:58 +0000 (21:47 +0000)]
Revert "[ObjC++] Never pass structs that transitively contain __weak fields in"

This reverts commit r329617. It broke a windows bot.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16372/steps/test/logs/stdio

llvm-svn: 329627

6 years ago[X86] Added missing AAD/AAM immediate schedule tests
Simon Pilgrim [Mon, 9 Apr 2018 21:46:57 +0000 (21:46 +0000)]
[X86] Added missing AAD/AAM immediate schedule tests

Added some more TODOs for missing instructions

llvm-svn: 329626

6 years ago[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsB...
Daniel Sanders [Mon, 9 Apr 2018 21:10:09 +0000 (21:10 +0000)]
[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsBuilder() and use it in AArch64.

Lower is slightly odd. It often doesn't change the type but the lowerings
do use the new type to decide what code to create. Treat it like a mutation
but provide convenience functions that re-use the existing type.

Re-uses the existing tests:
test/CodeGen/AArch64/GlobalISel/legalize-rem.mir
test/CodeGen/AArch64/GlobalISel//legalize-mul.mir
test/CodeGen/AArch64/GlobalISel//legalize-cmpxchg-with-success.mir

llvm-svn: 329623

6 years agoFix printing of stack id in MachineFrameInfo
Matt Arsenault [Mon, 9 Apr 2018 21:04:30 +0000 (21:04 +0000)]
Fix printing of stack id in MachineFrameInfo

uint8_t is printed as a char, so it needs to be
casted to do the right thing.

llvm-svn: 329622

6 years ago[MemorySSAUpdater] Mark Phi users of a node being moved as non-optimize
Zhaoshi Zheng [Mon, 9 Apr 2018 20:55:37 +0000 (20:55 +0000)]
[MemorySSAUpdater] Mark Phi users of a node being moved as non-optimize

Fix PR36484, as suggested:

<quote>
during moves, mark the direct users of the erased things that were phis as "not to be optimized"
<quote>

llvm-svn: 329621

6 years agoAMDGPU: Remove max_scratch_backing_memory_byte_size from kernel header
Konstantin Zhuravlyov [Mon, 9 Apr 2018 20:47:22 +0000 (20:47 +0000)]
AMDGPU: Remove max_scratch_backing_memory_byte_size from kernel header

1. Remove max_scratch_backing_memory_byte_size from kernel header
2. Make it a reserved field
3. Ignore it while parsing assembly for backwards compatibility
4. Bump up minor version of kernel header

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

llvm-svn: 329620

6 years ago[test] [NFC] cleanup aligned_storage test
Casey Carter [Mon, 9 Apr 2018 20:41:45 +0000 (20:41 +0000)]
[test] [NFC] cleanup aligned_storage test

* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`

llvm-svn: 329618

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 20:39:47 +0000 (20:39 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

rdar://problem/39194693

llvm-svn: 329617

6 years ago[X86] Don't use Lower512IntUnary to split bitcasts with v32i16/v64i8 types on targets...
Craig Topper [Mon, 9 Apr 2018 20:37:14 +0000 (20:37 +0000)]
[X86] Don't use Lower512IntUnary to split bitcasts with v32i16/v64i8 types on targets without AVX512BW.

LowerIntUnary as its name says has an assert for integer types. But for the bitcast case one side might be an FP type.

Rather than making sure the function really works for fp types and renaming it. Just do really basic splitting directly. The LowerIntUnary has the advantage that it can peek through BUILD_VECTOR because every other call is during Lowering. But these calls are during legalization and will be followed by a DAG combine round.

Revert some change to LowerVectorIntUnary that were originally made just to make these two calls work even in pure integer cases.

This was found purely by compiling the avx512f-builtins.c test from clang so I've copied over the offending function from that.

llvm-svn: 329616

6 years agoshadowcallstack: Make runtime tests compatible with aarch64.
Peter Collingbourne [Mon, 9 Apr 2018 20:18:10 +0000 (20:18 +0000)]
shadowcallstack: Make runtime tests compatible with aarch64.

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

llvm-svn: 329614

6 years ago[Debuginfo][COFF] Minimal serialization support for precompiled types records
Alexandre Ganea [Mon, 9 Apr 2018 20:17:56 +0000 (20:17 +0000)]
[Debuginfo][COFF] Minimal serialization support for precompiled types records

This change adds support for the LF_PRECOMP and LF_ENDPRECOMP records required
to read/write Microsoft precompiled types .objs.
See https://en.wikipedia.org/wiki/Precompiled_header#Microsoft_Visual_C_and_C++

This also adds handling for the .debug$P section, which is actually a .debug$T
section in disguise, found only in precompiled .objs.

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

llvm-svn: 329613

6 years agoasan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address
Vitaly Buka [Mon, 9 Apr 2018 20:10:29 +0000 (20:10 +0000)]
asan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address

Summary:
Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address")  disable both ASan and KASan instrumentation. Also remove redundant test.

Patch by Andrey Konovalov

Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka

Reviewed By: eugenis, vitalybuka

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

llvm-svn: 329612

6 years agoAArch64: Allow offsets to be folded into addresses with ELF.
Peter Collingbourne [Mon, 9 Apr 2018 19:59:57 +0000 (19:59 +0000)]
AArch64: Allow offsets to be folded into addresses with ELF.

This is a code size win in code that takes offseted addresses
frequently, such as C++ constructors that typically need to compute
an offseted address of a vtable. It reduces the size of Chromium for
Android's .text section by 46KB, or 56KB with ThinLTO (which exposes
more opportunities to use a direct access rather than a GOT access).

Because the addend range is limited in COFF and Mach-O, this is
enabled for ELF only.

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

llvm-svn: 329611

6 years agoRevert "AMDGPU: enable 128-bit for local addr space under an option"
Alex Shlyapnikov [Mon, 9 Apr 2018 19:47:38 +0000 (19:47 +0000)]
Revert "AMDGPU: enable 128-bit for local addr space under an option"

This reverts commit r329591.

It breaks various bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/16516
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17374
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/15992
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11251
...

llvm-svn: 329610

6 years agoCOFF: Remove dead code. NFCI.
Peter Collingbourne [Mon, 9 Apr 2018 19:46:00 +0000 (19:46 +0000)]
COFF: Remove dead code. NFCI.

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

llvm-svn: 329609

6 years agoRevert "[ObjC] Make C++ triviality type traits available to non-trivial C"
Akira Hatanaka [Mon, 9 Apr 2018 19:39:27 +0000 (19:39 +0000)]
Revert "[ObjC] Make C++ triviality type traits available to non-trivial C"

This reverts commit r329289.

It was decided that we shouldn't expose the __has_* traits to C since
they are deprecated and useless.

See the discussion here:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/thread.html#223921

llvm-svn: 329608

6 years ago[WebAssembly] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 9 Apr 2018 19:38:31 +0000 (19:38 +0000)]
[WebAssembly] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: sunfish, RKSimon

Reviewed By: sunfish

Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits

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

llvm-svn: 329607

6 years ago[sanitizer] Reverting rCRT329595
Kostya Kortchinsky [Mon, 9 Apr 2018 19:18:50 +0000 (19:18 +0000)]
[sanitizer] Reverting rCRT329595

Summary:
Even this version seems to mess with Android somehow. Reverting for now while
I figure out what's up.

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

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

llvm-svn: 329606

6 years ago[X86] Emit native IR for pmuldq/pmuludq builtins.
Craig Topper [Mon, 9 Apr 2018 19:17:54 +0000 (19:17 +0000)]
[X86] Emit native IR for pmuldq/pmuludq builtins.

I believe all the pieces are now in place in the backend to make this work correctly. We can either mask the input to 32 bits for pmuludg or shl/ashr for pmuldq and use a regular mul instruction. The backend should combine this to PMULUDQ/PMULDQ and then SimplifyDemandedBits will remove the and/shifts.

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

llvm-svn: 329605

6 years ago[X86] Remove GCCBuiltin name from pmuldq/pmuludq intrinsics so clang can custom lower...
Craig Topper [Mon, 9 Apr 2018 19:17:38 +0000 (19:17 +0000)]
[X86] Remove GCCBuiltin name from pmuldq/pmuludq intrinsics so clang can custom lower to native IR. Update fast-isel intrinsic tests for clang's new codegen.

In somes cases fast-isel fails to remove the and/shifts and uses blends or conditional moves.

But once masking gets involved, fast-isel aborts on the mask portion and we DAG combine more thorougly.

llvm-svn: 329604

6 years ago[SLP] Additional tests for reorder reuse vectorization, NFC.
Alexey Bataev [Mon, 9 Apr 2018 19:02:34 +0000 (19:02 +0000)]
[SLP] Additional tests for reorder reuse vectorization, NFC.

llvm-svn: 329603

6 years agoFix type mismatch between MachineMemOperand constructor and accessors. NFC
Daniel Sanders [Mon, 9 Apr 2018 18:42:19 +0000 (18:42 +0000)]
Fix type mismatch between MachineMemOperand constructor and accessors. NFC

This allows MachineMemOperand::getSize()'s result to be fed directly into
MachineMemOperand::MachineMemOperand() without a narrowing type conversion
warning.

llvm-svn: 329602

6 years ago[demangler] Support for fold expressions.
Erik Pilkington [Mon, 9 Apr 2018 18:33:01 +0000 (18:33 +0000)]
[demangler] Support for fold expressions.

llvm-svn: 329601

6 years ago[demangler] Support for <data-member-prefix>.
Erik Pilkington [Mon, 9 Apr 2018 18:32:25 +0000 (18:32 +0000)]
[demangler] Support for <data-member-prefix>.

llvm-svn: 329600

6 years ago[demangler] Support for partially substituted sizeof....
Erik Pilkington [Mon, 9 Apr 2018 18:31:50 +0000 (18:31 +0000)]
[demangler] Support for partially substituted sizeof....

llvm-svn: 329599

6 years agoAdded support for LTO options: sample_profile, new_pass_manager and debug_pass_manager
Rumeet Dhindsa [Mon, 9 Apr 2018 17:56:07 +0000 (17:56 +0000)]
Added support for LTO options: sample_profile, new_pass_manager and debug_pass_manager

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

llvm-svn: 329598

6 years agoFix compilation error caused by tgmath.h.
Tatyana Krasnukha [Mon, 9 Apr 2018 17:32:56 +0000 (17:32 +0000)]
Fix compilation error caused by tgmath.h.

On CentOS calling functions from <tgmath.h> produces multiple errors "'void*' is not a pointer-to-object type".

llvm-svn: 329597

6 years ago[GISel] Refactor MachineIRBuilder to allow transformations while
Aditya Nandakumar [Mon, 9 Apr 2018 17:30:56 +0000 (17:30 +0000)]
[GISel] Refactor MachineIRBuilder to allow transformations while
building.

https://reviews.llvm.org/D45067

This change attempts to do two things:
1) It separates out the state that is stored in the
MachineIRBuilder(InsertionPt, MF, MRI, InsertFunction etc) into a
separate object called MachineIRBuilderState.
2) Add the ability to constant fold operations while building instructions
(optionally). MachineIRBuilder is now refactored into a MachineIRBuilderBase
which contains lots of non foldable build methods and their implementation.
Instructions which can be constant folded/transformed are now in a class
called FoldableInstructionBuilder which uses CRTP to use the implementation
of the derived class for buildBinaryOps. Additionally buildInstr in the derived
class can be used to implement other kinds of transformations.

Also because of separation of state, given a MachineIRBuilder in an API,
if one wishes to use another MachineIRBuilder, a new one can be
constructed from the state locally. For eg,

void doFoo(MachineIRBuilder &B) {
  MyCustomBuilder CustomB(B.getState());
  // Use CustomB for building.
}

reviewed by : aemerson

llvm-svn: 329596

6 years ago[sanitizer] Allow BackgroundThread to not depend on StackDepot
Kostya Kortchinsky [Mon, 9 Apr 2018 17:25:57 +0000 (17:25 +0000)]
[sanitizer] Allow BackgroundThread to not depend on StackDepot

Summary:
Still pursuing the ultimate goal of splitting the Symbolizer code from
RTSanitizerCommon core, allow `BackgroundThread` to work even when not linked
with `sanitizer_stackdepot.cc`. There is no reason this function should pull in
the whole `StackDepot` if symbolization is not supported.

Currently this has no functional change as the depot is always linked anyway.

Reviewers: alekseyshl

Reviewed By: alekseyshl

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

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

llvm-svn: 329595

6 years ago[cmake] Include LLVMTestingSupport when doing stand-alone build
Michal Gorny [Mon, 9 Apr 2018 17:08:14 +0000 (17:08 +0000)]
[cmake] Include LLVMTestingSupport when doing stand-alone build

Explicitly include and build lib/Testing/Support from LLVM sources when
doing a stand-alone build. This is necessary since clangd tests started
to depend on LLVMTestingSupport library which is neither installed
by LLVM, nor built by clang itself.

Since completely separate build of clang-tools-extra is not supported,
this relies on variables set by clang CMakeLists.

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

llvm-svn: 329594

6 years ago[X86] Revert the SLM part of r328914.
Craig Topper [Mon, 9 Apr 2018 17:07:40 +0000 (17:07 +0000)]
[X86] Revert the SLM part of r328914.

While it appears to be correct information based on Intel's optimization manual and Agner's data, it causes perf regressions on a couple of the benchmarks in our internal list.

llvm-svn: 329593

6 years ago[llvm-mca] Fix MCACommentConsumer
Fangrui Song [Mon, 9 Apr 2018 17:06:57 +0000 (17:06 +0000)]
[llvm-mca] Fix MCACommentConsumer

llvm-svn: 329592

6 years agoAMDGPU: enable 128-bit for local addr space under an option
Marek Olsak [Mon, 9 Apr 2018 16:56:32 +0000 (16:56 +0000)]
AMDGPU: enable 128-bit for local addr space under an option

Author: Samuel Pitoiset

ds_read_b128 and ds_write_b128 have been recently enabled
under the amdgpu-ds128 option because the performance benefit
is unclear.

Though, using 128-bit loads/stores for the local address space
appears to introduce regressions in tessellation shaders. Not
sure what is broken, but as ds_read_b128/ds_write_b128 are not
enabled by default, just introduce a global option and enable
128-bit only if requested (until it's fixed/used correctly).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105464
llvm-svn: 329591

6 years ago[llvm-mca] Add the ability to mark regions of code for analysis (PR36875)
Andrea Di Biagio [Mon, 9 Apr 2018 16:39:52 +0000 (16:39 +0000)]
[llvm-mca] Add the ability to mark regions of code for analysis (PR36875)

This patch teaches llvm-mca how to parse code comments in search for special
"markers" used to select regions of code.

Example:

# LLVM-MCA-BEGIN My Code Region
  ....
# LLVM-MCA-END

The MCAsmLexer now delegates to an object of class MCACommentParser (i.e. an
AsmCommentConsumer) the parsing of code comments to search for begin/end code
region markers.

A comment starting with substring "LLVM-MCA-BEGIN" marks the beginning of a new
region of code.  A comment starting with substring "LLVM-MCA-END" marks the end
of the last region.

This implementation doesn't allow regions to overlap. Each region can have a
optional description; internally, each region is identified by a range of source
code locations (SMLoc).

MCInst objects are added to a region R only if the source location for the
MCInst is in the range of locations specified by R.

By default, the tool allocates an implicit "Default" code region which contains
every source location.  See new tests llvm-mca-marker-*.s for a few examples.

A new Backend object is created for every region. So, the analysis is conducted
on every parsed code region.  The final report is the union of the reports
generated for every code region.  Note that empty regions are skipped.

Special "[#] Code Region - ..." strings are used in the report to mark the
portion which is specific to a code region only. For example, see
llvm-mca-markers-5.s.

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

llvm-svn: 329590

6 years agoAMDGPU: Initialize GlobalISel passes
Tom Stellard [Mon, 9 Apr 2018 16:09:13 +0000 (16:09 +0000)]
AMDGPU: Initialize GlobalISel passes

Summary:
This fixes AMDGPU GlobalISel test failures when enabling the AMDGPU
target without any other targets that use GlobalISel.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 329588

6 years ago[X86][SSE] Add floating point add/mul strict (ordered) vector.reduce tests (PR36732)
Simon Pilgrim [Mon, 9 Apr 2018 16:01:44 +0000 (16:01 +0000)]
[X86][SSE] Add floating point add/mul strict (ordered) vector.reduce tests (PR36732)

llvm-svn: 329587

6 years ago[ASan] NFC: make use of a new ErrorBase ctor
Alex Shlyapnikov [Mon, 9 Apr 2018 16:00:10 +0000 (16:00 +0000)]
[ASan] NFC: make use of a new ErrorBase ctor

Summary:
Minor style changes to complement D44404:
- make use of a new ErrorBase ctor
- de-duplicate a comment about VS2013 support

Reviewers: eugenis

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

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

llvm-svn: 329586

6 years agoSupport generic expansion of ordered vector reduction (PR36732)
Simon Pilgrim [Mon, 9 Apr 2018 15:44:20 +0000 (15:44 +0000)]
Support generic expansion of ordered vector reduction (PR36732)

Without the fast math flags, the llvm.experimental.vector.reduce.fadd/fmul intrinsic expansions must be expanded in order.

This patch scalarizes the reduction, applying the accumulator at the start of the sequence: ((((Acc + Scl[0]) + Scl[1]) + Scl[2]) + ) ... + Scl[NumElts-1]

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

llvm-svn: 329585

6 years ago[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets
Yaxun Liu [Mon, 9 Apr 2018 15:43:01 +0000 (15:43 +0000)]
[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets

amdgcn targets only support HIP, which does not define __CUDA_ARCH__.

this is a partial unroll of r329232 / D45277.

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

llvm-svn: 329584

6 years ago[clangd] Bump v0.0.6 for vscode-clangd.
Haojian Wu [Mon, 9 Apr 2018 15:37:09 +0000 (15:37 +0000)]
[clangd] Bump v0.0.6 for vscode-clangd.

llvm-svn: 329583

6 years ago[clang] Use compile-command interpolation to provide commands for header files.
Sam McCall [Mon, 9 Apr 2018 15:22:08 +0000 (15:22 +0000)]
[clang] Use compile-command interpolation to provide commands for header files.

Summary: This uses the inferring wrapper introduced in D45006.

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 329582

6 years ago[llvm-cov] Implement -ignore-filename-regex= option for excluding source files.
Max Moroz [Mon, 9 Apr 2018 15:20:35 +0000 (15:20 +0000)]
[llvm-cov] Implement -ignore-filename-regex= option for excluding source files.

Summary:
The option is helpful for large projects where it's not feasible to specify sources which
user would like to see in the report. Instead, it allows to black-list specific sources via
regular expressions (e.g. now it's possible to skip all files that have "test" in its name).

This also partially fixes https://bugs.llvm.org/show_bug.cgi?id=34277

Reviewers: vsk, morehouse, liaoyuke

Reviewed By: vsk

Subscribers: kcc, mgorny, llvm-commits

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

llvm-svn: 329581

6 years ago[Tooling] A CompilationDatabase wrapper that infers header commands.
Sam McCall [Mon, 9 Apr 2018 15:17:39 +0000 (15:17 +0000)]
[Tooling] A CompilationDatabase wrapper that infers header commands.

Summary:
The wrapper finds the closest matching compile command using filename heuristics
and makes minimal tweaks so it can be used with the header.

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 329580

6 years ago[clang-tidy] Return non-zero exit code for clang errors.
Alexander Kornienko [Mon, 9 Apr 2018 15:12:10 +0000 (15:12 +0000)]
[clang-tidy] Return non-zero exit code for clang errors.

Summary:
Updated tests broken by this change.
Fixes https://bugs.llvm.org/show_bug.cgi?id=27628

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

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

llvm-svn: 329579

6 years ago[clangd] Allow using customized include path in URI.
Haojian Wu [Mon, 9 Apr 2018 15:09:44 +0000 (15:09 +0000)]
[clangd] Allow using customized include path in URI.

Summary:
Calculating the include path from absolute file path does not always
work for all build system, e.g. bazel uses symlink as the build working
directory. The absolute file path from editor and clang is diverged from
each other. We need to address it properly in build sysmtem integration.

This patch worksarounds the issue by providing a hook in URI which allows
clients to provide their customized include path.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329578

6 years ago[MachineLICM] Re-enable hoisting of constant stores
Zaara Syeda [Mon, 9 Apr 2018 14:50:02 +0000 (14:50 +0000)]
[MachineLICM] Re-enable hoisting of constant stores

This patch fixes an issue exposed on the SystemZ build bots when committing
https://reviews.llvm.org/rL327856. The hoisting was temporarily disabled with
an option. This patch now re-enables hoisting and checks that we only hoist a
store instruction when all its operands are either constant caller preserved
registers or immediates.

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

llvm-svn: 329577

6 years agoRevert "[OpenMP] enable bc file compilation using the latest clang"
Guansong Zhang [Mon, 9 Apr 2018 14:45:41 +0000 (14:45 +0000)]
Revert "[OpenMP] enable bc file compilation using the latest clang"

This reverts commit 6849e31c36d712d97433bca9af39b7a09c8c1207.

llvm-svn: 329576

6 years ago[CodeGen/AccelTable] Don't emit zero-CU name indexes
Pavel Labath [Mon, 9 Apr 2018 14:38:53 +0000 (14:38 +0000)]
[CodeGen/AccelTable] Don't emit zero-CU name indexes

Summary:
If an input DICompileUnit is completely empty (e.g., the result of
running "clang -g" on an empty file), we don't bother emitting an empty
DWARF CU. When we do that, we must make sure we don't also emit a DWARF v5
name index, as DWARF specifies that each index must reference at least
one compilation unit.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 329575

6 years ago[clangd-vscode] Update VScode dependencies
Marc-Andre Laperle [Mon, 9 Apr 2018 14:32:12 +0000 (14:32 +0000)]
[clangd-vscode] Update VScode dependencies

Summary:
This allows the extension to work with LSP 3.0 and is useful for testing.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewers: ilya-biryukov

Subscribers: hokein, klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329574

6 years ago[RuntimeDyld][PowerPC] Fix a newly added test in r329355
Krasimir Georgiev [Mon, 9 Apr 2018 14:29:23 +0000 (14:29 +0000)]
[RuntimeDyld][PowerPC] Fix a newly added test in r329355

Summary: The bit widths are wrong.

Reviewers: bkramer, lhames, hans

Reviewed By: hans

Subscribers: hans, nemanjai, kbarton, llvm-commits

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

llvm-svn: 329573

6 years ago[MergeICmp] Update debug msg.NFC
Xin Tong [Mon, 9 Apr 2018 14:29:13 +0000 (14:29 +0000)]
[MergeICmp] Update debug msg.NFC

llvm-svn: 329572

6 years ago[clangd] Adapt index interfaces to D45014, and fix the old bugs.
Sam McCall [Mon, 9 Apr 2018 14:28:52 +0000 (14:28 +0000)]
[clangd] Adapt index interfaces to D45014, and fix the old bugs.

Summary:
Fix bugs:
- don't count occurrences of decls where we don't spell the name
- findDefinitions at MACRO(^X) goes to the definition of MACRO

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329571

6 years ago[Index] Return SourceLocation to consumers, not FileID/Offset pair.
Sam McCall [Mon, 9 Apr 2018 14:12:51 +0000 (14:12 +0000)]
[Index] Return SourceLocation to consumers, not FileID/Offset pair.

Summary:
The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses
e.g. the spelling location in some macro cases.
Instead, pass the original SourceLocation which preserves all information, and
update consumers to match current behavior.

This allows us to fix two bugs in clangd that need the spelling location.

Reviewers: akyrtzi, arphaman

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

llvm-svn: 329570

6 years agoRevert r329403 "[llvm-mca] Do not separate iterations with a newline in the timeline...
Hans Wennborg [Mon, 9 Apr 2018 13:53:41 +0000 (13:53 +0000)]
Revert r329403 "[llvm-mca] Do not separate iterations with a newline in the timeline view."

This made AArch64/CortexA57/direct-branch.s fail on Windows, e.g.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11251

> Also, update a few tests to minimize the diff in D45369.
> No functional change intended.

llvm-svn: 329569

6 years ago[X86][MMX] Fix missing itinerary for PALIGNR
Simon Pilgrim [Mon, 9 Apr 2018 13:52:33 +0000 (13:52 +0000)]
[X86][MMX] Fix missing itinerary for PALIGNR

llvm-svn: 329568

6 years ago[X86][MMX] Fix missing itinerary for MOVQ2DQ instruction format
Simon Pilgrim [Mon, 9 Apr 2018 13:42:14 +0000 (13:42 +0000)]
[X86][MMX] Fix missing itinerary for MOVQ2DQ instruction format

llvm-svn: 329567

6 years agoImprove completion experience for headers
Philipp Stephani [Mon, 9 Apr 2018 13:31:44 +0000 (13:31 +0000)]
Improve completion experience for headers

Summary: When calling `completing-read', we should provide a default to prevent the behavior described in https://github.com/DarwinAwardWinner/ido-completing-read-plus#why-does-ret-sometimes-not-select-the-first-completion-on-the-list--why-is-there-an-empty-entry-at-the-beginning-of-the-completion-list--what-happened-to-old-style-default-selection.  Also, don't use an assertion to check whether the user selected a header; raise a proper signal instead.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 329566

6 years ago[X86][MMX] Fix missing itinerary for CVTPI2PS
Simon Pilgrim [Mon, 9 Apr 2018 13:27:47 +0000 (13:27 +0000)]
[X86][MMX] Fix missing itinerary for CVTPI2PS

llvm-svn: 329565

6 years ago[MergeICmp] Split blocks that do other work.
Xin Tong [Mon, 9 Apr 2018 13:14:06 +0000 (13:14 +0000)]
[MergeICmp] Split blocks that do other work.

Summary:
We do not try to move the instructions and split the block till we
know the blocks can be split, i.e. BCE-cmp-insts can be separated from
non-BCE-cmp-insts.

Reviewers: davide, courbet

Subscribers: llvm-commits

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

llvm-svn: 329564

6 years ago[ELF] - Simplify test case. NFC.
George Rimar [Mon, 9 Apr 2018 13:13:36 +0000 (13:13 +0000)]
[ELF] - Simplify test case. NFC.

llvm-svn: 329563

6 years ago[AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32
Dmitry Preobrazhensky [Mon, 9 Apr 2018 13:10:33 +0000 (13:10 +0000)]
[AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32

See bugs
  36841: https://bugs.llvm.org/show_bug.cgi?id=36841
  36842: https://bugs.llvm.org/show_bug.cgi?id=36842

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329562

6 years ago[X86][MMX] Fix flipped reg/mem typo in MMX_MISC_FUNC_ITINS
Simon Pilgrim [Mon, 9 Apr 2018 13:02:07 +0000 (13:02 +0000)]
[X86][MMX] Fix flipped reg/mem typo in MMX_MISC_FUNC_ITINS

The RR/RM itineraries were the wrong way around

llvm-svn: 329561

6 years ago[ELF] - Stop setting OutSecOff too early.
George Rimar [Mon, 9 Apr 2018 13:01:50 +0000 (13:01 +0000)]
[ELF] - Stop setting OutSecOff too early.

Currently LLD sets OutSecOff in addSection for input sections.
That is a fake offset (just a rude approximation to remember the order),
used for sorting SHF_LINK_ORDER sections
(see resolveShfLinkOrder, compareByFilePosition).

There are 2 problems with such approach:

1. We currently change and reuse Size field as a value assigned. Changing size is
not good because leads to bugs. Currently, SIZEOF(.bss) for empty .bss returns 2
because we add two empty synthetic sections and increase size twice by 1.
(See PR37011: https://bugs.llvm.org/show_bug.cgi?id=37011)

2. Such approach simply does not work when --symbol-ordering-file is involved,
because processing of the ordering file might break the initial section order.

This fixes PR37011.

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

llvm-svn: 329560

6 years ago[ELF] - Fix cref.s test case.
George Rimar [Mon, 9 Apr 2018 12:45:29 +0000 (12:45 +0000)]
[ELF] - Fix cref.s test case.

The intention of -gc-sections flag was to check
that discarded is not in the output. It should be
specified in the executable command line invocation
and also, the symbol must be global as local symbols
are anyways not printed.

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

llvm-svn: 329559

6 years agoTry to fix libclang reproducer tests after r329465
Hans Wennborg [Mon, 9 Apr 2018 12:21:12 +0000 (12:21 +0000)]
Try to fix libclang reproducer tests after r329465

They were failing on Windows because the output YAML didn't parse:

  YAML:1:664: error: Unrecognized escape code!

  {"toolchain":"D:\\buildslave\\clang-x64-ninja-win7\\stage1",
    "libclang.operation":"complete", "libclang.opts":1, "args":["clang",
    "-fno-spell-checking",
    "D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c",
    "-Xclang", "-detailed-preprocessing-record",
    "-fallow-editor-placeholders"],
    "invocation-args":["-code-completion-at=D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c:10:1"],
    "unsaved_file_hashes":[{"name":"D:\\buildslave\\clang-x64-ninja-win7\\llvm\\tools\\clang\\test\\Index\\create-libclang-completion-reproducer.c",
      "md5":"aee23773de90e665992b48209351d70e"}]}

This adds some more escaping to try to make it work.

llvm-svn: 329558

6 years ago[ELF] - Allow LLD to produce file symbols.
George Rimar [Mon, 9 Apr 2018 11:43:52 +0000 (11:43 +0000)]
[ELF] - Allow LLD to produce file symbols.

This is for PR36716 and
this enables emitting STT_FILE symbols.

Output size affect is minor:
lld binary size changes from 52,883,408 to 52,949,400
clang binary size changes from 83,136,456 to 83,219,600

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

llvm-svn: 329557

6 years ago[X86][SSE] Fix f32 mul/div itinerary groups typo
Simon Pilgrim [Mon, 9 Apr 2018 10:45:53 +0000 (10:45 +0000)]
[X86][SSE] Fix f32 mul/div itinerary groups typo

The RM folded itineraries were incorrectly using the f64 version.

llvm-svn: 329556

6 years agoMake the test case from r329552 more portable
Pavel Labath [Mon, 9 Apr 2018 09:11:40 +0000 (09:11 +0000)]
Make the test case from r329552 more portable

- when tuning for SCE debugger (default for ps4 targets), we will not emit
  the DW_AT_linkage_name, which this test needs. I explicitly set the
  debugger tuning parameter to get the attribute always.
- darwin targets did not like the "section .text.startup" fragment of
  the test. This is not actually needed for the test, so I remove it.

llvm-svn: 329555

6 years ago[dsymutil] Remove trailing colon. NFC
Jonas Devlieghere [Mon, 9 Apr 2018 09:10:34 +0000 (09:10 +0000)]
[dsymutil] Remove trailing colon. NFC

llvm-svn: 329554

6 years ago[dsymutil] Don't try to load Swift ASTs as objects.
Jonas Devlieghere [Mon, 9 Apr 2018 09:09:59 +0000 (09:09 +0000)]
[dsymutil] Don't try to load Swift ASTs as objects.

With the threading refactoring, loading of object files happens before
checking whether we're dealing with a swift AST. While that's not an
issue per se, it causes a warning to be printed:

  warning: /path/to/a.swiftmodule: The file was not recognized as a valid object file
  note: while processing /path/to/a.swiftmodule

This suppresses the warning by checking for a Swift AST before
attempting to load is as an object file.

rdar://39240444

llvm-svn: 329553

6 years ago[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names
Pavel Labath [Mon, 9 Apr 2018 08:41:57 +0000 (08:41 +0000)]
[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names

Summary:
We were emitting accelerator entries for functions with no name, which
is contrary to the DWARF v5 spec: "All other (i.e., *not*
DW_TAG_namespace) debugging information entries without a DW_AT_name
attribute are excluded." Besides that, a name table entry with an empty
string as a key is fairly useless.

We can sometimes end up with functions which have a DW_AT_linkage_name but no
DW_AT_name. One such example is the global-constructor-initialization functions,
which C++ compilers synthesize for each compilation unit with global
constructors.
A very strict reading of the DWARF v5 spec would suggest that we should not even
emit the accelerator entry for the linkage name in this case, but I don't think
we should go that far.

I found this when running the dwarf verifier over llvm codebase compiled
with DWARF v5 accelerator tables.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: vleschuk, clayborg, echristo, probinson, llvm-commits

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

llvm-svn: 329552

6 years ago[DAGCombine] Improve ReduceLoad for SRL
Sam Parker [Mon, 9 Apr 2018 08:16:11 +0000 (08:16 +0000)]
[DAGCombine] Improve ReduceLoad for SRL

Recommitting r329283, third time lucky...

If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.

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

llvm-svn: 329551

6 years agoFix unused variable warning.
Chandler Carruth [Mon, 9 Apr 2018 07:26:42 +0000 (07:26 +0000)]
Fix unused variable warning.

llvm-svn: 329550

6 years ago[X86] Merge some of the autoupgrade handling for masked intrinsics that just need...
Craig Topper [Mon, 9 Apr 2018 06:15:09 +0000 (06:15 +0000)]
[X86] Merge some of the autoupgrade handling for masked intrinsics that just need to upgrade to an unmasked version plus a select. NFCI

These are were previously grouped in small groups of similarish intrinsics. But all the intrinsics have the same number of arguments and the same order. So we can move them all into a larger group for handling.

llvm-svn: 329549

6 years agoRemove immediate dominator heuristic for error block detection.
Michael Kruse [Mon, 9 Apr 2018 06:07:44 +0000 (06:07 +0000)]
Remove immediate dominator heuristic for error block detection.

This patch removes the heuristic in
- Polly :: lib/Support/ScopHelper.cpp

The heuristic forces blocks that directly follow a loop header to not to be considered error blocks.
It was introduced in r249611 with the following commit message:

>   This replaces the support for user defined error functions by a
>   heuristic that tries to determine if a call to a non-pure function
>   should be considered "an error". If so the block is assumed not to be
>   executed at runtime. While treating all non-pure function calls as
>   errors will allow a lot more regions to be analyzed, it will also
>   cause us to dismiss a lot again due to an infeasible runtime context.
>   This patch tries to limit that effect. A non-pure function call is
>   considered an error if it is executed only in conditionally with
>   regards to a cheap but simple heuristic.

In the code below `CCK_Abort2()` would be considered as an error block, but not `CCK_Abort1()` due to this heuristic.
```
for (int i = 0; i < n; i+=1) {
  if (ErrorCondition1)
    CCK_Abort1(); // No __attribute__((noreturn))
  if (ErrorCondition2)
    CCK_Abort2(); // No __attribute__((noreturn))
}
```

This does not seem useful. Checking error conditions in the beginning of some work is quite common. It causes a switch default-case to be not considered an error block in SPEC's cactuBSSN. The comment justifying the heuristic mentions a "load", which does not seem to be applicable here. It has been proposed to remove the heuristic.

In addition, the patch fixes the following test cases:
- Polly :: ScopDetect/mod_ref_read_pointer.ll
- Polly :: ScopInfo/max-loop-depth.ll
- Polly :: ScopInfo/mod_ref_access_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointer.ll
- Polly :: ScopInfo/mod_ref_read_pointers.ll

The test cases failed after removing the heuristic.

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

Contributed-by: Lorenzo Chelini <l.chelini@icloud.com>
llvm-svn: 329548

6 years ago[IRCE] Relax restriction on collected range checks
Max Kazantsev [Mon, 9 Apr 2018 06:01:22 +0000 (06:01 +0000)]
[IRCE] Relax restriction on collected range checks

In IRCE, we have a very old legacy check that works when we collect comparisons that we
treat as range checks. It ensures that the value against which the indvar is compared is
loop invariant and is also positive.

This latter condition remained there since the times when IRCE was only able to handle
signed latch comparison. As the optimization evolved, it now learned how to intersect
signed or unsigned ranges, and this logic has no reliance on the fact that the right border
of each range should be positive.

The old implementation of this non-negativity check was also naive enough and just looked
into ranges (while most of other IRCE logic tries to use power of SCEV implications), so this
check did not allow to deal with the most simple case that looks like follows:

  int size; // not known non-negative
  int length; //known non-negative;
  i = 0;
  if (size != 0) {
    do {
      range_check(i < size);
      range_check(i < length);
    ++i;
    } while (i < size)
  }

In this case, even if from some dominating conditions IRCE could parse loop
structure, it could only remove the range check against `length` and simply
ignored the check against `size`.

In this patch we remove this obsolete check. It will allow IRCE to pick comparison
against `size` as a potential range check and then let Range Intersection logic
decide whether it is OK to eliminate it or not.

Differential Revision: https://reviews.llvm.org/D45362
Reviewed By: samparker

llvm-svn: 329547

6 years ago[NFC] fix trivial typos in comments and error message
Hiroshi Inoue [Mon, 9 Apr 2018 04:37:53 +0000 (04:37 +0000)]
[NFC] fix trivial typos in comments and error message

"is is" -> "is", "are are" -> "are"

llvm-svn: 329546

6 years agoRevert "[CMake] Use custom command and target to install libc++ headers"
Petr Hosek [Mon, 9 Apr 2018 04:36:04 +0000 (04:36 +0000)]
Revert "[CMake] Use custom command and target to install libc++ headers"

This reverts commit r329544 which is failing on libcxx standalone bots.

llvm-svn: 329545

6 years ago[CMake] Use custom command and target to install libc++ headers
Petr Hosek [Mon, 9 Apr 2018 04:23:04 +0000 (04:23 +0000)]
[CMake] Use custom command and target to install libc++ headers

Using file(COPY FILE...) has several downsides. Since the file command
is only executed at configuration time, any changes to headers made
after the initial CMake execution are ignored. This can lead to subtle
errors since the just built Clang will be using stale libc++ headers.
Furthermore, since the headers are copied prior to executing the build
system, this may hide missing dependencies on libc++ from other LLVM
components.

This changes replaces the use of file(COPY FILE...) command with a
custom command and target which addresses all aforementioned issues and
matches the implementation already used by other LLVM components that
also install headers like Clang builtin headers.

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

llvm-svn: 329544

6 years ago[XRay][llvm+clang] Consolidate attribute list files
Dean Michael Berris [Mon, 9 Apr 2018 04:02:09 +0000 (04:02 +0000)]
[XRay][llvm+clang] Consolidate attribute list files

Summary:
This change consolidates the always/never lists that may be provided to
clang to externally control which functions should be XRay instrumented
by imbuing attributes. The files follow the same format as defined in
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html for the
sanitizer blacklist.

We also deprecate the existing `-fxray-instrument-always=` and
`-fxray-instrument-never=` flags, in favour of `-fxray-attr-list=`.

This fixes http://llvm.org/PR34721.

Reviewers: echristo, vlad.tsyrklevich, eugenis

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, cfe-commits

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

llvm-svn: 329543

6 years agoRemove MachineLoopInfo dependency from AsmPrinter.
Michael Zolotukhin [Mon, 9 Apr 2018 00:54:47 +0000 (00:54 +0000)]
Remove MachineLoopInfo dependency from AsmPrinter.

Summary:
Currently MachineLoopInfo is used in only two places:
1) for computing IsBasicBlockInsideInnermostLoop field of MCCodePaddingContext, and it is never used.
2) in emitBasicBlockLoopComments, which is called only if `isVerbose()` is true.
Despite that, we currently have a dependency on MachineLoopInfo, which makes
pass manager to compute it and MachineDominator Tree. This patch removes the
use (1) and makes the use (2) lazy, thus avoiding some redundant
recomputations.

Reviewers: opaparo, gadi.haber, rafael, craig.topper, zvi

Subscribers: rengolin, javed.absar, hiraditya, llvm-commits

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

llvm-svn: 329542

6 years ago[test] Fix Container::insert(value_type const&) tests
Eric Fiselier [Sun, 8 Apr 2018 21:57:35 +0000 (21:57 +0000)]
[test] Fix Container::insert(value_type const&) tests

Patch from Joe Loser.

Several unit tests meaning to test the behavior of lvalue insertion incorrectly
pass rvalues. Fixes bug PR # 27394

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

llvm-svn: 329541

6 years ago[TargetSchedule] shrink interface for init(); NFCI
Sanjay Patel [Sun, 8 Apr 2018 19:56:04 +0000 (19:56 +0000)]
[TargetSchedule] shrink interface for init(); NFCI

The TargetSchedModel is always initialized using the TargetSubtargetInfo's
MCSchedModel and TargetInstrInfo, so we don't need to extract those and
pass 3 parameters to init().

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

llvm-svn: 329540

6 years ago[X86] Add SchedWrites for CMOV and SETCC. Use them to remove InstRWs.
Craig Topper [Sun, 8 Apr 2018 17:53:18 +0000 (17:53 +0000)]
[X86] Add SchedWrites for CMOV and SETCC. Use them to remove InstRWs.

Summary:
Cmov and setcc previously used WriteALU, but on Intel processors at least they are more restricted than basic ALU ops.

This patch adds new SchedWrites for them and removes the InstRWs. I had to leave some InstRWs for CMOVA/CMOVBE and SETA/SETBE because those have an extra uop relative to the other condition codes on Intel CPUs.

The test changes are due to fixing a missing ZnAGU dependency on the memory form of setcc.

Reviewers: RKSimon, andreadb, GGanesh

Reviewed By: RKSimon

Subscribers: GGanesh, llvm-commits

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

llvm-svn: 329539

6 years ago[X86][Znver1] Remove InstRWs for BLENDVPS/PD
Craig Topper [Sun, 8 Apr 2018 17:53:15 +0000 (17:53 +0000)]
[X86][Znver1] Remove InstRWs for BLENDVPS/PD

Summary:
This removes the InstRWs for BLENDVPS/PD in favor of WriteFVarBlend. The latency listed was 3 cycles but WriteFVarBlend is defined as 1 cycle latency. The 1 cycle latency matches Agner Fog's data.

The patterns were missing the VEX forms which is why there are no test changes. We don't test "-mcpu=znver1 -mattr=-avx"

Reviewers: RKSimon, GGanesh

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 329538

6 years ago[dsymutil] Don't crash on empty CU
Jonas Devlieghere [Sun, 8 Apr 2018 17:35:17 +0000 (17:35 +0000)]
[dsymutil] Don't crash on empty CU

Add some additional checks so we don't crash on empty compile units.

llvm-svn: 329537

6 years ago[Support] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:46:22 +0000 (16:46 +0000)]
[Support] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: chandlerc, jordan_rose, bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

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

llvm-svn: 329536

6 years ago[PowerPC] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:45:04 +0000 (16:45 +0000)]
[PowerPC] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: hfinkel, RKSimon

Reviewed By: RKSimon

Subscribers: nemanjai, kbarton, llvm-commits

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

llvm-svn: 329535

6 years ago[X86] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:42:52 +0000 (16:42 +0000)]
[X86] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: chandlerc, craig.topper, RKSimon

Reviewed By: chandlerc, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 329534