platform/upstream/llvm.git
4 years ago[x86] add/adjust tests for shift-add-shift; NFC
Sanjay Patel [Fri, 2 Aug 2019 11:50:03 +0000 (11:50 +0000)]
[x86] add/adjust tests for shift-add-shift; NFC

Goes with D65607.

llvm-svn: 367677

4 years ago[llvm-dlltool] Clarify an error message. NFC.
Martin Storsjo [Fri, 2 Aug 2019 11:20:03 +0000 (11:20 +0000)]
[llvm-dlltool] Clarify an error message. NFC.

The parameter to the -D (--dllname) option is the name of the dll
that llvm-dlltool produces an import library for. Even though this
is named "OutputFile" in the COFFModuleDefinition class, it's not
an output file name in the context of llvm-dlltool, but the name
of the DLL to create an import library for.

llvm-svn: 367676

4 years ago[OpenCL] Allow OpenCL C style vector initialization in C++
Anastasia Stulova [Fri, 2 Aug 2019 11:19:35 +0000 (11:19 +0000)]
[OpenCL] Allow OpenCL C style vector initialization in C++

Allow creating vector literals from other vectors.

 float4 a = (float4)(1.0f, 2.0f, 3.0f, 4.0f);
 float4 v = (float4)(a.s23, a.s01);

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

llvm-svn: 367675

4 years ago[COFF] Clarify a comment. NFC.
Martin Storsjo [Fri, 2 Aug 2019 11:08:15 +0000 (11:08 +0000)]
[COFF] Clarify a comment. NFC.

It's the __delayLoadHelper2 function that overwrites the jump table
slot, not this thunk.

llvm-svn: 367674

4 years ago[COFF] Avoid loading objects for mingw autoimport, when a defined alias exists
Martin Storsjo [Fri, 2 Aug 2019 11:02:34 +0000 (11:02 +0000)]
[COFF] Avoid loading objects for mingw autoimport, when a defined alias exists

This avoids a spurious and confusing log message in cases where
both e.g. "alias" and "__imp_alias" exist.

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

llvm-svn: 367673

4 years ago[clangd] Remove bad assert: nothing relies on it, and the reasons it was true no...
Sam McCall [Fri, 2 Aug 2019 10:39:46 +0000 (10:39 +0000)]
[clangd] Remove bad assert: nothing relies on it, and the reasons it was true no longer hold.

llvm-svn: 367672

4 years ago[MCA] Add support for printing immedate values as hex. Also enable lexing of masm...
Andrea Di Biagio [Fri, 2 Aug 2019 10:38:25 +0000 (10:38 +0000)]
[MCA] Add support for printing immedate values as hex. Also enable lexing of masm binary and hex literals.

This patch adds a new llvm-mca flag named -print-imm-hex.

By default, the instruction printer prints immediate operands as decimals. Flag
-print-imm-hex enables the instruction printer to print those operands in hex.

This patch also adds support for MASM binary and hex literal numbers (example
0FFh, 101b).
Added tests to verify the behavior of the new flag. Tests also verify that masm
numeric literal operands are now recognized.

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

llvm-svn: 367671

4 years ago[IPRA][ARM] Disable no-CSR optimisation for ARM
Oliver Stannard [Fri, 2 Aug 2019 10:23:17 +0000 (10:23 +0000)]
[IPRA][ARM] Disable no-CSR optimisation for ARM

This optimisation isn't generally profitable for ARM, because we can
save/restore many registers in the prologue and epilogue using the PUSH
and POP instructions, but mostly use individual LDR/STR instructions for
other spills.

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

llvm-svn: 367670

4 years agoFix and test inter-procedural register allocation for ARM
Oliver Stannard [Fri, 2 Aug 2019 10:23:05 +0000 (10:23 +0000)]
Fix and test inter-procedural register allocation for ARM

- Avoid a crash when IPRA calls ARMFrameLowering::determineCalleeSaves
  with a null RegScavenger. Simply not updating the register scavenger
  is fine because IPRA only cares about the SavedRegs vector, the acutal
  code of the function has already been generated at this point.
- Add a new hook to TargetRegisterInfo to get the set of registers which
  can be clobbered inside a call, even if the compiler can see both
  sides, by linker-generated code.

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

llvm-svn: 367669

4 years ago[Loop Peeling] Introduce an option for profile based peeling disabling.
Serguei Katkov [Fri, 2 Aug 2019 09:32:52 +0000 (09:32 +0000)]
[Loop Peeling] Introduce an option for profile based peeling disabling.

This patch adds an ability to disable profile based peeling
causing the peeling of all iterations and as a result prohibits
further unroll/peeling attempts on that loop.

The motivation to get an ability to separate peeling usage in
pipeline where in the first part we peel only separate iterations if needed
and later in pipeline we apply the full peeling which will prohibit further peeling.

Reviewers: reames, fhahn
Reviewed By: reames
Subscribers: hiraditya, zzheng, dmgreen, llvm-commits
Differential Revision: https://reviews.llvm.org/D64983

llvm-svn: 367668

4 years ago[clangd] Add new helpers to make tweak tests scale better. Convert most tests. NFC
Sam McCall [Fri, 2 Aug 2019 09:12:39 +0000 (09:12 +0000)]
[clangd] Add new helpers to make tweak tests scale better. Convert most tests. NFC

Summary:
TweakTests.cpp has some pretty good helpers added for the first few
tweaks, but they have some limitations:
 - many assertion failures point at the wrong line
 - need lots of input/output tests, setup code is duplicated across both
 - local helpers make it hard to split the file as it grows

The new helpers in TweakTests.h are based on old ones (same operations)
but try to address these issues and generally make tests more terse
while improving error messages.

This patch converts everything except ExtractVariable (which is complex
and has changes in flight, so will be converted later).
It's LOC-neutral, despite not being able to get rid of the old helpers
until ExtractVariable is done.

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 367667

4 years ago[LV] Fix test failure in a Release build.
Jay Foad [Fri, 2 Aug 2019 08:33:41 +0000 (08:33 +0000)]
[LV] Fix test failure in a Release build.

llvm-svn: 367666

4 years ago[NFC][ARM[ParallelDSP] Rename/remove/change types
Sam Parker [Fri, 2 Aug 2019 08:21:17 +0000 (08:21 +0000)]
[NFC][ARM[ParallelDSP] Rename/remove/change types

Remove forward declaration, fold a couple of typedefs and change one
to be more useful.

llvm-svn: 367665

4 years agoSymbolVendor: Introduce Module::GetSymbolFile
Pavel Labath [Fri, 2 Aug 2019 08:16:35 +0000 (08:16 +0000)]
SymbolVendor: Introduce Module::GetSymbolFile

Summary:
This is the next step in avoiding funneling all SymbolFile calls through
the SymbolVendor. Right now, it is just a convenience function, but it
allows us to update all calls to SymbolVendor functions to access the
SymbolFile directly. Once all call sites have been updated, we can
remove the GetSymbolVendor member function.

This patch just updates the calls to GetSymbolVendor, which were calling
it just so they could fetch the underlying symbol file. Other calls will
be done in follow-ups.

Reviewers: JDevlieghere, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 367664

4 years ago[lldb][NFC] Remove unused imports in python tests
Raphael Isemann [Fri, 2 Aug 2019 08:06:22 +0000 (08:06 +0000)]
[lldb][NFC] Remove unused imports in python tests

llvm-svn: 367663

4 years ago[AliasAnalysis] Initialize a member variable that may be used by unit test.
Peter Smith [Fri, 2 Aug 2019 08:05:14 +0000 (08:05 +0000)]
[AliasAnalysis] Initialize a member variable that may be used by unit test.

The unit tests in BasicAliasAnalysisTest use the alias analysis API
directly and do not call setAAResults to initalize AAR. This gives a
valgrind error "Conditional Jump depends on unitialized variable".

On most buildbots the variable is nullptr, but in some cases it can be
non nullptr leading to seemingly random failures.

These tests were disabled in r366986. With the initialization they can be
enabled again.

Fixes PR42719

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

llvm-svn: 367662

4 years agoDon't try emitting dllexported explicitly defaulted non-trivial ctors twice during...
Hans Wennborg [Fri, 2 Aug 2019 07:51:41 +0000 (07:51 +0000)]
Don't try emitting dllexported explicitly defaulted non-trivial ctors twice during explicit template instantiation definition (PR42857)

Trying to emit the definition twice triggers an assert.

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

llvm-svn: 367661

4 years ago[NFC][ARM][ParallelDSP] Remove ValueList
Sam Parker [Fri, 2 Aug 2019 07:32:28 +0000 (07:32 +0000)]
[NFC][ARM][ParallelDSP] Remove ValueList

We only care about the first element in the list.

llvm-svn: 367660

4 years agoMoves the newly added test interleaved-accesses-waw-dependency.ll to X86 subdirectory.
Hideki Saito [Fri, 2 Aug 2019 07:25:09 +0000 (07:25 +0000)]
Moves the newly added test interleaved-accesses-waw-dependency.ll to X86 subdirectory.

ps4-buildslave1 reported a failure. The test has x86 triple.

llvm-svn: 367659

4 years agoRevert r367649: Improve raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Fri, 2 Aug 2019 07:22:34 +0000 (07:22 +0000)]
Revert r367649: Improve raw_ostream so that you can "write" colors using operator<<

This reverts commit r367649 in an attempt to unbreak Windows bots.

llvm-svn: 367658

4 years ago[PGO] Fix bolt failures from r367628
Rong Xu [Fri, 2 Aug 2019 07:21:50 +0000 (07:21 +0000)]
[PGO] Fix bolt failures from r367628

Relaxed the check in a test because the windows bolt generates different
profile variables.

llvm-svn: 367657

4 years agocompiler-rt: Rename .cc file in test/tsan to .cpp
Fangrui Song [Fri, 2 Aug 2019 07:18:07 +0000 (07:18 +0000)]
compiler-rt: Rename .cc file in test/tsan to .cpp

Like r367463, but for test/tsan.

llvm-svn: 367656

4 years ago[LLVM][Alignment] Update documentation
Guillaume Chatelet [Fri, 2 Aug 2019 07:14:20 +0000 (07:14 +0000)]
[LLVM][Alignment] Update documentation

Reviewers: aprantl

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 367655

4 years ago[LV] Avoid building interleaved group in presence of WAW dependency
Hideki Saito [Fri, 2 Aug 2019 06:31:50 +0000 (06:31 +0000)]
[LV] Avoid building interleaved group in presence of WAW dependency

Reviewers: hsaito, Ayal, fhahn, anna, mkazantsev

Reviewed By: hsaito

Patch by evrevnov, thanks!

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

llvm-svn: 367654

4 years agocompiler-rt: Rename .cc file in test/msan to .cpp
Fangrui Song [Fri, 2 Aug 2019 06:07:05 +0000 (06:07 +0000)]
compiler-rt: Rename .cc file in test/msan to .cpp

Like r367463, but for test/msan.

llvm-svn: 367653

4 years agocompiler-rt: Rename .cc file in test/xray to .cpp
Fangrui Song [Fri, 2 Aug 2019 05:49:58 +0000 (05:49 +0000)]
compiler-rt: Rename .cc file in test/xray to .cpp

Like r367463, but for test/xray.

Update test/xray/lit.cfg.py config.suffixes to remove .cc (we actually
don't have .c tests now)

llvm-svn: 367652

4 years agoAdd an assert() to catch possible regexp errors.
Rui Ueyama [Fri, 2 Aug 2019 05:11:19 +0000 (05:11 +0000)]
Add an assert() to catch possible regexp errors.

llvm-svn: 367651

4 years agoAdd a comment for --vs-diagnostics.
Rui Ueyama [Fri, 2 Aug 2019 05:04:27 +0000 (05:04 +0000)]
Add a comment for --vs-diagnostics.

llvm-svn: 367650

4 years agoImprove raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Fri, 2 Aug 2019 04:48:30 +0000 (04:48 +0000)]
Improve raw_ostream so that you can "write" colors using operator<<

1. raw_ostream supports ANSI colors so that you can write messages to
the termina with colors. Previously, in order to change and reset
color, you had to call `changeColor` and `resetColor` functions,
respectively.

So, if you print out "error: " in red, for example, you had to do
something like this:

  OS.changeColor(raw_ostream::RED);
  OS << "error: ";
  OS.resetColor();

With this patch, you can write the same code as follows:

  OS << raw_ostream::RED << "error: " << raw_ostream::RESET;

2. Add a boolean flag to raw_ostream so that you can disable colored
output. If you disable colors, changeColor, operator<<(Color),
resetColor and other color-related functions have no effect.

Most LLVM tools automatically prints out messages using colors, and
you can disable it by passing a flag such as `--disable-colors`.
This new flag makes it easy to write code that works that way.

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

llvm-svn: 367649

4 years ago[clang-format] Fix a bug that doesn't break braces before unions for Allman
Owen Pan [Fri, 2 Aug 2019 04:30:42 +0000 (04:30 +0000)]
[clang-format] Fix a bug that doesn't break braces before unions for Allman
Differential Revision: https://reviews.llvm.org/D65631

llvm-svn: 367648

4 years ago[Loop Peeling] Do not close further unroll/peel if profile based peeling was not...
Serguei Katkov [Fri, 2 Aug 2019 04:29:23 +0000 (04:29 +0000)]
[Loop Peeling] Do not close further unroll/peel if profile based peeling was not used.

Current peeling cost model can decide to peel off not all iterations
but only some of them to eliminate conditions on phi. At the same time
if any peeling happens the door for further unroll/peel optimizations on that
loop closes because the part of the code thinks that if peeling happened
it is profile based peeling and all iterations are peeled off.

To resolve this inconsistency the patch provides the flag which states whether
the full peeling basing on profile is enabled or not and peeling cost model
is able to modify this field like it does not PeelCount.

In a separate patch I will introduce an option to allow/disallow peeling basing
on profile.

To avoid infinite loop peeling the patch tracks the total number of peeled iteration
through llvm.loop.peeled.count loop metadata.

Reviewers: reames, fhahn
Reviewed By: reames
Subscribers: hiraditya, zzheng, dmgreen, llvm-commits
Differential Revision: https://reviews.llvm.org/D64972

llvm-svn: 367647

4 years agoHandle casts changing pointer size in the vectorizer
Stanislav Mekhanoshin [Fri, 2 Aug 2019 04:03:37 +0000 (04:03 +0000)]
Handle casts changing pointer size in the vectorizer

Added code to truncate or shrink offsets so that we can continue
base pointer search if size has changed along the way.

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

llvm-svn: 367646

4 years ago[PowerPC][Peephole] Check if `extsw`'s second operand is a virtual register
Kai Luo [Fri, 2 Aug 2019 03:14:17 +0000 (03:14 +0000)]
[PowerPC][Peephole] Check if `extsw`'s second operand is a virtual register

Summary:
When combining `extsw` and `sldi` in `PPCMIPeephole`, we have to check
if `extsw`'s second operand is a virtual register, otherwise we might
get miscompile.

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

llvm-svn: 367645

4 years ago[NFC][CodeGen] Modify the type element of TailCalls to simplify the dupRetToEnableTai...
Kang Zhang [Fri, 2 Aug 2019 03:09:07 +0000 (03:09 +0000)]
[NFC][CodeGen] Modify the type element of TailCalls to simplify the dupRetToEnableTailCallOpts()

Summary:
The old code can be simplified to define the element type of TailCalls as `BasicBlock` not `CallInst`. Also I use the for-range loop instead the for loop.

Reviewed By: jsji

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

llvm-svn: 367644

4 years agoFix an unused variable warning.
Rui Ueyama [Fri, 2 Aug 2019 02:51:20 +0000 (02:51 +0000)]
Fix an unused variable warning.

llvm-svn: 367643

4 years agoFix flaky test caused by PR42868
Vitaly Buka [Fri, 2 Aug 2019 02:27:04 +0000 (02:27 +0000)]
Fix flaky test caused by PR42868

llvm-svn: 367642

4 years agoChange /build to /build* in top-level .gitignore.
Douglas Yung [Fri, 2 Aug 2019 02:14:08 +0000 (02:14 +0000)]
Change /build to /build* in top-level .gitignore.

Reviewers: beanz

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

llvm-svn: 367641

4 years agoTemporarily revert "Changes to improve CodeView debug info type record inline comments"
Eric Christopher [Fri, 2 Aug 2019 01:05:47 +0000 (01:05 +0000)]
Temporarily revert "Changes to improve CodeView debug info type record inline comments"
due to a sanitizer failure.

This reverts commit 367623.

llvm-svn: 367640

4 years agoUpdate Compiler.h check for MSVC
JF Bastien [Fri, 2 Aug 2019 00:50:12 +0000 (00:50 +0000)]
Update Compiler.h check for MSVC
We require at least MSVC 2017, but I forgot to update Compiler.h when I updated the MSVC requirement.

llvm-svn: 367639

4 years agoFormat OptionEnumValueElement (NFC)
Jonas Devlieghere [Fri, 2 Aug 2019 00:18:44 +0000 (00:18 +0000)]
Format OptionEnumValueElement (NFC)

Reformat OptionEnumValueElement to make it easier to distinguish between
its fields. This also removes the need to disable clang-format for these
arrays.

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

llvm-svn: 367638

4 years agoFix up an unused variable warning caused by TRI->isVirtualRegister() -> Register...
Daniel Sanders [Fri, 2 Aug 2019 00:17:48 +0000 (00:17 +0000)]
Fix up an unused variable warning caused by TRI->isVirtualRegister() -> Register::isVirtualRegister()

llvm-svn: 367637

4 years agoPrevent vregs leaking into the MC layer via TargetRegisterClass::contains()
Daniel Sanders [Thu, 1 Aug 2019 23:44:42 +0000 (23:44 +0000)]
Prevent vregs leaking into the MC layer via TargetRegisterClass::contains()

Summary:
The MC layer doesn't expect to deal with vregs but
TargetRegisterClass::contains() forwards into MCRegisterClass::contains()
and this can cause vregs to turn up in the MC layer APIs. Add guards
against this to prevent this becoming a problem as we replace unsigned
with a new MCRegister object for improved type safety.

Reviewers: arsenm

Subscribers: wdng, llvm-commits

Tags: #llvm

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

llvm-svn: 367636

4 years ago[dsymutil] Fix heap-use-after-free related to the LinkOptions.
Jonas Devlieghere [Thu, 1 Aug 2019 23:37:33 +0000 (23:37 +0000)]
[dsymutil] Fix heap-use-after-free related to the LinkOptions.

In r367348, I changed dsymutil to pass the LinkOptions by value isntead
of by const reference. However, the options were still captured by
reference in the LinkLambda. This patch fixes that by passing them in by
value.

llvm-svn: 367635

4 years ago[Tests] Autogen a bunch of Reassociate tests for ease of update
Philip Reames [Thu, 1 Aug 2019 23:30:32 +0000 (23:30 +0000)]
[Tests] Autogen a bunch of Reassociate tests for ease of update

llvm-svn: 367634

4 years agoFinish moving TargetRegisterInfo::isVirtualRegister() and friends to llvm::Register...
Daniel Sanders [Thu, 1 Aug 2019 23:27:28 +0000 (23:27 +0000)]
Finish moving TargetRegisterInfo::isVirtualRegister() and friends to llvm::Register as started by r367614. NFC

llvm-svn: 367633

4 years ago[DirectoryWatcher] Relax assumption to prevent test flakiness
Jan Korous [Thu, 1 Aug 2019 23:24:30 +0000 (23:24 +0000)]
[DirectoryWatcher] Relax assumption to prevent test flakiness

llvm-svn: 367632

4 years agoRefactor deque to centralize handling of spare blocks.
Eric Fiselier [Thu, 1 Aug 2019 23:11:18 +0000 (23:11 +0000)]
Refactor deque to centralize handling of spare blocks.

I have upcoming changes that modify how deque handles spare blocks.
This cleanup is intended to make those changes easier to review
and understand. This patch should have NFC.

llvm-svn: 367631

4 years ago[PGO] Add PGO support at -O0 in the experimental new pass manager
Rong Xu [Thu, 1 Aug 2019 22:36:34 +0000 (22:36 +0000)]
[PGO] Add PGO support at -O0 in the experimental new pass manager

Add PGO support at -O0 in the experimental new pass manager to sync the
behavior of the legacy pass manager.

Also change the test of gcc-flag-compatibility.c for more complete test:
(1) change the match string to "profc" and "profd" to ensure the
    instrumentation is happening.
(2) add IR format proftext so that PGO use compilation is tested.

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

llvm-svn: 367628

4 years agoRevert r366980: "[lit] Protect full test suite from FILECHECK_OPTS"
Joel E. Denny [Thu, 1 Aug 2019 22:26:51 +0000 (22:26 +0000)]
Revert r366980: "[lit] Protect full test suite from FILECHECK_OPTS"

Windows bots are broken.  See recent D65335 and D65156 comments.

llvm-svn: 367627

4 years agoRevert r367123: "[llvm] [lit/tests] Replace 'env -u' with more portable construct"
Joel E. Denny [Thu, 1 Aug 2019 22:26:37 +0000 (22:26 +0000)]
Revert r367123: "[llvm] [lit/tests] Replace 'env -u' with more portable construct"

Must be reverted in order to revert r366980, which breaks windows
bots.  See recent D65335 and D65156 comments.

llvm-svn: 367626

4 years ago[NFC] Remove extra __has_feature
JF Bastien [Thu, 1 Aug 2019 22:19:53 +0000 (22:19 +0000)]
[NFC] Remove extra __has_feature

It's already in Compiler.h

llvm-svn: 367625

4 years agoRelax load store vectorizer pointer strip checks
Stanislav Mekhanoshin [Thu, 1 Aug 2019 22:18:56 +0000 (22:18 +0000)]
Relax load store vectorizer pointer strip checks

The previous change to fix crash in the vectorizer introduced
performance regressions. The condition to preserve pointer
address space during the search is too tight, we only need to
match the size.

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

llvm-svn: 367624

4 years agoChanges to improve CodeView debug info type record inline comments
Nilanjana Basu [Thu, 1 Aug 2019 22:05:14 +0000 (22:05 +0000)]
Changes to improve CodeView debug info type record inline comments

Signed-off-by: Nilanjana Basu <nilanjana.basu87@gmail.com>
llvm-svn: 367623

4 years agoFix Windows branch of FileManagerTest changes
Harlan Haskins [Thu, 1 Aug 2019 21:58:56 +0000 (21:58 +0000)]
Fix Windows branch of FileManagerTest changes

llvm-svn: 367622

4 years agoFix use-after-move in ClangBasicTests
Harlan Haskins [Thu, 1 Aug 2019 21:50:16 +0000 (21:50 +0000)]
Fix use-after-move in ClangBasicTests

llvm-svn: 367620

4 years ago[WebAssembly] Fixed relocation errors having no location.
Wouter van Oortmerssen [Thu, 1 Aug 2019 21:34:54 +0000 (21:34 +0000)]
[WebAssembly] Fixed relocation errors having no location.

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

Used to print:

<unknown>:0: error: Cannot represent a difference across sections

(the location was null).

Now prints:

err.s:20:3: error: Cannot represent a difference across sections
  i32.const foo-bar
  ^

Note: I looked at adding a test for this, but I don't think it is
worth it. We're not testing error formatting in the Wasm backend :)

Reviewers: sbc100, jgravelle-google

Subscribers: dschuff, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 367619

4 years ago[clang] Change FileManager to use llvm::ErrorOr instead of null on failure
Harlan Haskins [Thu, 1 Aug 2019 21:32:04 +0000 (21:32 +0000)]
[clang] Change FileManager to use llvm::ErrorOr instead of null on failure

Summary:
Currently, clang's FileManager uses NULL as an indicator that a particular file
did not exist, but would not propagate errors like permission issues. Instead,
teach FileManager to use llvm::ErrorOr internally and return rich errors for
failures.

Reviewers: arphaman, bruno, martong, shafik

Subscribers: nemanjai, kbarton, MaskRay, jkorous, dexonsmith, kadircet, jsji, cfe-commits, lldb-commits

Tags: #clang, #lldb

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

llvm-svn: 367618

4 years ago[clang-tools-extra] Adopt FileManager's error-returning APIs
Harlan Haskins [Thu, 1 Aug 2019 21:32:01 +0000 (21:32 +0000)]
[clang-tools-extra] Adopt FileManager's error-returning APIs

The FileManager has been updated to return llvm::ErrorOr from getFile
and getDirectory, this commit updates all the callers of those APIs from
clang.

llvm-svn: 367617

4 years ago[clang] Adopt new FileManager error-returning APIs
Harlan Haskins [Thu, 1 Aug 2019 21:31:56 +0000 (21:31 +0000)]
[clang] Adopt new FileManager error-returning APIs

Update the callers of FileManager::getFile and FileManager::getDirectory to handle the new llvm::ErrorOr-returning methods.

Signed-off-by: Harlan Haskins <harlan@apple.com>
llvm-svn: 367616

4 years ago[clang] Adopt llvm::ErrorOr in FileManager methods
Harlan Haskins [Thu, 1 Aug 2019 21:31:49 +0000 (21:31 +0000)]
[clang] Adopt llvm::ErrorOr in FileManager methods

Previously, the FileManager would use NULL returns to signify whether a file existed, but that doesn’t cover permissions issues or anything else that might occur while trying to stat or read a file. Instead, convert getFile and getDirectory into returning llvm::ErrorOr

Signed-off-by: Harlan Haskins <harlan@apple.com>
llvm-svn: 367615

4 years agoMove register namespacing definitions from TargetRegisterInfo to Register
Daniel Sanders [Thu, 1 Aug 2019 21:18:34 +0000 (21:18 +0000)]
Move register namespacing definitions from TargetRegisterInfo to Register

Summary:
The namespacing in Register is currently slightly wrong as there is a
(rarely used) stack slot namespace too. The namespacing doesn't use
anything from the Target so we can move the definition from
TargetRegisterInfo to Register to keep it in one place

Note: To keep the patch reasonably sized for review I've left stub
functions in the original TargetRegisterInfo. We should update all the uses
instead

Reviewers: arsenm, bogner, aditya_nandakumar, volkan

Subscribers: wdng, llvm-commits

Tags: #llvm

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

llvm-svn: 367614

4 years ago[OpenMP] Fix declare target link implementation
Gheorghe-Teodor Bercea [Thu, 1 Aug 2019 21:15:58 +0000 (21:15 +0000)]
[OpenMP] Fix declare target link implementation

Summary:
This patch fixes the case where variables in different compilation units or the same compilation unit are under the declare target link clause AND have the same name.
This also fixes the name clash error that occurs when unified memory is activated.
The changes in this patch include:
- Pointers to internal variables are given unique names.
- Externally visible variables are given the same name as before.
- All pointer variables (external or internal) are weakly linked.

Reviewers: ABataev, jdoerfert, caomhin

Reviewed By: ABataev

Subscribers: lebedev.ri, guansong, cfe-commits

Tags: #clang

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

llvm-svn: 367613

4 years ago[AArch64][x86] adjust tests with shift-add-shift; NFC
Sanjay Patel [Thu, 1 Aug 2019 21:08:08 +0000 (21:08 +0000)]
[AArch64][x86] adjust tests with shift-add-shift; NFC

Prevent folding away the math completely.

llvm-svn: 367612

4 years ago[analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its profile
Csaba Dabis [Thu, 1 Aug 2019 20:41:13 +0000 (20:41 +0000)]
[analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its profile

Summary:
It allows discriminating between stack frames of the same call that is
called multiple times in a loop.

Thanks to Artem Dergachev for the great idea!

Reviewed By: NoQ

Tags: #clang

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

llvm-svn: 367608

4 years ago[AArch64][x86] add tests for shift-add-shift; NFC (PR42644)
Sanjay Patel [Thu, 1 Aug 2019 20:32:27 +0000 (20:32 +0000)]
[AArch64][x86] add tests for shift-add-shift; NFC (PR42644)

llvm-svn: 367607

4 years agoTeach malloc_allocator how to count bytes
Eric Fiselier [Thu, 1 Aug 2019 19:52:46 +0000 (19:52 +0000)]
Teach malloc_allocator how to count bytes

llvm-svn: 367606

4 years agoChange default bucket count in hash_set/hash_map.
Eric Fiselier [Thu, 1 Aug 2019 19:48:29 +0000 (19:48 +0000)]
Change default bucket count in hash_set/hash_map.

Previously these types rehashed to a table of 193 elements
upon construction. But this is non-ideal, first because default
constructors should not allocate unless necessary, and second
because 193 is big and can waste a bunch of memory.

This number had previously been chosen to match GCC's implementation.

llvm-svn: 367605

4 years agoGlobalISel: Lower scalarizing unmerge of a vector to shifts
Matt Arsenault [Thu, 1 Aug 2019 19:10:05 +0000 (19:10 +0000)]
GlobalISel: Lower scalarizing unmerge of a vector to shifts

AMDGPU sometimes has legal s16 and <2 x s16> operations, but all
registers are really 32-bit. An unmerge destination really should ben
widened to a 32-bit register. If widening a scalarizing vector with a
target size that matches the vector size, bitcast to integer and
extract the relevant bits with shifts.

I'm not sure if this is the right place for this. This could arguably
be part of widenScalar for the result. I also have a growing feeling
that we're missing a bitcast legalize action.

llvm-svn: 367604

4 years agoFollow up of rL367592, fix the build
Sjoerd Meijer [Thu, 1 Aug 2019 18:54:29 +0000 (18:54 +0000)]
Follow up of rL367592, fix the build

Some buildbots complained about:
error: default label in switch which covers all enumeration values

llvm-svn: 367603

4 years agoTest linux only for absolute paths in the -fuse-ld option
Yuanfang Chen [Thu, 1 Aug 2019 18:49:59 +0000 (18:49 +0000)]
Test linux only for absolute paths in the -fuse-ld option

Some target do not use this option and may emit a error message for
using it.

llvm-svn: 367602

4 years ago[X86] In decomposeMulByConstant, legalize the VT before querying whether the multiply...
Craig Topper [Thu, 1 Aug 2019 18:49:07 +0000 (18:49 +0000)]
[X86] In decomposeMulByConstant, legalize the VT before querying whether the multiply is legal

If a type is larger than a legal type and needs to be split, we would previously allow the multiply to be decomposed even if the split multiply is legal. Since the shift + add/sub code would also need to be split, its not any better to decompose it.

This patch figures out what type the mul will eventually be legalized to and then uses that type for the query. I tried just returning false illegal types and letting them get handled after type legalization, but then we can't recognize and i64 constant splat on 32-bit targets since will be destroyed by type legalization. We could special case vectors of i64 to avoid that...

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

llvm-svn: 367601

4 years ago[X86] Add some test cases for 512-bit truncate to 128-bits with min-legal-vector...
Craig Topper [Thu, 1 Aug 2019 18:48:57 +0000 (18:48 +0000)]
[X86] Add some test cases for 512-bit truncate to 128-bits with min-legal-vector-width=0 and prefer-vector-width=256.

We currently split the 512 type, truncate each half to 128 bits,
concatenate them, and then truncate again. Probably better to
truncate each half to 64-bits and then concat the results
using vpunpcklqdq.

llvm-svn: 367600

4 years ago[COFF] Fix wholearchive with thin archives
Martin Storsjo [Thu, 1 Aug 2019 18:47:27 +0000 (18:47 +0000)]
[COFF] Fix wholearchive with thin archives

The Archive object created when loading an archive specified with
wholearchive got cleaned up immediately, when the owning std::unique_ptr
went out of scope, even if persisted StringRefs pointed to memory that
belonged to the archive, which no longer was mapped in memory.

This hasn't been an issue with regular (as opposed to thin) archives,
as references to the member objects has kept the mapping for the whole
archive file alive - but with thin archives, all such references point
to other files.

Add the std::unique_ptr to the arena allocator, to retain it as long
as necessary.

This fixes (the last issue raised in) PR42388.

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

llvm-svn: 367599

4 years agoAMDGPU: Remove v0 workaround for DS_GWS_* instructions
Matt Arsenault [Thu, 1 Aug 2019 18:41:32 +0000 (18:41 +0000)]
AMDGPU: Remove v0 workaround for DS_GWS_* instructions

Any register should work for the src field since r366067, since the
used value is not pulled from the expected encoding field.

llvm-svn: 367598

4 years agoCodeGen: Allow virtual registers in bundles
Matt Arsenault [Thu, 1 Aug 2019 18:41:28 +0000 (18:41 +0000)]
CodeGen: Allow virtual registers in bundles

The note in the documentation suggests this restriction is a compile
time optimization for architectures that make heavy use of
bundling. Allowing virtual registers in a bundle is useful for some
(non-R600) AMDGPU use cases and are infrequent enough to matter.

A more common AMDGPU use case has already been using virtual registers
in bundles since r333691, although never calling finalizeBundle on
them and manually creating the use/def list on the BUNDLE
instruction. This is also relatively infrequent, and only happens for
consecutive sequences of some load/store types.

llvm-svn: 367597

4 years ago[SimplifyCFG] Mark missed Changed to true.
Alina Sbirlea [Thu, 1 Aug 2019 18:37:34 +0000 (18:37 +0000)]
[SimplifyCFG] Mark missed Changed to true.

Summary:
DominatorTree is invalid after SimplifyCFG because of a missed `Changed = true` when simplifying a branch condition and removing an edge.
Resolves PR42272.

Reviewers: zhizhouy, manojgupta

Subscribers: jlebar, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 367596

4 years agoFix `skipIfSanitized` decorator on macOS
Jonas Devlieghere [Thu, 1 Aug 2019 18:35:40 +0000 (18:35 +0000)]
Fix `skipIfSanitized` decorator on macOS

For security reasons, DYLD_INSERT_LIBRARIES is not propagated to a child
process. This breaks the skipIfSanitized decorator, which checks for the
environment variable being set. Instead, always set the ASAN_OPTIONS and
make the decorator check for that.

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

llvm-svn: 367595

4 years ago[MemorySSA] Set LoopSimplify to preserve MemorySSA in the NPM, if analysis exists.
Alina Sbirlea [Thu, 1 Aug 2019 18:28:28 +0000 (18:28 +0000)]
[MemorySSA] Set LoopSimplify to preserve MemorySSA in the NPM, if analysis exists.

Summary:
LoopSimplify is preserved in the legacy pass manager, but not in the new pass manager.
Update LoopSimplify to preserve MemorySSA conditionally when the analysis is available (same behavior as the legacy pass manager).

Reviewers: chandlerc

Subscribers: mehdi_amini, jlebar, Prazek, george.burgess.iv, llvm-commits

Tags: #llvm

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

llvm-svn: 367594

4 years agoAMDGPU: Use tablegen pattern for sendmsg intrinsics
Matt Arsenault [Thu, 1 Aug 2019 18:27:11 +0000 (18:27 +0000)]
AMDGPU: Use tablegen pattern for sendmsg intrinsics

Since this now emits a direct copy to m0, SIFixSGPRCopies has to
handle a physical register.

llvm-svn: 367593

4 years ago[LV] Tail-Loop Folding
Sjoerd Meijer [Thu, 1 Aug 2019 18:21:44 +0000 (18:21 +0000)]
[LV] Tail-Loop Folding

This allows folding of the scalar epilogue loop (the tail) into the main
vectorised loop body when the loop is annotated with a "vector predicate"
metadata hint. To fold the tail, instructions need to be predicated (masked),
enabling/disabling lanes for the remainder iterations.

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

llvm-svn: 367592

4 years agoGlobalISel: Fix widenScalar for G_MERGE_VALUES to pointer
Matt Arsenault [Thu, 1 Aug 2019 18:13:16 +0000 (18:13 +0000)]
GlobalISel: Fix widenScalar for G_MERGE_VALUES to pointer

AMDGPU testcase isn't broken now, but will be in a future patch
without this.

llvm-svn: 367591

4 years ago[WebAssembly] Assembler/InstPrinter: support call_indirect type index.
Wouter van Oortmerssen [Thu, 1 Aug 2019 18:08:26 +0000 (18:08 +0000)]
[WebAssembly] Assembler/InstPrinter: support call_indirect type index.

A TYPE_INDEX operand (as used by call_indirect) used to be represented
by the InstPrinter as a symbol (e.g. .Ltype_index0@TYPE_INDEX) which
was a bit of a mismatch with the WasmObjectWriter which expects an
unnamed symbol, to receive the signature from and then turn into a
reloc.

There was really no good way to round-trip this information. An earlier
version of this patch tried to attach the signature information using
a .functype, but that ran into trouble when the symbol was re-emitted
without a name. Removing the name was a giant hack also.

The current version changes the assembly syntax to have an inline
signature spec for TYPEINDEX operands that is always unnamed, which
is much more elegant both in syntax and in implementation (as now the
assembler is able to follow the same path as the regular backend)

Reviewers: sbc100, dschuff, aheejin, jgravelle-google, sunfish, tlively

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 367590

4 years agoRemove a few straggler ".cc"s in compiler-rt/lib
Nico Weber [Thu, 1 Aug 2019 17:53:25 +0000 (17:53 +0000)]
Remove a few straggler ".cc"s in compiler-rt/lib

llvm-svn: 367589

4 years ago[TargetLowering] SimplifyMultipleUseDemandedBits - Add ISD::INSERT_VECTOR_ELT handling
Simon Pilgrim [Thu, 1 Aug 2019 17:46:44 +0000 (17:46 +0000)]
[TargetLowering] SimplifyMultipleUseDemandedBits - Add ISD::INSERT_VECTOR_ELT handling

Allow us to peek through vector insertions to avoid dependencies on entire insertion chains.

llvm-svn: 367588

4 years agotry to fix bots more after r367562
Nico Weber [Thu, 1 Aug 2019 17:31:49 +0000 (17:31 +0000)]
try to fix bots more after r367562

llvm-svn: 367587

4 years agotry to fix bots after r367562
Nico Weber [Thu, 1 Aug 2019 17:30:41 +0000 (17:30 +0000)]
try to fix bots after r367562

llvm-svn: 367586

4 years agoFix spacing of LLVM_USE_PERF in CMake.rst that caused it to be tabbed in funny
Erich Keane [Thu, 1 Aug 2019 17:30:25 +0000 (17:30 +0000)]
Fix spacing of LLVM_USE_PERF in CMake.rst that caused it to be tabbed in funny

llvm-svn: 367585

4 years agoDocument LLVM_ENABLE_LIBCXX in CMake.rst
Erich Keane [Thu, 1 Aug 2019 17:30:21 +0000 (17:30 +0000)]
Document LLVM_ENABLE_LIBCXX in CMake.rst

llvm-svn: 367584

4 years agoMove macho-data-in-code.ll to X86/macho-data-in-code.ll (to only run when x86 is...
Kuba Mracek [Thu, 1 Aug 2019 16:52:45 +0000 (16:52 +0000)]
Move macho-data-in-code.ll to X86/macho-data-in-code.ll (to only run when x86 is a valid target).

llvm-svn: 367583

4 years ago[X86][SSE] Add PEXTR*(PINSR*(v, s, c), c) -> s combine.
Simon Pilgrim [Thu, 1 Aug 2019 16:38:39 +0000 (16:38 +0000)]
[X86][SSE] Add PEXTR*(PINSR*(v, s, c), c) -> s combine.

We should probably extend this to cover bitcasts as well to help other cases in promote-vec3.ll.

llvm-svn: 367582

4 years ago[Attributor][FIX] Indicate a missing update change
Johannes Doerfert [Thu, 1 Aug 2019 16:21:54 +0000 (16:21 +0000)]
[Attributor][FIX] Indicate a missing update change

User of AAReturnedValues need to know if HasOverdefinedReturnedCalls
changed from false to true as it will impact the result of the return
value traversal (calls are not ignored anymore).

This will be tested with the tests in D59978.

llvm-svn: 367581

4 years ago[mips] Fix lowering load/store instruction in PIC case
Simon Atanasyan [Thu, 1 Aug 2019 16:04:29 +0000 (16:04 +0000)]
[mips] Fix lowering load/store instruction in PIC case

If an operand of the `lw/sw` instructions is a symbol, these instructions
incorrectly lowered using not-position-independent chain of commands.
For PIC code we should use `lw/addiu` instructions with the `R_MIPS_GOT16`
and `R_MIPS_LO16` relocations respectively. Instead of that LLVM generates
position dependent code with the `R_MIPS_HI16` and `R_MIPS_LO16`
relocations.

This patch provides a fix for the bug by handling PIC case separately in
the `MipsAsmParser::expandMemInst`. The main idea is to generate a chain
of PIC instructions to load a symbol address into a register and then
load the address content.

The fix is not optimal and does not fix all PIC-related problems. This
is a task for subsequent patches.

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

llvm-svn: 367580

4 years ago[InstCombine] add tests with 'ne' predicates; NFC
Sanjay Patel [Thu, 1 Aug 2019 16:04:12 +0000 (16:04 +0000)]
[InstCombine] add tests with 'ne' predicates; NFC

More coverage for the proposal in D65576.

llvm-svn: 367579

4 years ago[llvm-objdump] Fix jumptable detection when disassembling Mach-O binaries
Kuba Mracek [Thu, 1 Aug 2019 15:51:14 +0000 (15:51 +0000)]
[llvm-objdump] Fix jumptable detection when disassembling Mach-O binaries

- Add LC_SEGMENT_64 handling in getSectionsAndSymbols to be able to find the base segment address from 64-bit Mach-O binaries.
- Add "data in code" detection into the !symbolTableWorked case, extract it into a separate function.
- Fix uninitialized variable usage on BaseSegmentAddress (initialize to 0).
- Add test.

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

llvm-svn: 367578

4 years ago[InstCombine] add test with swapped select operands; NFC
Sanjay Patel [Thu, 1 Aug 2019 15:32:10 +0000 (15:32 +0000)]
[InstCombine] add test with swapped select operands; NFC

More coverage for the proposal in D65576.

llvm-svn: 367577

4 years ago[IR] Add getArg() method to Function class
Teresa Johnson [Thu, 1 Aug 2019 15:31:40 +0000 (15:31 +0000)]
[IR] Add getArg() method to Function class

Adds a method which, when called with function.getArg(i), returns an
Argument* to the i'th argument.

Patch by Henry Wildermuth

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

llvm-svn: 367576

4 years ago[Parser] Use special definition for pragma annotations
Serge Pavlov [Thu, 1 Aug 2019 15:15:10 +0000 (15:15 +0000)]
[Parser] Use special definition for pragma annotations

Previously pragma annotation tokens were described as any other
annotations in TokenKinds.def. This change introduces special macro
PRAGMA_ANNOTATION for the pragma descriptions. It allows implementing
checks that deal with pragma annotations only.

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

llvm-svn: 367575

4 years agoRename two clang tests from .cc to .cpp.
Nico Weber [Thu, 1 Aug 2019 15:06:57 +0000 (15:06 +0000)]
Rename two clang tests from .cc to .cpp.

clang/test/lit.cfg.py doesn't list .cc as test extension, so these
tests never ran.

Tweak one of the two tests to actually pass, now that it runs.
(The other one was already passing.)

llvm-svn: 367574

4 years agoFix TestThreadSpecificBreakpoint on Windows
Adrian McCarthy [Thu, 1 Aug 2019 14:49:54 +0000 (14:49 +0000)]
Fix TestThreadSpecificBreakpoint on Windows

This test was frequently hanging on Windows, causing a timeout after
10 minutes.  The short delay (100 microsecond) in the sample program
could cause a deadlock in the Windows thread pool, as I've explained
in the test program's comments.

Now that it doesn't hang, it passes reliably, so I've removed the
Windows-specific XFAIL.

I've tried to clarify the comments in TestThreadSpecificGBreakpoint.py
by eliminating some redundancy and typos, and I simplified away a
couple unnecessary assignments.

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

llvm-svn: 367573

4 years agocompiler-rt: Call a generated c++ file in hwasan .cpp instead of .cc
Nico Weber [Thu, 1 Aug 2019 14:48:16 +0000 (14:48 +0000)]
compiler-rt: Call a generated c++ file in hwasan .cpp instead of .cc

llvm-svn: 367572