Commit Graph

7248 Commits

Author SHA1 Message Date
Craig Topper
64c8cdfd4f [KnownBits] Add methods for determining if KnownBits is a constant value
This patch adds isConstant and getConstant for determining if KnownBits represents a constant value and to retrieve the value. Use them to simplify code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 23:12:29 +00:00
Craig Topper
f990516387 [ValueTracking] Remove handling for BitWidth being 0 in ComputeSignBit and isKnownNonZero.
I don't believe its possible to have non-zero values here since DataLayout became required. The APInt constructor inside of the KnownBits object will assert if this ever happens.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 22:25:19 +00:00
Craig Topper
f78221855b [KnownBits] Add zext, sext, and trunc methods to KnownBits
This patch adds zext, sext, and trunc methods to KnownBits and uses them where possible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 22:07:25 +00:00
Reid Kleckner
a82b376f69 [IR] Abstract away ArgNo+1 attribute indexing as much as possible
Summary:
Do three things to help with that:
- Add AttributeList::FirstArgIndex, which is an enumerator currently set
  to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call
  sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that
  take attribute list indices.  Most of these were only used from
  BuildLibCalls, and doesNotAlias was only used to test or set if the
  return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:
  0: func attrs
  1: retattrs
  2...: arg attrs

Reviewers: chandlerc, pete, javed.absar

Subscribers: david2050, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302060 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:17:31 +00:00
Matt Arsenault
921f454dae Replace hardcoded intrinsic list with speculatable attribute.
No change in which intrinsics should be speculated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301995 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 02:26:10 +00:00
Peter Collingbourne
8d8582cf12 Revert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals."
We should always expect values to be named before running the module summary
analysis (see NameAnonGlobals pass), so it's fine if we crash in that case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 00:18:48 +00:00
Sanjay Patel
05c11eb3e6 revert r301766: InstructionSimplify: Canonicalize shuffle operands. NFC-ish
Turns out this wasn't NFC-ish at all because there's a bug processing shuffles
that change the size of their input vectors (that case always seems to trip us
up). 

This should fix PR32872 while we investigate how it failed and reduce a testcase:
https://bugs.llvm.org/show_bug.cgi?id=32872
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02 21:37:28 +00:00
Xinliang David Li
afb34f6072 Refactor callsite cost computation into a helper function /NFC
Makes code more readable. The function will also be used
by the partial inlining's cost analysis.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02 05:38:41 +00:00
George Burgess IV
4d11ee489b Revert r301880
This change caused buildbot failures, apparently because we're not
passing around types that InstSimplify is used to seeing. I'm not overly
familiar with InstSimplify, so I'm reverting this until I can figure out
what exactly is wrong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 23:54:41 +00:00
George Burgess IV
8bd46914df [InstSimplify] Handle selects of GEPs with 0 offset
In particular (since it wouldn't fit nicely in the summary):
(select (icmp eq V 0) P (getelementptr P V)) -> (getelementptr P V)

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301880 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 23:12:08 +00:00
Sanjoy Das
399b4d037d Rename WeakVH to WeakTrackingVH; NFC
This relands r301424.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301812 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 17:07:49 +00:00
Sanjoy Das
21ade9ba1e Rename isKnownNotFullPoison to programUndefinedIfPoison; NFC
Summary:
programUndefinedIfPoison makes more sense, given what the function
does; and I'm about to add a function with a name similar to
isKnownNotFullPoison (so do the rename to avoid confusion).

Reviewers: broune, majnemer, bjarke.roune

Reviewed By: broune

Subscribers: mcrosier, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301776 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-30 19:41:19 +00:00
Zvi Rackover
c6bea6e868 InstructionSimplify: Canonicalize shuffle operands. NFC-ish.
Summary:
 Apply canonicalization rules:
    1. Input vectors with no elements selected from can be replaced with undef.
    2. If only one input vector is constant it shall be the second one.

This allows constant-folding to cover more ad-hoc simplifications that
were in place and avoid duplication for RHS and LHS checks.

There are more rules we may want to add in the future when we see a
justification. e.g. mask elements that select undef elements can be
replaced with undef.

Reviewers: spatel, RKSimon, andreadb, davide

Reviewed By: spatel, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301766 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-30 06:25:04 +00:00
Zvi Rackover
f24bed9225 InstructionSimplify: One getShuffleMask() replacing multiple getMaskValue(). NFC.
Summary: This is a preparatory step for D32338.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon, spatel

Subscribers: spatel, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301765 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-30 06:10:54 +00:00
Zvi Rackover
778f5177f0 InstructionSimplify: Simplify a shuffle with a undef mask to undef
Summary:
Following the discussion in pr32486, adding the simplification:
 shuffle %x, %y, undef -> undef

Reviewers: spatel, RKSimon, andreadb, davide

Reviewed By: spatel

Subscribers: jroelofs, davide, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301764 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-30 06:06:26 +00:00
Craig Topper
8b69610574 [KnownBits] Add methods for determining if the known bits represent a negative/nonnegative number and add methods for changing the negative/nonnegative state
Summary: This patch adds isNegative, isNonNegative for querying whether the sign bit is known. It also adds makeNegative and makeNonNegative for controlling the sign bit.

Reviewers: RKSimon, spatel, davide

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-29 16:43:11 +00:00
Michael Zolotukhin
3456f7f5be [SCEV] Use early exit in createAddRecFromPHI. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:14:27 +00:00
Matt Arsenault
ba657060a1 [ValueTracking] Teach isSafeToSpeculativelyExecute() about the speculatable attribute
Patch by Tom Stellard

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 21:13:09 +00:00
Daniel Berlin
e2c5126dbb Kill off the old SimplifyInstruction API by converting remaining users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 19:55:38 +00:00
Reid Kleckner
331b9af31d Use Argument::hasAttribute and AttributeList::ReturnIndex more
This eliminates many extra 'Idx' induction variables in loops over
arguments in CodeGen/ and Target/. It also reduces the number of places
where we assume that ReturnIndex is 0 and that we should add one to
argument numbers to get the corresponding attribute list index.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301666 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 18:37:16 +00:00
Craig Topper
78b412f427 [APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 16:58:05 +00:00
Craig Topper
f743447b5e [LazyValueInfo] Fix typo in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301655 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 16:57:59 +00:00
Craig Topper
b08a076cbf [ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 16:57:55 +00:00
Jun Bum Lim
98e89d3bb4 [InlineCost] Improve the cost heuristic for Switch
Summary:
The motivation example is like below which has 13 cases but only 2 distinct targets

```
lor.lhs.false2:                                   ; preds = %if.then
  switch i32 %Status, label %if.then27 [
    i32 -7012, label %if.end35
    i32 -10008, label %if.end35
    i32 -10016, label %if.end35
    i32 15000, label %if.end35
    i32 14013, label %if.end35
    i32 10114, label %if.end35
    i32 10107, label %if.end35
    i32 10105, label %if.end35
    i32 10013, label %if.end35
    i32 10011, label %if.end35
    i32 7008, label %if.end35
    i32 7007, label %if.end35
    i32 5002, label %if.end35
  ]
```
which is compiled into a balanced binary tree like this on AArch64 (similar on X86)

```
.LBB853_9:                              // %lor.lhs.false2
        mov     w8, #10012
        cmp             w19, w8
        b.gt    .LBB853_14
// BB#10:                               // %lor.lhs.false2
        mov     w8, #5001
        cmp             w19, w8
        b.gt    .LBB853_18
// BB#11:                               // %lor.lhs.false2
        mov     w8, #-10016
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#12:                               // %lor.lhs.false2
        mov     w8, #-10008
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#13:                               // %lor.lhs.false2
        mov     w8, #-7012
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_14:                             // %lor.lhs.false2
        mov     w8, #14012
        cmp             w19, w8
        b.gt    .LBB853_21
// BB#15:                               // %lor.lhs.false2
        mov     w8, #-10105
        add             w8, w19, w8
        cmp             w8, #9          // =9
        b.hi    .LBB853_17
// BB#16:                               // %lor.lhs.false2
        orr     w9, wzr, #0x1
        lsl     w8, w9, w8
        mov     w9, #517
        and             w8, w8, w9
        cbnz    w8, .LBB853_23
.LBB853_17:                             // %lor.lhs.false2
        mov     w8, #10013
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_18:                             // %lor.lhs.false2
        mov     w8, #-7007
        add             w8, w19, w8
        cmp             w8, #2          // =2
        b.lo    .LBB853_23
// BB#19:                               // %lor.lhs.false2
        mov     w8, #5002
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#20:                               // %lor.lhs.false2
        mov     w8, #10011
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_21:                             // %lor.lhs.false2
        mov     w8, #14013
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#22:                               // %lor.lhs.false2
        mov     w8, #15000
        cmp             w19, w8
        b.ne    .LBB853_3
```
However, the inline cost model estimates the cost to be linear with the number
of distinct targets and the cost of the above switch is just 2 InstrCosts.
The function containing this switch is then inlined about 900 times.

This change use the general way of switch lowering for the inline heuristic. It
etimate the number of case clusters with the suitability check for a jump table
or bit test. Considering the binary search tree built for the clusters, this
change modifies the model to be linear with the size of the balanced binary
tree. The model is off by default for now :
  -inline-generic-switch-cost=false

This change was originally proposed by Haicheng in D29870.

Reviewers: hans, bmakam, chandlerc, eraman, haicheng, mcrosier

Reviewed By: hans

Subscribers: joerg, aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301649 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 16:04:03 +00:00
Craig Topper
955683a5c6 [ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301626 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 06:28:56 +00:00
Daniel Berlin
988e599a02 Kill the old Simplify* APIs, leave SimplifyInstruction for the moment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301467 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:17 +00:00
Daniel Berlin
5c3bf01e34 PHITransAddr: Use new SimplifyQuery based API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:13 +00:00
Craig Topper
58c7fe69d0 [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits
This patch introduces a new KnownBits struct that wraps the two APInt used by computeKnownBits. This allows us to treat them as more of a unit.

Initially I've just altered the signatures of computeKnownBits and InstCombine's simplifyDemandedBits to pass a KnownBits reference instead of two separate APInt references. I'll do similar to the SelectionDAG version of computeKnownBits/simplifyDemandedBits as a separate patch.

I've added a constructor that allows initializing both APInts to the same bit width with a starting value of 0. This reduces the repeated pattern of initializing both APInts. Once place default constructed the APInts so I added a default constructor for those cases.

Going forward I would like to add more methods that will work on the pairs. For example trunc, zext, and sext occur on both APInts together in several places. We should probably add a clear method that can be used to clear both pieces. Maybe a method to check for conflicting information. A method to return (Zero|One) so we don't write it out everywhere. Maybe a method for (Zero|One).isAllOnesValue() to determine if all bits are known. I'm sure there are many other methods we can come up with.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:39:58 +00:00
Sanjoy Das
263da12ab2 Reverts commit r301424, r301425 and r301426
Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:37:05 +00:00
Sanjoy Das
d0cf26e443 Rename WeakVH to WeakTrackingVH; NFC
Summary:
I plan to use WeakVH to mean "nulls itself out on deletion, but does
not track RAUW" in a subsequent commit.

Reviewers: dblaikie, davide

Reviewed By: davide

Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:20:52 +00:00
Daniel Berlin
69cd18084e InstructionSimplify: Use braced initializer list for SimplifyQuery creation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301381 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 04:10:02 +00:00
Daniel Berlin
12b3d3d41e InstructionSimplify: Have SimplifyFPBinOp pass FastMathFlags by value, like we do everywhere else
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301380 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 04:10:00 +00:00
Daniel Berlin
32844579d8 InstructionSimplify: End our long national nightmare of ever-growing Simplify* arguments.
Summary:
Expose the internal query structure, start using it.

Note: This is the most minimal change possible i could create.  I have
trivial followups, like fixing the one use of const FastMathFlags &,
the renaming of CtxI to be consistent, etc.

This should be NFC.

Reviewers: majnemer, davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 04:09:56 +00:00
Craig Topper
21db70eaca [APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary APInts
This patch uses various APInt methods to reduce temporary APInt creation.

This should be all of the unrelated cleanups that got buried in D32376(creating a KnownBits struct) as well as some pointed out by Simon during the review of that. Plus a few improvements to use counting instead of masking.

I've left out any places where we do something like (KnownZero & KnownOne) != 0 as I plan to add a helper method to KnownBits to ask that question and didn't want to thrash that code an additional time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301338 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:46:30 +00:00
Craig Topper
b3518390c1 [InstSimplify] Handle (~A & ~B) | (~A ^ B) -> ~A ^ B
The code Sanjay Patel moved over from InstCombine doesn't work properly if the 'and' has both inputs as nots because we used a commuted op matcher on the 'and' first. But this will bind to the first 'not' on 'and' when there could be two 'not's. InstCombine could rely on DeMorgan to ensure the 'and' wouldn't have two 'not's eventually, but InstSimplify can't rely on that.

This patch matches the xor first then checks for the ands and allows a not of either operand of the xor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301329 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:01:32 +00:00
Craig Topper
c4708bac0e [ValueTracking] Use APInt::operator|=(uint64_t) instead of creating a temporary APInt. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301325 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:14 +00:00
Craig Topper
a14d021e5a [ValueTracking] Use APInt instead of auto. NFC
This is a pre-commit for a patch I'm working on to turn KnownZero/One into a struct. Once I do that the type here will be less obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:09 +00:00
Craig Topper
0a2cedfdb9 [ValueTracking] Use BitWidth local variable instead of re-reading it from KnownZero. NFC
This is a pre-commit for a patch that I'm working on to merge KnownZero/KnownOne into a KnownBits struct which would have had to touch this line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:03 +00:00
Sanjoy Das
390033473c [IVUsers] Don't bail out of normalizing non-affine add recs
Summary:
In a previous change I changed SCEV's normalization / denormalization
to work with non-affine add recs.  So the bailout in IVUsers can be
removed.

Reviewers: atrick, efriedma

Reviewed By: atrick

Subscribers: davide, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:53:25 +00:00
Sanjoy Das
79b9222927 Teach SCEV normalization to de/normalize non-affine add recs
Summary:
Before this change, SCEV Normalization would incorrectly normalize
non-affine add recurrences.  To work around this there was (still is)
a check in place to make sure we only tried to normalize affine add
recurrences.

We recently found a bug in aforementioned check to bail out of
normalizing non-affine add recurrences.  However, instead of fixing
the bailout, I have decided to teach SCEV normalization to work
correctly with non-affine add recurrences, making the bailout
unnecessary (I'll remove it in a subsequent change).

I've also added some unit tests (which would have failed before this
change).

Reviewers: atrick, sunfish, efriedma

Reviewed By: atrick

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301281 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 00:09:19 +00:00
Sanjay Patel
87f63fed93 [InstSimplify] use ConstantRange to simplify more and-of-icmps
We can simplify (and (icmp X, C1), (icmp X, C2)) to one of the icmps in many cases. 
I had to check some of these with Alive to prove to myself it's right, but everything 
seems to check out. Eg, the code in instcombine was completely ignoring predicates with 
mismatched signedness.

Handling or-of-icmps would be a follow-up step.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:52:39 +00:00
Piotr Padlewski
698667025a Handle invariant.group.barrier in BasicAA
Summary:
llvm.invariant.group.barrier returns pointer that mustalias
pointer it takes. It can't be marked with `returned` attribute,
because it would be remove easily. The other reason is that
only Alias Analysis can know about this, because if any other
pass would know it, then the result would be replaced with it's
argument, which would be invalid.

We can think about returned pointer as something that mustalias, but
it doesn't have to be bitwise the same as the argument.

Reviewers: dberlin, chandlerc, hfinkel, sanjoy

Subscribers: reames, nlewycky, rsmith, anna, amharc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:37:17 +00:00
Sanjay Patel
943323e38a [InstSimplify] move (A & ~B) | (A ^ B) -> (A ^ B) from InstCombine
This is a straight cut and paste, but there's a bigger problem: if this
fold exists for simplifyOr, there should be a DeMorganized version for
simplifyAnd. But more than that, we have a patchwork of ad hoc logic
optimizations in InstCombine. There should be some structure to ensure 
that we're not missing sibling folds across and/or/xor.
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301213 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 18:24:36 +00:00
Davide Italiano
c180879c54 [DomPrinter] Add a way to programmatically dump a dot representation.
Differential Revision:  https://reviews.llvm.org/D32145

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301205 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 17:48:44 +00:00
Sanjoy Das
86b13b4b4f Revert "[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds"
This reverts commit r301150.  It breaks CodeGen/Hexagon/hwloop-wrap2.ll, reverting
while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 02:35:19 +00:00
Sanjoy Das
0e8cd85fc0 Fix unused variables / fields warnings in release builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301151 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:46:40 +00:00
Sanjoy Das
57106e7963 [SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:41:58 +00:00
Sanjoy Das
de62d73fb7 [SCEV] Fix exponential time complexity by caching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:09:46 +00:00
Sanjoy Das
0f49a66c42 [SCEV] Move towards a verifier without false positives
This change reboots SCEV's current (off by default) verification logic
to avoid false failures.  Instead of stringifying trip counts, it maps
old and new trip counts to the same ScalarEvolution "universe" and
asks ScalarEvolution to compute the difference between them.  If the
difference comes out to be a non-zero constant, then (barring some
corner cases) we *know* we messed up.

I've not yet enabled this by default since it hits an exponential time
issue in SCEV, but once I fix that, I'll flip it on by default in
EXPENSIVE_CHECKS builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 23:04:45 +00:00
Easwaran Raman
4b8e4224d5 Remove a repeated comment line. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:12:16 +00:00