587 Commits

Author SHA1 Message Date
Sanjay Patel
2a44ab0eda [InstSimplify] fix folds for (0.0 - X) + X --> 0 (PR27151)
As shown in:
https://bugs.llvm.org/show_bug.cgi?id=27151
...the existing fold could miscompile when X is NaN.

The fold was also dependent on 'ninf' but that's not necessary.

From IEEE-754 (with default rounding which we can assume for these opcodes):
"When the sum of two operands with opposite signs (or the difference of two 
operands with like signs) is exactly zero, the sign of that sum (or difference) 
shall be +0...However, x + x = x − (−x) retains the same sign as x even when 
x is zero."



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327575 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 21:23:27 +00:00
Sanjay Patel
253ee8cecf [InstSimplify] fp_binop X, undef --> NaN
The variable operand could be NaN, so it's always safe to propagate NaN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327212 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-10 16:51:28 +00:00
Sanjay Patel
6ee3582153 [InstSimplify] remove redundant folds
The 'hasOneUse' check is a giveaway that something's not right.
We never need to check that in InstSimplify because we don't
create new instructions here.

These are all handled as icmp simplifies which then trigger
existing select simplifies, so there's no need to duplicate 
a composite fold of the two.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326750 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-05 22:46:48 +00:00
Sanjay Patel
1629c23be7 [PatternMatch, InstSimplify] fix m_NaN to work with vector constants and use it
This is NFC for the moment (and independent of any potential NaN semantic
controversy). Besides making the code in InstSimplify easier to read, the
motivation is to eventually allow undef elements in vector constants to
match too. A proposal to add the base logic for that is in D43792.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326600 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-02 18:36:08 +00:00
Sanjay Patel
4b957aaea8 [InstSimplify] sqrt(X) * sqrt(X) --> X
This was misplaced in InstCombine. We can loosen the FMF as a follow-up step.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325965 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 22:20:13 +00:00
Sanjay Patel
5563781f3f [PatternMatch, InstSimplify] enhance m_AllOnes() to ignore undef elements in vectors
Loosening the matcher definition reveals a subtle bug in InstSimplify (we should not
assume that because an operand constant matches that it's safe to return it as a result).

So I'm making that change here too (that diff could be independent, but I'm not sure how 
to reveal it before the matcher change).

This also seems like a good reason to *not* include matchers that capture the value.
We don't want to encourage the potential misstep of propagating undef values when it's
not allowed/intended.

I didn't include the capture variant option here or in the related rL325437 (m_One), 
but it already exists for other constant matchers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325466 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-18 18:05:08 +00:00
Sanjay Patel
29a500dd45 [InstSimplify] move select undef cond fold with other constant cond folds; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325434 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-17 14:50:13 +00:00
Elena Demikhovsky
8e229ec0e5 Adding a width of the GEP index to the Data Layout.
Making a width of GEP Index, which is used for address calculation, to be one of the pointer properties in the Data Layout.
p[address space]:size:memory_size:alignment:pref_alignment:index_size_in_bits.
The index size parameter is optional, if not specified, it is equal to the pointer size.

Till now, the InstCombiner normalized GEPs and extended the Index operand to the pointer width.
It works fine if you can convert pointer to integer for address calculation and all registered targets do this.
But some ISAs have very restricted instruction set for the pointer calculation. During discussions were desided to retrieve information for GEP index from the Data Layout.
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120416.html

I added an interface to the Data Layout and I changed the InstCombiner and some other passes to take the Index width into account.
This change does not affect any in-tree target. I added tests to cover data layouts with explicitly specified index size.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325102 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 06:58:08 +00:00
Sanjay Patel
860eb48e1f [InstSimplify] allow exp/log simplifications with only 'reassoc' FMF
These intrinsic folds were added with D41381, but only allowed with isFast().
That's more than necessary because FMF has 'reassoc' to apply to these
kinds of folds after D39304, and that's all we need in these cases.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324967 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 23:51:23 +00:00
Sanjay Patel
6d276fdd07 [InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops
This is the FP counterpart that was mentioned in PR35709:
https://bugs.llvm.org/show_bug.cgi?id=35709

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323716 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 00:18:37 +00:00
Zvi Rackover
f2b2f1fda3 InstSimplify: If divisor element is undef simplify to undef
Summary:
If any vector divisor element is undef, we can arbitrarily choose it be
zero which would make the div/rem an undef value by definition.

Reviewers: spatel, reames

Reviewed By: spatel

Subscribers: magabari, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323343 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 17:22:00 +00:00
Anton Bikineev
a375f9297d [InstSimplify] (X << Y) % X -> 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323182 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 09:27:47 +00:00
Sanjay Patel
b1b5a889fa [InstSimplify] use m_Specific and commutative matcher to reduce code; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322955 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-19 16:12:55 +00:00
Sanjay Patel
17f2d728b2 [InstSimplify] fix code comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322456 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-14 15:58:18 +00:00
Sanjay Patel
72f9c7b293 [InstSimplify] fold implied null ptr check (PR35790)
This extends rL322327 to handle the pointer cast and should solve:
https://bugs.llvm.org/show_bug.cgi?id=35790

Name: or_eq_zero
  %isnull = icmp eq i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_zero = icmp eq i64 %somebits, 0
  %or = or i1 %somebits_are_zero, %isnull
  =>
  %or = %somebits_are_zero

Name: and_ne_zero
  %isnotnull = icmp ne i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_not_zero = icmp ne i64 %somebits, 0
  %and = and i1 %somebits_are_not_zero, %isnotnull
  =>
  %and = %somebits_are_not_zero

https://rise4fun.com/Alive/CQ3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322439 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-13 15:44:44 +00:00
Sanjay Patel
efa3fe9ab2 [InstSimplify] fold implied cmp with zero (PR35790)
This doesn't handle the more complicated case in the bug report yet:
https://bugs.llvm.org/show_bug.cgi?id=35790

For that, we have to match / look through a cast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322327 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11 23:27:37 +00:00
Dmitry Venikov
0bb74a59ff [InstSimplify] Missed optimization in math expression: squashing exp(log), log(exp)
Summary: This patch enables folding following expressions under -ffast-math flag: exp(log(x)) -> x, exp2(log2(x)) -> x, log(exp(x)) -> x, log2(exp2(x)) -> x

Reviewers: spatel, hfinkel, davide

Reviewed By: spatel, hfinkel, davide

Subscribers: scanon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321710 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 14:37:42 +00:00
Dmitry Venikov
9579686b84 Test commit
Reviewers: Quolyk

Reviewed By: Quolyk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321636 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 05:47:42 +00:00
Philip Reames
186bdd656a [instsimplify] consistently handle undef and out of bound indices for insertelement and extractelement
In one case, we were handling out of bounds, but not undef indices.  In the other, we were handling undef (with the comment making the analogy to out of bounds), but not out of bounds.  Be consistent and treat both undef and constant out of bounds indices as producing undefined results.

As a side effect, this also protects instcombine from having to handle large constant indices as we always simplify first.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-30 05:54:22 +00:00
Philip Reames
89623b4cd2 Sink a couple of transforms from instcombine into instsimplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321467 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-27 01:14:30 +00:00
Philip Reames
028022a9f2 [NFC] Extract out a helper function for SimplifyCall(CS, Q)
This simplifies code, but the real motivation is that it lets me clean up some downstream code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-27 00:16:12 +00:00
Simon Pilgrim
d94c9356e7 [InstSimplify] Check for in range extraction index before calling APInt::getZExtValue()
Reduced from oss-fuzz #4768 test case

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321454 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-26 11:42:39 +00:00
Zachary Turner
ece9b23b54 Fix many -Wsign-compare and -Wtautological-constant-compare warnings.
Most of the -Wsign-compare warnings are due to the fact that
enums are signed by default in the MS ABI, while the
tautological comparison warnings trigger on x86 builds where
sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
is always false.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320750 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:07:03 +00:00
Michael Zolotukhin
0e973bcce6 Remove redundant includes from lib/Analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 21:30:41 +00:00
Igor Laevsky
fcf12e077b Reintroduce r320049, r320014 and r319894.
OpenGL issues should be fixed by now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320568 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 11:21:18 +00:00
Igor Laevsky
535b72d219 Revert r320049, r320014 and r319894
They were causing failures of the piglit OpenGL tests with AMD GPUs using the
Mesa radeonsi driver.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-12 10:03:39 +00:00
Zvi Rackover
138b4f2021 InstructionSimplify: 'extractelement' with an undef index is undef
Summary:
An undef extract index can be arbitrarily chosen to be an
out-of-range index value, which would result in the instruction being undef.

This change closes a gap identified while working on lowering vector permute intrinsics
with variable index vectors to pure LLVM IR.

Reviewers: arsenm, spatel, majnemer

Reviewed By: arsenm, spatel

Subscribers: fhahn, nhaehnle, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319910 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06 17:51:46 +00:00
Igor Laevsky
3b06fccc77 [InstSimplify] Fold insertelement into undef if index is out of bounds
Differential Revision: https://reviews.llvm.org/D40650



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06 14:04:45 +00:00
Florian Hahn
03c5509e66 [InstSimplify] More fcmp cases when comparing against negative constants.
Summary:
For known positive non-zero value X:
    fcmp uge X, -C => true
    fcmp ugt X, -C => true
    fcmp une X, -C => true
    fcmp oeq X, -C => false
    fcmp ole X, -C => false
    fcmp olt X, -C => false


Patch by Paul Walker.

Reviewers: majnemer, t.p.northover, spatel, RKSimon

Reviewed By: spatel

Subscribers: fhahn, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01 12:34:16 +00:00
Sanjay Patel
52a381f749 [InstSimplify] use m_APFloat to simplify fcmp folds; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319043 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27 16:37:09 +00:00
Sanjay Patel
557e920ce8 [InstSimplify] fold and/or of fcmp ord/uno when operand is known nnan
The 'ord' and 'uno' predicates have a logic operation for NAN built into their definitions:

FCMP_ORD   =  7,  ///< 0 1 1 1    True if ordered (no nans)
FCMP_UNO   =  8,  ///< 1 0 0 0    True if unordered: isnan(X) | isnan(Y)

So we can simplify patterns like this:

(fcmp ord (known NNAN), X) && (fcmp ord X, Y) --> fcmp ord X, Y
(fcmp uno (known NNAN), X) || (fcmp uno X, Y) --> fcmp uno X, Y

It might be better to split this into (X uno 0) | (Y uno 0) as a canonicalization, but that
would be another patch.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318627 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-19 15:34:27 +00:00
Adam Nemet
3b8950a6d6 Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.*
Sync it up with the name of the class actually defined here.  This has been
bothering me for a while...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315249 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09 23:19:02 +00:00
Haicheng Wu
f7bb6862c7 [InstSimplify] teach SimplifySelectInst() to fold more vector selects
Call ConstantFoldSelectInstruction() to fold cases like below

select <2 x i1><i1 true, i1 false>, <2 x i8> <i8 0, i8 1>, <2 x i8> <i8 2, i8 3>

All operands are constants and the condition has mixed true and false conditions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314741 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02 23:43:52 +00:00
Sanjay Patel
bc0f9d9517 [InstSimplify] fold sdiv/srem based on compare of dividend and divisor
This should bring signed div/rem analysis up to the same level as unsigned. 
We use icmp simplification to determine when the divisor is known greater than the dividend.

Each positive test is followed by a negative test to show that we're not overstepping the boundaries of the known bits.
There are extra tests for the signed-min-value special cases.

Alive proofs:
http://rise4fun.com/Alive/WI5

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313264 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14 14:59:07 +00:00
Sanjay Patel
32b8a7a919 [InstSimplify] clean up div/rem handling; NFCI
The idea to make an 'isDivZero' helper was suggested for the signed case in D37713:
https://reviews.llvm.org/D37713

This clean-up makes it clear that D37713 is just filling the gap for signed div/rem,
removes unnecessary code, and allows us to remove a bit of duplicated code from the
planned improvement in D37713.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313261 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14 14:09:11 +00:00
Sanjay Patel
92ba92dfe4 [InstSimplify] reorder methods; NFC
I'm trying to refactor some shared code for integer div/rem,
but I keep having to scroll through fdiv. The FP ops have
nothing in common with the integer ops, so I'm moving FP
below everything else. 

While here, improve a couple of comments and fix some formatting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11 13:34:27 +00:00
Sanjay Patel
44e68c6bb8 [InstSimplify] refactor udiv/urem code and add tests; NFCI
This removes some duplicated code and makes it easier to support signed div/rem
in a similar way if we want to do that. Note that the existing comments were not
accurate - we don't need a constant divisor to simplify; icmp simplification does
more than that. But as the added tests show, it could go even further.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-10 17:55:08 +00:00
Nuno Lopes
fe353a0cbf Merge isKnownNonNull into isKnownNonZero
It now knows the tricks of both functions.
Also, fix a bug that considered allocas of non-zero address space to be always non null

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-09 18:23:11 +00:00
Matt Arsenault
e0de89287c InstSimplify: canonicalize is idempotent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 01:21:43 +00:00
Craig Topper
85fcd3487c [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions
This patch teaches decomposeBitTestICmp to look through truncate instructions on the input to the compare. If a truncate is found it will now return the pre-truncated Value and appropriately extend the APInt mask.

This allows some code to be removed from InstSimplify that was doing this functionality.

This allows InstCombine's bit test combining code to match a pre-truncate Value with the same Value appear with an 'and' on another icmp. Or it allows us to combine a truncate to i16 and a truncate to i8. This also required removing the type check from the beginning of getMaskedTypeForICmpPair, but I believe that's ok because we still have to find two values from the input to each icmp that are equal before we'll do any transformation. So the type check was really just serving as an early out.

There was one user of decomposeBitTestICmp that didn't want to look through truncates, so I've added a flag to prevent that behavior when necessary.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312382 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01 21:27:34 +00:00
Craig Topper
fc52a9c1a3 Recommit r310869, "[InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify"
This recommits r310869, with the moved files and no extra changes.

Original commit message:

This addresses a fixme in InstSimplify about using decomposeBitTest. This also fixes InstSimplify to handle ugt and ult compares too.

I've modified the interface a little to return only the APInt version of the mask that InstSimplify needs. InstCombine now has a small wrapper routine to create a Constant out of it. I've also dropped the returning of 0 since InstSimplify doesn't need that. So InstCombine creates a zero constant itself.

I also had to make decomposeBitTest support vectors since InstSimplify needs that.

As InstSimplify can't use something from the Transforms library, I've moved the CmpInstAnalysis code to the Analysis library.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310889 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 21:39:51 +00:00
Craig Topper
74b28d63c3 Revert r310869 "[InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify"
Failed to add the two files that moved. And then added an extra change I didn't mean to while trying to fix that. Reverting everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 19:09:32 +00:00
Craig Topper
29130c26f7 [InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify
This addresses a fixme in InstSimplify about using decomposeBitTest. This also fixes InstSimplify to handle ugt and ult compares too.

I've modified the interface a little to return only the APInt version of the mask that InstSimplify needs. InstCombine now has a small wrapper routine to create a Constant out of it. I've also dropped the returning of 0 since InstSimplify doesn't need that. So InstCombine creates a zero constant itself.

I also had to make decomposeBitTest support vectors since InstSimplify needs that.

As InstSimplify can't use something from the Transforms library, I've moved the CmpInstAnalysis code to the Analysis library.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 18:49:42 +00:00
Craig Topper
3c1a9a0485 [InstSimplify] Add test cases that show that simplifySelectWithICmpCond doesn't work with non-canonical comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310542 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10 01:02:02 +00:00
Craig Topper
a72a0bef4d [InstSimplify] Use commutable matchers to simplify some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308125 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-16 06:57:41 +00:00
Craig Topper
eb41f6a345 [IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing isIntegerTy(unsigned), but also works for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307492 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 07:04:03 +00:00
Craig Topper
1060082924 [IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307491 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 07:04:00 +00:00
Craig Topper
bd1a80dfb0 [Analysis][Transforms] Use commutable matchers instead of m_CombineOr in a few places. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306204 cdac9f57-aa62-4fd3-8940-286f4534e8a0
2017-06-24 06:24:01 +00:00
Andrew Kaylor
b8e9164d09 [InstSimplify] Don't constant fold or DCE calls that are marked nobuiltin
Differential Revision: https://reviews.llvm.org/D33737

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305132 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-09 23:18:11 +00:00
Craig Topper
eb370b4757 [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC
These methods are specifically optimized to only counting leading zeros without an additional uint64_t compare.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 07:40:37 +00:00