]> granicus.if.org Git - llvm/log
llvm
5 years ago[Test] Demonstrate a realignment bug missed in r366765
Philip Reames [Fri, 2 Aug 2019 20:01:43 +0000 (20:01 +0000)]
[Test] Demonstrate a realignment bug missed in r366765

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367714 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][NFC] Enable ADT BitVectorTest
Jinsong Ji [Fri, 2 Aug 2019 19:58:00 +0000 (19:58 +0000)]
[PowerPC][NFC] Enable ADT BitVectorTest

Test on ppc64le passed.
This fix https://bugs.llvm.org/show_bug.cgi?id=42702

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367713 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Turn on symbol-flags overrides for LLJIT on Windows by default.
Lang Hames [Fri, 2 Aug 2019 19:43:20 +0000 (19:43 +0000)]
[ORC] Turn on symbol-flags overrides for LLJIT on Windows by default.

libObject does not apply the Exported flag to symbols in COFF object files,
which can lead to assertions when the symbol flags initially derived from
IR added to the JIT clash with the flags seen by the JIT linker. Both
RTDyldObjectLinkingLayer and ObjectLinkingLayer have a workaround for this:
they can be told to override the flags seen by the linker with the flags
attached to the materialization responsibility object that was passed down
to the linker. This patch modifies LLJIT's setup code to enable this override
by default on platforms where COFF is the default object format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367712 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd MCRegister and use it in MCRegisterClass::contains()
Daniel Sanders [Fri, 2 Aug 2019 19:37:17 +0000 (19:37 +0000)]
Add MCRegister and use it in MCRegisterClass::contains()

Summary:
Register can cast to MCRegister and we may want to consider asserting
!isValid() || isPhysical() when expensive checks are on.

Depends on D65554

Reviewers: arsenm

Subscribers: wdng, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367711 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] try to convert opposing shifts to casts
Sanjay Patel [Fri, 2 Aug 2019 19:33:46 +0000 (19:33 +0000)]
[DAGCombiner] try to convert opposing shifts to casts

This reverses a questionable IR canonicalization when a truncate
is free:

sra (add (shl X, N1C), AddC), N1C -->
sext (add (trunc X to (width - N1C)), AddC')

https://rise4fun.com/Alive/slRC

More details in PR42644:
https://bugs.llvm.org/show_bug.cgi?id=42644

I limited this to pre-legalization for code simplicity because that
should be enough to reverse the IR patterns. I don't have any
evidence (no regression test diffs) that we need to try this later.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367710 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTemporarily Revert "Changing representation of cv_def_range directives in Codeview...
Eric Christopher [Fri, 2 Aug 2019 19:10:37 +0000 (19:10 +0000)]
Temporarily Revert "Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability"

This is breaking bots and the author asked me to revert.

This reverts commit 367704.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367707 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChanging representation of cv_def_range directives in Codeview debug info assembly...
Nilanjana Basu [Fri, 2 Aug 2019 18:44:39 +0000 (18:44 +0000)]
Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367704 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPassManager] Resolve assertion in CGSCCPassManager when CallCounts change.
Alina Sbirlea [Fri, 2 Aug 2019 18:37:03 +0000 (18:37 +0000)]
[NewPassManager] Resolve assertion in CGSCCPassManager when CallCounts change.

Summary:
If the CallCounts change after an iteration of the DevirtSCCRepeatedPass, this is not reflected in the local CallCounts structure triggering the assertion checking the before/after sizes.
Since it is valid for the size to change and this only uses the CallCounts for the devirtualizing heuristic, keep a <Function*, CallCount> map instead, and make the devirtualizing decision using the counts for the functions that exist both before and after the pass.

Resolves PR42726.

Reviewers: chandlerc

Subscribers: mehdi_amini, jlebar, sanjoy.google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367703 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] - Fix the strip-dwo-groups.test.
George Rimar [Fri, 2 Aug 2019 18:22:46 +0000 (18:22 +0000)]
[llvm-objcopy] - Fix the strip-dwo-groups.test.

It was reported (https://reviews.llvm.org/D65273#1612246)
that this test fails if the compilation directory contain
a "debug_" substring.

This should fix it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367702 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Support the neg_addsub_shifted_imm32 pattern
Jessica Paquette [Fri, 2 Aug 2019 18:12:53 +0000 (18:12 +0000)]
[AArch64][GlobalISel] Support the neg_addsub_shifted_imm32 pattern

Add an equivalent ComplexRendererFns function for SelectNegArithImmed. This
allows us to select immediate adds of -1 by turning them into subtracts.

Update select-binop.mir to show that the pattern works.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367700 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG] Cleanup redundant conditions [NFC].
Alina Sbirlea [Fri, 2 Aug 2019 18:06:54 +0000 (18:06 +0000)]
[SimplifyCFG] Cleanup redundant conditions [NFC].

Summary:
Since the for loop iterates over BB's predecessors, the branch conditions found must have BB as one of the successors.
For an unconditional branch the successor must be BB, added `assert`.
For a conditional branch, one of the two successors must be BB, simplify `else if` to `else` and `assert`.
Sink common instructions outside the if/else block.

Reviewers: sanjoy.google

Subscribers: jlebar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367699 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Regenerated saddo.ll test file for D47927
Simon Pilgrim [Fri, 2 Aug 2019 17:52:55 +0000 (17:52 +0000)]
[AMDGPU] Regenerated saddo.ll test file for D47927

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367698 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix ARC after r367633
Daniel Sanders [Fri, 2 Aug 2019 17:52:17 +0000 (17:52 +0000)]
Fix ARC after r367633

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367697 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCodeGen: Don't follow aliases when extracting type info.
Peter Collingbourne [Fri, 2 Aug 2019 17:43:45 +0000 (17:43 +0000)]
CodeGen: Don't follow aliases when extracting type info.

This fixes a crash in the case where the type info object is an alias
pointing to a non-zero offset within a global or is otherwise unanalyzable
by the stripPointerCasts() function. Looking through the alias is not the
right thing to do anyway for similar reasons as D65118.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367696 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] fold cmp+select using select operand equivalence
Sanjay Patel [Fri, 2 Aug 2019 17:39:32 +0000 (17:39 +0000)]
[InstCombine] fold cmp+select using select operand equivalence

As discussed in PR42696:
https://bugs.llvm.org/show_bug.cgi?id=42696
...but won't help that case yet.

We have an odd situation where a select operand equivalence fold was
implemented in InstSimplify when it could have been done more generally
in InstCombine if we allow dropping of {nsw,nuw,exact} from a binop operand.

Here's an example:
https://rise4fun.com/Alive/Xplr

  %cmp = icmp eq i32 %x, 2147483647
  %add = add nsw i32 %x, 1
  %sel = select i1 %cmp, i32 -2147483648, i32 %add
  =>
  %sel = add i32 %x, 1

I've left the InstSimplify code in place for now, but my guess is that we'd
prefer to remove that as a follow-up to save on code duplication and
compile-time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367695 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix git-llvm to not delete non-empty directories.
James Y Knight [Fri, 2 Aug 2019 17:10:04 +0000 (17:10 +0000)]
Fix git-llvm to not delete non-empty directories.

Previously, if a directory contained only other sub-directories, one
of which was being removed, git llvm would delete the parent and all
its subdirs, even though only one should've been deleted.

This error occurred in r366590, where the commit attempted to remove
lldb/packages/Python/lldbsuite/test/tools/lldb-mi, but git-llvm
erroneously removed the entire contents of
lldb/packages/Python/lldbsuite/test/tools.

This happened because "git apply" automatically removes empty
directories locally, and the absence of a local directory was
previously taken as an indication to call 'svn rm' on that
directory. However, an empty local directory does not necessarily
indicate that the directory is truly empty.

Fix that by removing directories only when they're empty on the git
side.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367693 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r367667.
Peter Collingbourne [Fri, 2 Aug 2019 17:02:05 +0000 (17:02 +0000)]
gn build: Merge r367667.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367692 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[doc] Give a workaround for a FileCheck regex that ends in a brace.
Paul Robinson [Fri, 2 Aug 2019 16:07:48 +0000 (16:07 +0000)]
[doc] Give a workaround for a FileCheck regex that ends in a brace.

Addresses PR42864.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367689 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse llvm-nm instead of nm in new test to unbreak Windows bot
Teresa Johnson [Fri, 2 Aug 2019 15:49:39 +0000 (15:49 +0000)]
Use llvm-nm instead of nm in new test to unbreak Windows bot

New test added in r367679 used nm and should use llvm-nm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367688 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Change the locking scheme for ThreadSafeModule.
Lang Hames [Fri, 2 Aug 2019 15:21:37 +0000 (15:21 +0000)]
[ORC] Change the locking scheme for ThreadSafeModule.

ThreadSafeModule/ThreadSafeContext are used to manage lifetimes and locking
for LLVMContexts in ORCv2. Prior to this patch contexts were locked as soon
as an associated Module was emitted (to be compiled and linked), and were not
unlocked until the emit call returned. This could lead to deadlocks if
interdependent modules that shared contexts were compiled on different threads:
when, during emission of the first module, the dependence was discovered the
second module (which would provide the required symbol) could not be emitted as
the thread emitting the first module still held the lock.

This patch eliminates this possibility by moving to a finer-grained locking
scheme. Each client holds the module lock only while they are actively operating
on it. To make this finer grained locking simpler/safer to implement this patch
removes the explicit lock method, 'getContextLock', from ThreadSafeModule and
replaces it with a new method, 'withModuleDo', that implicitly locks the context,
calls a user-supplied function object to operate on the Module, then implicitly
unlocks the context before returning the result.

ThreadSafeModule TSM = getModule(...);
size_t NumFunctions = TSM.withModuleDo(
    [](Module &M) { // <- context locked before entry to lambda.
      return M.size();
    });

Existing ORCv2 layers that operate on ThreadSafeModules are updated to use the
new method.

This method is used to introduce Module locking into each of the existing
layers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367686 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Test commit, corrected some spelling in comment
David Candler [Fri, 2 Aug 2019 14:44:17 +0000 (14:44 +0000)]
[NFC] Test commit, corrected some spelling in comment

Test commit, corrected some spelling in comment.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367685 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: support swiftself attribute
Tim Northover [Fri, 2 Aug 2019 14:09:49 +0000 (14:09 +0000)]
GlobalISel: support swiftself attribute

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367683 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix new test try 2
Teresa Johnson [Fri, 2 Aug 2019 13:49:48 +0000 (13:49 +0000)]
Fix new test try 2

Fix second (and last) instance of wrong Input file name in new test
added in r367679.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367682 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix new test
Teresa Johnson [Fri, 2 Aug 2019 13:26:18 +0000 (13:26 +0000)]
Fix new test

Thew new test added in r367679 was using the wrong copy of the Input
file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367680 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Implement index-based WPD
Teresa Johnson [Fri, 2 Aug 2019 13:10:52 +0000 (13:10 +0000)]
[ThinLTO] Implement index-based WPD

This patch adds support to the WholeProgramDevirt pass to perform
index-based WPD, which is invoked from ThinLTO during the thin link.

The ThinLTO backend (WPD import phase) behaves the same regardless of
whether the WPD decisions were made with the index-based or (the
existing) IR-based analysis.

Depends on D54815.

Reviewers: pcc

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367679 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367677 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367676 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367671 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367670 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367669 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367668 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367666 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367665 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367662 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367660 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367659 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367658 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367655 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367654 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367649 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367647 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367646 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367645 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367644 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367640 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367639 91177308-0d34-0410-b5e6-96231b3b80d8

5 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()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367637 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367636 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367635 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367634 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367633 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367628 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367627 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367626 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367625 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367624 91177308-0d34-0410-b5e6-96231b3b80d8

5 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>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367623 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367619 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367614 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367612 91177308-0d34-0410-b5e6-96231b3b80d8

5 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)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367607 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367604 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367603 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367601 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367600 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367598 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367597 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367596 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367594 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367593 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367592 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367591 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367590 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367588 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367585 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367584 91177308-0d34-0410-b5e6-96231b3b80d8

5 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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367583 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367582 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367581 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367580 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367579 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367578 91177308-0d34-0410-b5e6-96231b3b80d8

5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367577 91177308-0d34-0410-b5e6-96231b3b80d8

5 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367576 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] SimplifyMultipleUseDemandedBits - Add PEXTR/PINSR B+W handling
Simon Pilgrim [Thu, 1 Aug 2019 14:46:03 +0000 (14:46 +0000)]
[X86][SSE] SimplifyMultipleUseDemandedBits - Add PEXTR/PINSR B+W handling

This adds SimplifyMultipleUseDemandedBitsForTargetNode X86 support and uses it to allow us to peek through vector insertions to avoid dependencies on entire insertion chains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367570 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd support for openSUSE RISC-V triple
Sam Elliott [Thu, 1 Aug 2019 14:23:56 +0000 (14:23 +0000)]
Add support for openSUSE RISC-V triple

Reviewers: asb

Reviewed By: asb

Subscribers: lenary, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lebedev.ri, kito-cheng, shiva0217, rogfer01, dexonsmith, rkruppe, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Patch by Andreas Schwab (schwab)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367565 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] EltsFromConsecutiveLoads - don't attempt to merge volatile loads (PR42846)
Simon Pilgrim [Thu, 1 Aug 2019 13:13:18 +0000 (13:13 +0000)]
[X86] EltsFromConsecutiveLoads - don't attempt to merge volatile loads (PR42846)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367556 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Add Custom Parser for Atomic Memory Operands
Sam Elliott [Thu, 1 Aug 2019 12:42:31 +0000 (12:42 +0000)]
[RISCV] Add Custom Parser for Atomic Memory Operands

Summary:
GCC Accepts both (reg) and 0(reg) for atomic instruction memory
operands. These instructions do not allow for an offset in their
encoding, so in the latter case, the 0 is silently dropped.

Due to how we have structured the RISCVAsmParser, the easiest way to add
support for parsing this offset is to add a custom AsmOperand and
parser. This parser drops all the parens, and just keeps the register.

This commit also adds a custom printer for these operands, which matches
the GCC canonical printer, printing both `(a0)` and `0(a0)` as `(a0)`.

Reviewers: asb, lewis-revill

Reviewed By: asb

Subscribers: s.egerton, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367553 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IR] Value: add replaceUsesWithIf() utility
Roman Lebedev [Thu, 1 Aug 2019 12:32:08 +0000 (12:32 +0000)]
[IR] Value: add replaceUsesWithIf() utility

Summary:
While there is always a `Value::replaceAllUsesWith()`,
sometimes the replacement needs to be conditional.

I have only cleaned a few cases where `replaceUsesWithIf()`
could be used, to both add test coverage,
and show that it is actually useful.

Reviewers: jdoerfert, spatel, RKSimon, craig.topper

Reviewed By: jdoerfert

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, aheejin, george.burgess.iv, asbirlea, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367548 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IR] SelectInst: add swapValues() utility
Roman Lebedev [Thu, 1 Aug 2019 12:31:35 +0000 (12:31 +0000)]
[IR] SelectInst: add swapValues() utility

Summary:
Sometimes we need to swap true-val and false-val of a `SelectInst`.
Having a function for that is nicer than hand-writing it each time.

Reviewers: spatel, RKSimon, craig.topper, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367547 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Fix for MVE VREV64
David Green [Thu, 1 Aug 2019 11:22:03 +0000 (11:22 +0000)]
[ARM] Fix for MVE VREV64

The VREV64 instruction is apparently unpredictable if Qd == Qm, due to the
cross-beat nature of the instruction. This adds an earlyclobber to Qd, which
seems to be the same way we deal with this on other instructions like the
write-back on loads and stores.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367544 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Regenerate BSWAP16 tests
Simon Pilgrim [Thu, 1 Aug 2019 11:12:10 +0000 (11:12 +0000)]
[ARM] Regenerate BSWAP16 tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367543 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Do not allocate unnecessary emergency slot.
Sander de Smalen [Thu, 1 Aug 2019 10:53:45 +0000 (10:53 +0000)]
[AArch64] Do not allocate unnecessary emergency slot.

Fix an issue where the compiler still allocates an emergency spill slot even
though it already decided to spill an extra callee-save register to use
as a scratch register.

Reviewers: gberry, thegameg, mstorsjo, t.p.northover

Reviewed By: thegameg

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367540 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS GlobalISel] Fold load/store + G_GEP + G_CONSTANT
Petar Avramovic [Thu, 1 Aug 2019 09:40:13 +0000 (09:40 +0000)]
[MIPS GlobalISel] Fold load/store + G_GEP + G_CONSTANT

Fold load/store + G_GEP + G_CONSTANT when
immediate in G_CONSTANT fits into 16 bit signed integer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367535 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM][Alignment] Fix AlignmentTest on platform where size_t != uint64_t
Guillaume Chatelet [Thu, 1 Aug 2019 09:20:00 +0000 (09:20 +0000)]
[LLVM][Alignment] Fix AlignmentTest on platform where size_t != uint64_t

Reviewers: yroux

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367532 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][ARM][ParallelDSP] Getters and renaming
Sam Parker [Thu, 1 Aug 2019 08:17:51 +0000 (08:17 +0000)]
[NFC][ARM][ParallelDSP] Getters and renaming

Add a couple of getters for Reduction and do some renaming of
variables around CreateSMLAD for clarity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367522 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Testing] Fix tests that break with read-only checkouts
David Zarzycki [Thu, 1 Aug 2019 06:41:40 +0000 (06:41 +0000)]
[Testing] Fix tests that break with read-only checkouts

Found with `mount --bind -o ro ...` on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367519 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.
Craig Topper [Thu, 1 Aug 2019 06:06:21 +0000 (06:06 +0000)]
[SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.

Also use KnownBits::isNegative/isNonNegative to further simplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367518 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/SILoadStoreOptimizer: Make some functions const
Tom Stellard [Thu, 1 Aug 2019 05:39:17 +0000 (05:39 +0000)]
AMDGPU/SILoadStoreOptimizer: Make some functions const

Reviewers: arsenm, pendingchaos, rampitec

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367517 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agorecommit:[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using...
Zi Xuan Wu [Thu, 1 Aug 2019 05:26:02 +0000 (05:26 +0000)]
recommit:[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using big-endian load/store

In PowerPC, there is instruction to load vector in big endian element order when it's in little endian target.
So we can combine vector load + reverse into big endian load to eliminate the swap instruction.
Also combine vector reverse + store into big endian store.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367516 91177308-0d34-0410-b5e6-96231b3b80d8