]> granicus.if.org Git - llvm/log
llvm
5 years ago[NFC][ARM] Add some tail-predication tests
Sam Parker [Fri, 27 Sep 2019 10:33:53 +0000 (10:33 +0000)]
[NFC][ARM] Add some tail-predication tests

Use different data types for some simple loops.

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

5 years ago[SLPVectorizer][X86] Regenerate arith-fp tests
Simon Pilgrim [Fri, 27 Sep 2019 10:04:25 +0000 (10:04 +0000)]
[SLPVectorizer][X86] Regenerate arith-fp tests

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

5 years ago[UpdateTestChecks] Fix wildcard support on DOS prompts
Simon Pilgrim [Fri, 27 Sep 2019 10:04:16 +0000 (10:04 +0000)]
[UpdateTestChecks] Fix wildcard support on DOS prompts

D64572 / rL365818 changed the way that the file paths were collected, which meant we lost the file pattern expansion necessary when working with DOS command prompt

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

5 years agoRevert r372893 "[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets"
Hans Wennborg [Fri, 27 Sep 2019 09:54:26 +0000 (09:54 +0000)]
Revert r372893 "[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets"

This caused severe compile-time regressions, see PR43455.

> Modern processors predict the targets of an indirect branch regardless of
> the size of any jump table used to glean its target address.  Moreover,
> branch predictors typically use resources limited by the number of actual
> targets that occur at run time.
>
> This patch changes the semantics of the option `-max-jump-table-size` to limit
> the number of different targets instead of the number of entries in a jump
> table.  Thus, it is now renamed to `-max-jump-table-targets`.
>
> Before, when `-max-jump-table-size` was specified, it could happen that
> cluster jump tables could have targets used repeatedly, but each one was
> counted and typically resulted in tables with the same number of entries.
> With this patch, when specifying `-max-jump-table-targets`, tables may have
> different lengths, since the number of unique targets is counted towards the
> limit, but the number of unique targets in tables is the same, but for the
> last one containing the balance of targets.
>
> Differential revision: https://reviews.llvm.org/D60295

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

5 years ago[sancov][NFC] Make filename Regexes "const"
Thomas Preud'homme [Fri, 27 Sep 2019 09:39:13 +0000 (09:39 +0000)]
[sancov][NFC] Make filename Regexes "const"

Summary:
The const-correctness of match() was fixed in rL372764, which allows
such static Regex objects to be marked const.

Reviewers: thopre

Reviewed By: thopre

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][InstCombine] Revisit shift-by-signext tests
Roman Lebedev [Fri, 27 Sep 2019 09:09:15 +0000 (09:09 +0000)]
[NFC][InstCombine] Revisit shift-by-signext tests

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

5 years ago[Alignment][NFC] MaybeAlign in GVNExpression
Guillaume Chatelet [Fri, 27 Sep 2019 08:56:43 +0000 (08:56 +0000)]
[Alignment][NFC] MaybeAlign in GVNExpression

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[MC][ARM] vscclrm disassembles as vldmia
Alexandros Lamprineas [Fri, 27 Sep 2019 08:22:24 +0000 (08:22 +0000)]
[MC][ARM] vscclrm disassembles as vldmia

Happens only when the mve.fp subtarget feature is enabled:

$ llvm-mc -triple thumbv8.1m.main -mattr=+mve.fp,+8msecext -disassemble <<< "0x9f,0xec,0x08,0x0b"
  .text
  vldmia  pc, {d0, d1, d2, d3}
$ llvm-mc -triple thumbv8.1m.main -mattr=+8msecext -disassemble <<< "0x9f,0xec,0x08,0x0b"
  .text
  vscclrm {d0, d1, d2, d3, vpr}

Assembling returns the correct encoding with or without mve.fp:

$ llvm-mc -triple thumbv8.1m.main -mattr=+mve.fp,+8msecext -show-encoding <<< "vscclrm {d0-d3, vpr}"
  .text
  vscclrm {d0, d1, d2, d3, vpr}   @ encoding: [0x9f,0xec,0x08,0x0b]
$ llvm-mc -triple thumbv8.1m.main -mattr=+8msecext -show-encoding <<< "vscclrm {d0-d3, vpr}"
  .text
  vscclrm {d0, d1, d2, d3, vpr}   @ encoding: [0x9f,0xec,0x08,0x0b]

The problem seems to be in the TableGen description of VSCCLRMD.
The least significant bit should be set to zero.

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

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

5 years ago[llvm-exegesis] Refactor how forbidden registers are computed.
Clement Courbet [Fri, 27 Sep 2019 08:04:10 +0000 (08:04 +0000)]
[llvm-exegesis] Refactor how forbidden registers are computed.

Summary:
Right now latency generation can incorrectly select the scratch register
as a dependency-carrying register.
 - Move the logic for preventing register selection from Uops
   implementation to common SnippetGenerator class.
 - Aliasing detection now takes a set of forbidden registers just like
   random register assignment does.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

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

5 years ago[LoopInfo] Remove duplicates in ExitBlocks to reduce the compile time of
Wei Mi [Fri, 27 Sep 2019 05:43:31 +0000 (05:43 +0000)]
[LoopInfo] Remove duplicates in ExitBlocks to reduce the compile time of
hasDedicatedExits.

For the compile time problem described in https://reviews.llvm.org/D67359,
turns out the root cause is there are many duplicates in ExitBlocks so
the algorithm complexity of hasDedicatedExits gets very high. If we remove
the duplicates, the compile time issue is gone.

Thanks to Philip Reames for raising a good question and it leads me to
find the root cause.

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

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

5 years agoRevert "[LoopInfo] Limit the iterations to check whether a loop has dedicated
Wei Mi [Fri, 27 Sep 2019 05:43:30 +0000 (05:43 +0000)]
Revert "[LoopInfo] Limit the iterations to check whether a loop has dedicated
exits"

Get a better approach in https://reviews.llvm.org/D68107 to solve the problem.
Revert the initial patch and will commit the new one soon.

This reverts commit rL372990.

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

5 years ago[WebAssembly] v128.andnot
Thomas Lively [Fri, 27 Sep 2019 02:11:40 +0000 (02:11 +0000)]
[WebAssembly] v128.andnot

Summary:
As specified at
https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#bitwise-and-not

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

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

5 years ago[WebAssembly] SIMD Load and extend operations
Thomas Lively [Fri, 27 Sep 2019 02:06:50 +0000 (02:06 +0000)]
[WebAssembly] SIMD Load and extend operations

Summary:
As specified at
https://github.com/webassembly/simd/blob/master/proposals/simd/SIMD.md#load-and-extend.
These instructions are behind the unimplemented-simd128 target feature
for now because they have not been implemented in V8 yet.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

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

5 years agoRevert r373034
Nicholas Allegra [Fri, 27 Sep 2019 01:58:31 +0000 (01:58 +0000)]
Revert r373034

It breaks the build on MSVC.

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

5 years agoSpeculative fix for gcc build.
Peter Collingbourne [Fri, 27 Sep 2019 01:35:04 +0000 (01:35 +0000)]
Speculative fix for gcc build.

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

5 years agohwasan: Compatibility fixes for short granules.
Peter Collingbourne [Fri, 27 Sep 2019 01:02:10 +0000 (01:02 +0000)]
hwasan: Compatibility fixes for short granules.

We can't use short granules with stack instrumentation when targeting older
API levels because the rest of the system won't understand the short granule
tags stored in shadow memory.

Moreover, we need to be able to let old binaries (which won't understand
short granule tags) run on a new system that supports short granule
tags. Such binaries will call the __hwasan_tag_mismatch function when their
outlined checks fail. We can compensate for the binary's lack of support
for short granules by implementing the short granule part of the check in
the __hwasan_tag_mismatch function. Unfortunately we can't do anything about
inline checks, but I don't believe that we can generate these by default on
aarch64, nor did we do so when the ABI was fixed.

A new function, __hwasan_tag_mismatch_v2, is introduced that lets code
targeting the new runtime avoid redoing the short granule check. Because tag
mismatches are rare this isn't important from a performance perspective; the
main benefit is that it introduces a symbol dependency that prevents binaries
targeting the new runtime from running on older (i.e. incompatible) runtimes.

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

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

5 years ago[Consumed][NFC] Refactor handleCall to take function argument list.
Nicholas Allegra [Thu, 26 Sep 2019 23:47:18 +0000 (23:47 +0000)]
[Consumed][NFC] Refactor handleCall to take function argument list.

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

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

5 years agoRevert "gn build: (manually) merge r373028"
Dmitri Gribenko [Thu, 26 Sep 2019 23:30:47 +0000 (23:30 +0000)]
Revert "gn build: (manually) merge r373028"

This reverts commit r373029, which depends on r373028, which I reverted.

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

5 years ago[X86] Remove CodeGenOnly instructions added in r373021, but keep the isel patterns...
Craig Topper [Thu, 26 Sep 2019 23:22:15 +0000 (23:22 +0000)]
[X86] Remove CodeGenOnly instructions added in r373021, but keep the isel patterns and add COPY_TO_REGCLASS to them.

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

5 years agogn build: (manually) merge r373028
Nico Weber [Thu, 26 Sep 2019 23:17:25 +0000 (23:17 +0000)]
gn build: (manually) merge r373028

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

5 years ago[X86] Remove unused arguments from a tablegen multiclass. NFC
Craig Topper [Thu, 26 Sep 2019 22:56:19 +0000 (22:56 +0000)]
[X86] Remove unused arguments from a tablegen multiclass. NFC

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

5 years ago[X86] Add VMOVSSZrrk/VMOVSDZrrk/VMOVSSZrrkz/VMOVSDZrrkz to getUndefRegClearance.
Craig Topper [Thu, 26 Sep 2019 22:56:06 +0000 (22:56 +0000)]
[X86] Add VMOVSSZrrk/VMOVSDZrrk/VMOVSSZrrkz/VMOVSDZrrkz to getUndefRegClearance.

We have isel patterns that can put an IMPLICIT_DEF on one of
the sources for these instructions. So we should make sure
we break any dependencies there. This should be done by
just using one of the other sources.

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

5 years agoRemove the AliasAnalysis argument in function areMemAccessesTriviallyDisjoint
Changpeng Fang [Thu, 26 Sep 2019 22:53:44 +0000 (22:53 +0000)]
Remove the AliasAnalysis argument in function areMemAccessesTriviallyDisjoint

Reviewers:
  arsenm

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

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

5 years ago[X86] Add CodeGenOnly instructions for (f32 (X86selects $mask, (loadf32 addr), fp32im...
Craig Topper [Thu, 26 Sep 2019 22:23:09 +0000 (22:23 +0000)]
[X86] Add CodeGenOnly instructions for (f32 (X86selects $mask, (loadf32 addr), fp32imm0) to use masked MOVSS from memory.

Similar for f64 and having a non-zero passthru value.

We were previously not trying to fold the load at all. Using
a CodeGenOnly instruction allows us to use FR32X/FR64X as the
register class to avoid a bunch of COPY_TO_REGCLASS.

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

5 years agoRevert [SLP] Fix for PR31847: Assertion failed: (isLoopInvariant(Operands[i], L)...
Jordan Rupprecht [Thu, 26 Sep 2019 22:09:17 +0000 (22:09 +0000)]
Revert [SLP] Fix for PR31847: Assertion failed: (isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!")

This reverts r372626 (git commit 6a278d9073bdc158d31d4f4b15bbe34238f22c18)

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

5 years ago[LoopFusion] Add ability to fuse guarded loops
Kit Barton [Thu, 26 Sep 2019 21:42:45 +0000 (21:42 +0000)]
[LoopFusion] Add ability to fuse guarded loops

Summary:
This patch extends the current capabilities in loop fusion to fuse guarded loops
(as defined in https://reviews.llvm.org/D63885). The patch adds the necessary
safety checks to ensure that it safe to fuse the guarded loops (control flow
equivalent, no intervening code, and same guard conditions). It also provides an
alternative method to perform the actual fusion of guarded loops. The mechanics
to fuse guarded loops are slightly different then fusing non-guarded loops, so I
opted to keep them separate methods. I will be cleaning this up in later
patches, and hope to converge on a single method to fuse both guarded and
non-guarded loops, but for now I think the review will be easier to keep them
separate.

Reviewers: jdoerfert, Meinersbur, dmgreen, etiotto, Whitney

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[Unroll] Do NOT unroll a loop with small runtime upperbound
Zhaoshi Zheng [Thu, 26 Sep 2019 21:40:27 +0000 (21:40 +0000)]
[Unroll] Do NOT unroll a loop with small runtime upperbound

For a runtime loop if we can compute its trip count upperbound:

Don't unroll if:
1. loop is not guaranteed to run either zero or upperbound iterations; and
2. trip count upperbound is less than UnrollMaxUpperBound
Unless user or TTI asked to do so.

If unrolling, limit unroll factor to loop's trip count upperbound.

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

Change-Id: I6083c46a9d98b2e22cd855e60523fdc5a4929c73

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

5 years ago[AMDGPU] copy OtherPredicates from pseudo to VOP3_Real
Stanislav Mekhanoshin [Thu, 26 Sep 2019 21:06:17 +0000 (21:06 +0000)]
[AMDGPU] copy OtherPredicates from pseudo to VOP3_Real

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

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

5 years ago[DAGCombine][X86][AArch64][NFC] Add tests for shift-by-signext
Roman Lebedev [Thu, 26 Sep 2019 20:49:49 +0000 (20:49 +0000)]
[DAGCombine][X86][AArch64][NFC] Add tests for shift-by-signext

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

5 years ago[InstCombine][NFC] Add tests for shift-by-signext
Roman Lebedev [Thu, 26 Sep 2019 20:49:30 +0000 (20:49 +0000)]
[InstCombine][NFC] Add tests for shift-by-signext

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

5 years ago[InstCombine][NFC] Regenerate load-cmp.ll test
Roman Lebedev [Thu, 26 Sep 2019 20:49:21 +0000 (20:49 +0000)]
[InstCombine][NFC] Regenerate load-cmp.ll test

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

5 years ago[LOOPGUARD] Disable loop with multiple loop exiting blocks.
Whitney Tsang [Thu, 26 Sep 2019 20:20:42 +0000 (20:20 +0000)]
[LOOPGUARD] Disable loop with multiple loop exiting blocks.
Summary: As discussed in the loop group meeting. With the current
definition of loop guard, we should not allow multiple loop exiting
blocks. For loops that has multiple loop exiting blocks, we can simply
unable to find the loop guard.
When getUniqueExitBlock() obtains a vector size not equals to one, that
means there is either no exit blocks or there exists more than one
unique block the loop exit to.
If we don't disallow loop with multiple loop exit blocks, then with our
current implementation, there can exist exit blocks don't post dominated
by the non pre-header successor of the guard block.
Reviewer: reames, Meinersbur, kbarton, etiotto, bmahjour
Reviewed By: Meinersbur, kbarton
Subscribers: fhahn, hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D66529

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

5 years ago[AIX]Emit function descriptor csect in assembly
Xiangling Liao [Thu, 26 Sep 2019 19:38:32 +0000 (19:38 +0000)]
[AIX]Emit function descriptor csect in assembly

This patch emits the function descriptor csect for functions with definitions
under both 32-bit/64-bit mode on AIX.

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

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

5 years ago[NFC][emacs] remove out-of-date comment from tablegen-mode.el
Bob Haarman [Thu, 26 Sep 2019 19:36:01 +0000 (19:36 +0000)]
[NFC][emacs] remove out-of-date comment from tablegen-mode.el

Summary:
The syntax table was originally based on and attributed to
jasmin.el, but was rewritten in r45192, so the comment that
says the code comes from jasmin.el is no longer accurate. This
change removes the comment, shortening the code a bit.

Reviewers: MaskRay, lattner

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Precommit tests for D68089
David Bolvansky [Thu, 26 Sep 2019 19:01:18 +0000 (19:01 +0000)]
[NFC] Precommit tests for D68089

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

5 years agoDocument requirement of function attributes with constrained floating
Kevin P. Neal [Thu, 26 Sep 2019 17:50:25 +0000 (17:50 +0000)]
Document requirement of function attributes with constrained floating
point.

Reviewed by:    andrew.w.kaylor, uweigand, efriedma
Approved by:    andrew.w.kaylor
Differential Revision:  https://reviews.llvm.org/D67839

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

5 years agoDAGISelMatcherOpt - TGParser::ParseOperation - silence static analyzer cast_or_null...
Simon Pilgrim [Thu, 26 Sep 2019 17:38:47 +0000 (17:38 +0000)]
DAGISelMatcherOpt - TGParser::ParseOperation - silence static analyzer cast_or_null<CheckTypeMatcher> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, replace with an null/isa assertion and cast<CheckTypeMatcher>.

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

5 years ago[InstCombine] Use m_Zero instead of isNullValue() when checking if a GEP index is...
Craig Topper [Thu, 26 Sep 2019 17:20:50 +0000 (17:20 +0000)]
[InstCombine] Use m_Zero instead of isNullValue() when checking if a GEP index is all zeroes to prevent an infinite loop.

The test case here previously infinite looped. Only one element from the GEP is used so SimplifyDemandedVectorElts would replace the other lanes in each index with undef leading to the first index being <0, undef, undef, undef>. But there's a GEP transform that tries to replace an index into a 0 sized type with a zero index. But the zero index check only works on ConstantInt 0 or ConstantAggregateZero so it would turn the index back to zeroinitializer. Resulting in a loop.

The fix is to use m_Zero() to allow a vector of zeroes and undefs.

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

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

5 years agoTGParser::ParseOperation - silence static analyzer dyn_cast<TypedInit> null dereferen...
Simon Pilgrim [Thu, 26 Sep 2019 17:11:02 +0000 (17:11 +0000)]
TGParser::ParseOperation - silence static analyzer dyn_cast<TypedInit> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<TypedInit> directly and if not assert will fire for us.

I've also pulled out the repeated getType() call which was the only user of the pointer.

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

5 years agoConstantFold - silence static analyzer dyn_cast<ExtractValueInst> null dereference...
Simon Pilgrim [Thu, 26 Sep 2019 16:30:36 +0000 (16:30 +0000)]
ConstantFold - silence static analyzer dyn_cast<ExtractValueInst> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<ExtractValueInst> directly and if not assert will fire for us.

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

5 years agoARMBaseInstrInfo getOperandLatency - silence static analyzer dyn_cast<> null derefere...
Simon Pilgrim [Thu, 26 Sep 2019 16:05:55 +0000 (16:05 +0000)]
ARMBaseInstrInfo getOperandLatency - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use cast<> directly and if not assert will fire for us.

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

5 years ago[PowerPC] Fix typo in rL372985
Jinsong Ji [Thu, 26 Sep 2019 15:49:11 +0000 (15:49 +0000)]
[PowerPC] Fix typo in rL372985

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

5 years ago[LoopInfo] Limit the iterations to check whether a loop has dedicated exits
Wei Mi [Thu, 26 Sep 2019 15:36:25 +0000 (15:36 +0000)]
[LoopInfo] Limit the iterations to check whether a loop has dedicated exits
for extreme large case.

We had a case that a single loop which has 4000 exits and the average number
of predecessors of each exit is > 1000, and we found compiling the case spent
a significant amount of time on checking whether a loop has dedicated exits.
This patch adds a limit for the iterations to the check. With the patch, the
time to compile our testcase reduced from 1000s to 200s (clang release build).

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

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

5 years agoHandle successor's PHI node correctly when flattening CFG merges two if-regions
Jakub Kuderski [Thu, 26 Sep 2019 15:20:17 +0000 (15:20 +0000)]
Handle successor's PHI node correctly when flattening CFG merges two if-regions

Summary:
FlattenCFG merges two 'if' basicblocks by inserting one basicblock
to another basicblock. The inserted basicblock can have a successor
that contains a PHI node whoes incoming basicblock is the inserted
basicblock. Since the existing code does not handle it, it becomes
a badref.

if (cond1)
  statement
if (cond2)
  statement
successor - contains PHI node whose predecessor is cond2

-->
if (cond1 || cond2)
  statement
(BB for cond2 was deleted)
successor - contains PHI node whose predecessor is cond2 --> bad ref!

Author: Jaebaek Seo

Reviewers: asbirlea, kuhar, tstellar, chandlerc, davide, dexonsmith

Reviewed By: kuhar

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoFix typo
Matt Arsenault [Thu, 26 Sep 2019 15:20:16 +0000 (15:20 +0000)]
Fix typo

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

5 years ago[NFC] Rearrange Value::getPointerAlignment
Guillaume Chatelet [Thu, 26 Sep 2019 15:13:05 +0000 (15:13 +0000)]
[NFC] Rearrange Value::getPointerAlignment

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoUpdated comments in LWZtoc pseudo expansion.
Sean Fertile [Thu, 26 Sep 2019 15:12:30 +0000 (15:12 +0000)]
Updated comments in LWZtoc pseudo expansion.

Refined a couple of the comments in the LWZtoc expansion code based on
a post commit review comment.

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

5 years ago[PowerPC] Add missing pattern for VSX Scalar Negative Multiply-Subtract Single Precision
Jinsong Ji [Thu, 26 Sep 2019 15:11:33 +0000 (15:11 +0000)]
[PowerPC] Add missing pattern for VSX Scalar Negative Multiply-Subtract Single Precision

Summary:
This was found during review of https://reviews.llvm.org/D66050.
In the simple test of fdiv, we miss to fold
```
        fneg 2, 2
        xsmaddasp 3, 2, 0
```
to
```
        xsnmsubasp 3, 2, 0
```
We have the patterns for Double Precision and vectors, just missing
Single Precision, the patch add that.

Reviewers: #powerpc, hfinkel, nemanjai, steven.zhang

Reviewed By: #powerpc, steven.zhang

Subscribers: wuzish, hiraditya, kbarton, MaskRay, shchenz, llvm-commits

Tags: #llvm

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

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

5 years agobuild_llvm_package.bat: Bootstrap with VS 2019
Hans Wennborg [Thu, 26 Sep 2019 14:57:55 +0000 (14:57 +0000)]
build_llvm_package.bat: Bootstrap with VS 2019

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

5 years ago[FlattenCFG] Silence static analyzer dyn_cast<BranchInst> null dereference warnings...
Simon Pilgrim [Thu, 26 Sep 2019 13:33:15 +0000 (13:33 +0000)]
[FlattenCFG] Silence static analyzer dyn_cast<BranchInst> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereferences, but we should be able to use cast<BranchInst> directly and if not assert will fire for us.

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

5 years ago[llvm-ar][test] Move MRI tests from "llvm/test/Object/"
Owen Reynolds [Thu, 26 Sep 2019 12:32:11 +0000 (12:32 +0000)]
[llvm-ar][test] Move MRI tests from "llvm/test/Object/"

llvm/test/Object/ contains tests for the ArchiveWriter library, however
support for MRI scripts is found in llvm-ar and not the library. This
diff moves the MRI related tests and removes those that are duplicates.

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

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

5 years ago[InstCombine] Don't assume CmpInst has been visited in getFlippedStrictnessPredicateA...
Bjorn Pettersson [Thu, 26 Sep 2019 12:16:01 +0000 (12:16 +0000)]
[InstCombine] Don't assume CmpInst has been visited in getFlippedStrictnessPredicateAndConstant

Summary:
Removing an assumption (assert) that the CmpInst already has been
simplified in getFlippedStrictnessPredicateAndConstant. Solution is
to simply bail out instead of hitting the assertion. Instead we
assume that any profitable rewrite will happen in the next iteration
of InstCombine.

The reason why we can't assume that the CmpInst already has been
simplified is that the worklist does not guarantee such an ordering.

Solves https://bugs.llvm.org/show_bug.cgi?id=43376

Reviewers: spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-exegesis][NFC] Remove dead code.
Clement Courbet [Thu, 26 Sep 2019 11:32:44 +0000 (11:32 +0000)]
[llvm-exegesis][NFC] Remove dead code.

Summary: `hasAliasingImplicitRegistersThrough()` is no longer used.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

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

5 years agoMetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null...
Simon Pilgrim [Thu, 26 Sep 2019 11:30:47 +0000 (11:30 +0000)]
MetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MDNode> directly and if not assert will fire for us.

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

5 years agoRemove local shadow constant. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 11:30:35 +0000 (11:30 +0000)]
Remove local shadow constant. NFCI.

ValueTracking.cpp already has a local static MaxDepth = 6 constant - this one seems to have been missed when rL124183 landed.

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

5 years ago[ValueTracking] Silence static analyzer dyn_cast<Operator> null dereference warnings...
Simon Pilgrim [Thu, 26 Sep 2019 11:09:08 +0000 (11:09 +0000)]
[ValueTracking] Silence static analyzer dyn_cast<Operator> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereferences, but since the pointer is only used in a switch statement for Operator::getOpcode() (with an empty default) then its easiest just to wrap this in a null test as the dyn_cast might return null here.

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

5 years agoMemorySanitizer - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 10:56:14 +0000 (10:56 +0000)]
MemorySanitizer - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereferences, but we should be able to use cast<> directly and if not assert will fire for us.

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

5 years agoPGOMemOPSizeOpt - silence static analyzer dyn_cast<MemIntrinsic> null dereference...
Simon Pilgrim [Thu, 26 Sep 2019 10:56:07 +0000 (10:56 +0000)]
PGOMemOPSizeOpt - silence static analyzer dyn_cast<MemIntrinsic> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MemIntrinsic> directly and if not assert will fire for us.

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

5 years ago[BPF] Remove unused variables. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 10:55:57 +0000 (10:55 +0000)]
[BPF] Remove unused variables. NFCI.

Fixes a dyn_cast<> null dereference warning.

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

5 years ago[MIPS GlobalISel] Lower aggregate structure return arguments
Petar Avramovic [Thu, 26 Sep 2019 10:48:07 +0000 (10:48 +0000)]
[MIPS GlobalISel] Lower aggregate structure return arguments

Implement aggregate structure split to simpler types in splitToValueTypes.
splitToValueTypes is used for return values.
According to MipsABIInfo from clang/lib/CodeGen/TargetInfo.cpp,
aggregate structure arguments for O32 always get simplified and thus
will remain unsupported by the MIPS GlobalISel for the time being.
For O32, aggregate structures can be encountered only for complex number
returns e.g. 'complex float' or 'complex double' from <complex.h>.

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

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

5 years agoHexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantE...
Simon Pilgrim [Thu, 26 Sep 2019 10:35:19 +0000 (10:35 +0000)]
HexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantExpr> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MCConstantExpr> directly and if not assert will fire for us.

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

5 years ago[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks
Simon Pilgrim [Thu, 26 Sep 2019 10:23:57 +0000 (10:23 +0000)]
[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks

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

5 years ago[CostModel][X86] Fix SLM <2 x i64> icmp costs
Simon Pilgrim [Thu, 26 Sep 2019 10:14:38 +0000 (10:14 +0000)]
[CostModel][X86] Fix SLM <2 x i64> icmp costs

SLM is 2 x slower for <2 x i64> comparison ops than other vector types, we should account for this like we do for SLM <2 x i64> add/sub/mul costs.

This should remove some of the SLM codegen diffs in D43582

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

5 years ago[SystemZ] Recognize mnop-mcount in backend
Jonas Paulsson [Thu, 26 Sep 2019 08:38:07 +0000 (08:38 +0000)]
[SystemZ]  Recognize mnop-mcount in backend

With -pg -mfentry -mnop-mcount, a nop is emitted instead of the call to
fentry.

Review: Ulrich Weigand
https://reviews.llvm.org/D67765

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

5 years ago[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.
Craig Topper [Thu, 26 Sep 2019 07:27:26 +0000 (07:27 +0000)]
[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.

This matches what's done for VRNDSCALE and most other instructions.

This mainly determines which instruction will be preferred by
disassembler and assembly parser. The printing and encoding
information is the same.

We prefer the _Int form since it uses the VR128 class due to
intrinsic interface. For some of EVEX features like embedded
rounding, we only select from intrinsics today. So there is
only a VR128 version. So making the VR128 version the preferred
is overally consistent.

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

5 years ago [IfConversion] Disallow TBB == FBB for valid triangles
Mikael Holmen [Thu, 26 Sep 2019 06:35:55 +0000 (06:35 +0000)]
 [IfConversion] Disallow TBB == FBB for valid triangles

Summary:
Previously the case

     EBB
     | \_
     |  |
     | TBB
     |  /
     FBB

was treated as a valid triangle also when TBB and FBB was the same basic
block. This could then lead to an invalid CFG when we removed the edge
from EBB to TBB, since that meant we would also remove the edge from EBB
to FBB.

Since TBB == FBB is quite a degenerated case of a triangle, we now
don't treat it as a valid triangle anymore, and thus we will avoid the
trouble with updating the CFG.

Reviewers: efriedma, dmgreen, kparzysz

Reviewed By: efriedma

Subscribers: bjope, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding...
Craig Topper [Thu, 26 Sep 2019 04:42:58 +0000 (04:42 +0000)]
[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding of the other operand.

The SSE and VEX versions are already correct.

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

5 years ago[ConstantFolding] Use FoldBitCast correctly
Keno Fischer [Thu, 26 Sep 2019 02:07:51 +0000 (02:07 +0000)]
[ConstantFolding] Use FoldBitCast correctly

Previously we might attempt to use a BitCast to turn bits into vectors of pointers,
but that requires an inttoptr cast to be legal. Add an assertion to detect the formation of illegal bitcast attempts
early (in the tests, we often constant-fold away the result before getting to this assertion check),
while being careful to still handle the early-return conditions without adding extra complexity in the result.

Patch by Jameson Nash <jameson@juliacomputing.com>.

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

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

5 years agoImprove C API support for atomicrmw and cmpxchg.
Nick Lewycky [Thu, 26 Sep 2019 00:58:55 +0000 (00:58 +0000)]
Improve C API support for atomicrmw and cmpxchg.

atomicrmw and cmpxchg have a volatile flag, so allow them to be get and set with LLVM{Get,Set}Volatile. atomicrmw and fence have orderings, so allow them to be get and set with LLVM{Get,Set}Ordering. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

atomicrmw and cmpxchg have a volatile flag, so allow it to be set/get with LLVMGetVolatile and LLVMSetVolatile. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

Add LLVMIsA## for CatchSwitchInst, CallBrInst and FenceInst, as well as AtomicCmpXchgInst and AtomicRMWInst.

Update llvm-c-test to include atomicrmw and fence, and to copy volatile for the four applicable instructions.

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

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

5 years ago[TargetLowering] Make allowsMemoryAccess methode virtual.
Thomas Raoux [Thu, 26 Sep 2019 00:16:01 +0000 (00:16 +0000)]
[TargetLowering] Make allowsMemoryAccess methode virtual.

Rename old function to explicitly show that it cares only about alignment.
The new allowsMemoryAccess call the function related to alignment by default
and can be overridden by target to inform whether the memory access is legal or
not.

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

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

5 years ago[MC][WebAssembly] Error on data symbols in the text section.
Sam Clegg [Wed, 25 Sep 2019 23:33:16 +0000 (23:33 +0000)]
[MC][WebAssembly] Error on data symbols in the text section.

Previously we had an assert but this can actually occur in valid user
code so we need to handle this in release builds too.

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

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

5 years ago[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.
Craig Topper [Wed, 25 Sep 2019 23:25:15 +0000 (23:25 +0000)]
[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.

This pass is only concerned with ZMM0-15 and YMM0-15. For YMM
we use VR256 which only contains YMM0-15, but for ZMM we were
using VR512 which contains ZMM0-31. Using VR512_0_15 is more
correct.

Given that the ABI and register allocator will use registers in
order, its unlikely that register from 16-31 would be used
without also using 0-15. So this probably doesn't functionally
matter.

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

5 years ago[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.
Alina Sbirlea [Wed, 25 Sep 2019 23:24:39 +0000 (23:24 +0000)]
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Summary:
If a block has all incoming values with the same MemoryAccess (ignoring
incoming values from unreachable blocks), then use that incoming
MemoryAccess and do not create a Phi in the first place.

Revert IDF work-around added in rL372673; it should not be required unless
the Def inserted is the first in its block.

The patch also cleans up a series of tests, added during the many
iterations on insertDef.

The patch also fixes PR43438.
The same issue that occurs in insertDef with "adding phis, hence the IDF of
Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive`
call only adds Phis walking on the predecessor edges, which means there
may be the case of a Phi added walking the CFG "backwards" which
triggers the needs for an additional Phi in successor blocks.
Such Phis are added during fixupDefs only in the presence of unreachable
blocks.
Hence this highlights the need to avoid adding Phis in blocks with
unreachable predecessors in the first place.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:59 +0000 (22:59 +0000)]
[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)

https://rise4fun.com/Alive/0j9

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

5 years ago[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:48 +0000 (22:59 +0000)]
[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)

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

5 years ago[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:41 +0000 (22:59 +0000)]
[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)

https://rise4fun.com/Alive/sl9s
https://rise4fun.com/Alive/2plN

https://bugs.llvm.org/show_bug.cgi?id=43251

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

5 years ago[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B...
Roman Lebedev [Wed, 25 Sep 2019 22:59:24 +0000 (22:59 +0000)]
[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B) !=/== 0' pattern (PR43251)

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

5 years ago[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.
Eli Friedman [Wed, 25 Sep 2019 22:35:47 +0000 (22:35 +0000)]
[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.

For large functions, verifying the whole function after each loop takes
non-linear time.

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

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

5 years ago[Verifier] add invariant check for callbr
Nick Desaulniers [Wed, 25 Sep 2019 22:28:27 +0000 (22:28 +0000)]
[Verifier] add invariant check for callbr

Summary:
The list of indirect labels should ALWAYS have their blockaddresses as
argument operands to the callbr (but not necessarily the other way
around).  Add an invariant that checks this.

The verifier catches a bad test case that was added recently in r368478.
I think that was a simple mistake, and the test was made less strict in
regards to the precise addresses (as those weren't specifically the
point of the test).

This invariant will be used to find a reported bug.

Link: https://www.spinics.net/lists/arm-kernel/msg753473.html
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Reviewers: craig.topper, void, chandlerc

Reviewed By: void

Subscribers: ychen, lebedev.ri, javed.absar, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

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

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

5 years ago[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul
Florian Hahn [Wed, 25 Sep 2019 19:33:26 +0000 (19:33 +0000)]
[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul

Because we do not constant fold multiplications in SimplifyFMAMul,
we match 1.0 and 0.0 for both operands, as multiplying by them
is guaranteed to produce an exact result (if it is allowed to do so).

Note that it is not enough to just swap the operands to ensure a
constant is on the RHS, as we want to also cover the case with
2 constants.

Reviewers: lebedev.ri, spatel, reames, scanon

Reviewed By: lebedev.ri, reames

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

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

5 years ago[InstCombine] Fold (A - B) u>=/u< A --> B u>/u<= A iff B != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:40 +0000 (19:06 +0000)]
[InstCombine] Fold  (A - B) u>=/u< A  --> B  u>/u<= A  iff B != 0

https://rise4fun.com/Alive/KtL

This also shows that the fold added in D67412 / r372257
was too specific, and the new fold allows those test cases
to be handled more generically, therefore i delete now-dead code.

This is yet again motivated by
D67122 "[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour"

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

5 years ago[NFC][InstCombine] Add tests for (X - Y) < X --> Y <= X iff Y != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:26 +0000 (19:06 +0000)]
[NFC][InstCombine] Add tests for (X - Y) < X  -->  Y <= X  iff  Y != 0

https://rise4fun.com/Alive/KtL
This should go to InstCombiner::foldICmpBinO(), next to
"Convert sub-with-unsigned-overflow comparisons into a comparison of args."

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

5 years ago[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.
Vadzim Dambrouski [Wed, 25 Sep 2019 18:58:07 +0000 (18:58 +0000)]
[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.

Summary:
Useful in case you want to have control over interrupt vector generation.
For example in Rust language we have an arrangement where all unhandled
ISR vectors gets mapped to a single default handler function. Which is
hard to implement when LLVM tries to generate vectors on its own.

Reviewers: asl, krisb

Subscribers: hiraditya, JDevlieghere, awygle, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Improve fma.f64 test. NFC.
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:50:34 +0000 (18:50 +0000)]
[AMDGPU] Improve fma.f64 test. NFC.

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

5 years ago[AMDGPU] gfx10 v_fmac_f16 operand folding
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:40:20 +0000 (18:40 +0000)]
[AMDGPU] gfx10 v_fmac_f16 operand folding

Fold immediates into v_fmac_f16.

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

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

5 years ago[emacs] simplify and improve keyword highlighting in tablegen-mode.el
Bob Haarman [Wed, 25 Sep 2019 18:16:02 +0000 (18:16 +0000)]
[emacs] simplify and improve keyword highlighting in tablegen-mode.el

Summary:
The keyword and type keyword matchers in tablegen-mode.el checked
for space, newline, tab, or open paren after the regular expression
that matches keywords (or type keywords, respectively). This is
unnecessary, because those regular expressions already include word
boundaries. This change removes the extra check. This also causes
"def" in "def:" to be highlighted as a keyword, which was missed
before.

Reviewers: lattner, MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 25 Sep 2019 17:32:20 +0000 (17:32 +0000)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp:254:25: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  std::array<int, 5> A1{42, -5, 0, 1000000, -1000000};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        {                           }

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

5 years ago[InstCombine] Limit FMul constant folding for fma simplifications.
Florian Hahn [Wed, 25 Sep 2019 17:03:20 +0000 (17:03 +0000)]
[InstCombine] Limit FMul constant folding for fma simplifications.

As @reames pointed out post-commit, rL371518 adds additional rounding
in some cases, when doing constant folding of the multiplication.
This breaks a guarantee llvm.fma makes and must be avoided.

This patch reapplies rL371518, but splits off the simplifications not
requiring rounding from SimplifFMulInst as SimplifyFMAFMul.

Reviewers: spatel, lebedev.ri, reames, scanon

Reviewed By: reames

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

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

5 years ago[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering
Jessica Paquette [Wed, 25 Sep 2019 16:45:35 +0000 (16:45 +0000)]
[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering

When checking for tail call eligibility, we should use the correct CCAssignFn
for each argument, rather than just checking if the caller/callee is varargs or
not.

This is important for tail call lowering with varargs. If we don't check it,
then basically any varargs callee with parameters cannot be tail called on
Darwin, for one thing. If the parameters are all guaranteed to be in registers,
this should be entirely safe.

On top of that, not checking for this could potentially make it so that we have
the wrong stack offsets when checking for tail call eligibility.

Also refactor some of the stuff for CCAssignFnForCall and pull it out into a
helper function.

Update call-translator-tail-call.ll to show that we can now correctly tail call
on Darwin. Also add two extra tail call checks. The first verifies that we still
respect the caller's stack size, and the second verifies that we still don't
tail call when a varargs function has a memory argument.

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

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

5 years ago[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets
Evandro Menezes [Wed, 25 Sep 2019 16:10:20 +0000 (16:10 +0000)]
[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets

Modern processors predict the targets of an indirect branch regardless of
the size of any jump table used to glean its target address.  Moreover,
branch predictors typically use resources limited by the number of actual
targets that occur at run time.

This patch changes the semantics of the option `-max-jump-table-size` to limit
the number of different targets instead of the number of entries in a jump
table.  Thus, it is now renamed to `-max-jump-table-targets`.

Before, when `-max-jump-table-size` was specified, it could happen that
cluster jump tables could have targets used repeatedly, but each one was
counted and typically resulted in tables with the same number of entries.
With this patch, when specifying `-max-jump-table-targets`, tables may have
different lengths, since the number of unique targets is counted towards the
limit, but the number of unique targets in tables is the same, but for the
last one containing the balance of targets.

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

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

5 years ago[LangRef] Clarify absence of rounding guarantees for fmuladd.
Florian Hahn [Wed, 25 Sep 2019 16:09:24 +0000 (16:09 +0000)]
[LangRef] Clarify absence of rounding guarantees for fmuladd.

During the review of D67434, it was recommended to make fmuladd's
behavior more explicit. D67434 depends on this interpretation.

Reviewers: efriedma, jfb, reames, scanon, lebedev.ri, spatel

Reviewed By: spatel

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

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

5 years ago[DAGCombiner] add one-use restriction to vector transform with cheap extract
Sanjay Patel [Wed, 25 Sep 2019 15:08:33 +0000 (15:08 +0000)]
[DAGCombiner] add one-use restriction to vector transform with cheap extract

We might be able to do better on the example in the test,
but in general, we should not scalarize a splatted vector
binop if there are other uses of the binop. Otherwise, we
can end up with code as we had - a scalar op that is
redundant with a vector op.

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

5 years ago[PatternMatch] Make m_Br more flexible, add matchers for BB values.
Florian Hahn [Wed, 25 Sep 2019 15:05:08 +0000 (15:05 +0000)]
[PatternMatch] Make m_Br more flexible, add matchers for BB values.

Currently m_Br only takes references to BasicBlock*, which limits its
flexibility. For example, you have to declare a variable, even if you
ignore the result or you have to have additional checks to make sure the
matched BB matches an expected one.

This patch adds m_BasicBlock and m_SpecificBB matchers, which can be
used like the existing matchers for constants or values.

I also had a look at the existing uses and updated a few. IMO it makes
the code a bit more explicit.

Reviewers: spatel, craig.topper, RKSimon, majnemer, lebedev.ri

Reviewed By: lebedev.ri

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

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

5 years ago[x86] add test for multi-use scalarization of vector binop; NFC
Sanjay Patel [Wed, 25 Sep 2019 14:57:45 +0000 (14:57 +0000)]
[x86] add test for multi-use scalarization of vector binop; NFC

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

5 years ago[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&
Simon Pilgrim [Wed, 25 Sep 2019 14:55:57 +0000 (14:55 +0000)]
[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&

Neither the base implementation of findCommutedOpIndices nor any in-tree target modifies the instruction passed in and there is no reason why they would in the future.

Committed on behalf of @hvdijk (Harald van Dijk)

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

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

5 years ago[PatternMatch] Generalize brc_match (NFC).
Florian Hahn [Wed, 25 Sep 2019 14:53:06 +0000 (14:53 +0000)]
[PatternMatch] Generalize brc_match (NFC).

Preparation for D68013.

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

5 years ago[IR] allow fast-math-flags on phi of FP values (2nd try)
Sanjay Patel [Wed, 25 Sep 2019 14:35:02 +0000 (14:35 +0000)]
[IR] allow fast-math-flags on phi of FP values (2nd try)

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917 <https://reviews.llvm.org/D61917>

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

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

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

5 years agoFix analyzer TypeAttributeImpl::anchor() override.
Simon Pilgrim [Wed, 25 Sep 2019 14:23:25 +0000 (14:23 +0000)]
Fix analyzer TypeAttributeImpl::anchor() override.

TypeAttributeImpl inherits from EnumAttributeImpl which already defines anchor() as a virtual, so we should override this instead of redeclaring it.

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

5 years ago[gn build] Fix Python DeprecationWarning
Marco Antognini [Wed, 25 Sep 2019 14:15:34 +0000 (14:15 +0000)]
[gn build] Fix Python DeprecationWarning

Summary:
This fixes two issues:
 - DeprecationWarning: invalid escape sequence \`
 - ResourceWarning: unclosed file

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Clean...
Jakub Kuderski [Wed, 25 Sep 2019 14:04:36 +0000 (14:04 +0000)]
[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Cleanup MachinePostDominators.

Summary:
This patch fixes a bug that originated from passing a virtual exit block (nullptr) to `MachinePostDominatorTee::findNearestCommonDominator` and resulted in assertion failures inside its callee. It also applies a small cleanup to the class.

The patch introduces a new function in PDT that given a list of `MachineBasicBlock`s finds their NCD. The new overload of `findNearestCommonDominator` handles virtual root correctly.

Note that similar handling of virtual root nodes is not necessary in (forward) `DominatorTree`s, as right now they don't use virtual roots.

Reviewers: tstellar, tpr, nhaehnle, arsenm, NutshellySima, grosser, hliao

Reviewed By: hliao

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

Tags: #amdgpu, #llvm

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

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