| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 291624
|
|
|
|
|
|
| |
We know that udiv %V, C can be optimized away to 0 if %V is ult C.
llvm-svn: 291296
|
|
|
|
|
|
| |
We know that urem %V, C can be optimized away to %V if %V is ult C.
llvm-svn: 291282
|
|
|
|
| |
llvm-svn: 291043
|
|
|
|
|
|
|
| |
This creates non-linear behavior in the inliner (see more details in
r289755's commit thread).
llvm-svn: 290086
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was an efficiency problem with how we processed @llvm.assume in
ValueTracking (and other places). The AssumptionCache tracked all of the
assumptions in a given function. In order to find assumptions relevant to
computing known bits, etc. we searched every assumption in the function. For
ValueTracking, that means that we did O(#assumes * #values) work in InstCombine
and other passes (with a constant factor that can be quite large because we'd
repeat this search at every level of recursion of the analysis).
Several of us discussed this situation at the last developers' meeting, and
this implements the discussed solution: Make the values that an assume might
affect operands of the assume itself. To avoid exposing this detail to
frontends and passes that need not worry about it, I've used the new
operand-bundle feature to add these extra call "operands" in a way that does
not affect the intrinsic's signature. I think this solution is relatively
clean. InstCombine adds these extra operands based on what ValueTracking, LVI,
etc. will need and then those passes need only search the users of the values
under consideration. This should fix the computational-complexity problem.
At this point, no passes depend on the AssumptionCache, and so I'll remove
that as a follow-up change.
Differential Revision: https://reviews.llvm.org/D27259
llvm-svn: 289755
|
|
|
|
|
|
|
|
|
| |
isGEPWithNoNotionalOverIndexing() (PR31262)
This should fix:
https://llvm.org/bugs/show_bug.cgi?id=31262
llvm-svn: 289401
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D27587
llvm-svn: 289153
|
|
|
|
| |
llvm-svn: 289098
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As Eli noted in the post-commit thread for r288833, the use of
swapOperands() may not be allowed in InstSimplify, so I'm
removing those calls here pending further review.
The swap mutates the icmp, and there doesn't appear to be precedent
for instruction mutation in InstSimplify.
I didn't actually have any tests for those cases, so I'm adding
a few here.
llvm-svn: 288855
|
|
|
|
|
|
|
|
|
|
|
| |
All of these (and a few more) are already handled by InstCombine,
but we shouldn't have to wait until then to simplify these because
they're cheap to deal with here in InstSimplify.
This is the 'and' sibling of the earlier 'or' patch:
https://reviews.llvm.org/rL288833
llvm-svn: 288841
|
|
|
|
| |
llvm-svn: 288837
|
|
|
|
|
|
|
|
| |
All of these (and a few more) are already handled by InstCombine,
but we shouldn't have to wait until then to simplify these because
they're cheap to deal with here in InstSimplify.
llvm-svn: 288833
|
|
|
|
| |
llvm-svn: 288830
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Extends InstSimplify to handle both `x >=u x >> y` and `x >=u x udiv y`.
This is a folloup of rL258422 and
https://github.com/rust-lang/rust/pull/30917 where llvm failed to
optimize away the bounds checking in a binary search.
Patch by Arthur Silva!
Reviewers: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D25941
llvm-svn: 285228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
0 - X --> X, if X is 0 or the minimum signed value
0 - X --> 0, if X is 0 or the minimum signed value and the sub is NSW
I noticed this pattern might be created in the backend after the change from D25485,
so we'll want to add a similar fold for the DAG.
The use of computeKnownBits in InstSimplify may be something to investigate if the
compile time of InstSimplify is noticeable. We could replace computeKnownBits with
specific pattern matchers or limit the recursion.
Differential Revision: https://reviews.llvm.org/D25785
llvm-svn: 284649
|
|
|
|
| |
llvm-svn: 284627
|
|
|
|
| |
llvm-svn: 282592
|
|
|
|
| |
llvm-svn: 282591
|
|
|
|
| |
llvm-svn: 282590
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The constant folder didn't know how to always fold bitcasts of constant integer
vectors. In particular, it was unable to handle the case where a constant vector
had some undef elements, and the resulting (i.e. bitcasted) vector type had more
elements than the original vector type.
Example:
%cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>
On a little endian target, %cast could have been folded to:
<4 x i32><i32 undef, i32 undef, i32 2, i32 0>
This patch improves the folding logic by teaching how to correctly propagate
undef elements in the folded vector.
Differential Revision: https://reviews.llvm.org/D24301
llvm-svn: 281343
|
|
|
|
|
|
|
|
|
|
| |
InstSimplify doesn't always know how to fold a bitcast of a constant vector.
In particular, the logic in InstSimplify doesn't know how to handle the case
where the constant vector in input contains some undef elements, and the
number of elements is smaller than the number of elements of the bitcast
vector type.
llvm-svn: 281332
|
|
|
|
| |
llvm-svn: 280963
|
|
|
|
|
|
|
| |
Two tests have been merged together, regenerated and then moved to
a more appropriate directory. No functional change.
llvm-svn: 280814
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
NaN.
This patch fixes a crash caused by an incorrect folding of an ordered comparison
between a packed floating point vector and a splat vector of NaN.
An ordered comparison between a vector and a constant vector of NaN, should
always be folded into a constant vector where each element is i1 false.
Since revision 266175, SimplifyFCmpInst folds the ordered fcmp into a scalar
'false'. Later on, this would cause an assertion failure, since the value type
of the folded value doesn't match the expected value type of the uses of the
original instruction: "Assertion failed: New->getType() == getType() &&
"replaceAllUses of value with new value of different type!".
This patch fixes the issue and adds a test case to the already existing test
InstSimplify/floating-point-compares.ll.
Differential Revision: https://reviews.llvm.org/D24143
llvm-svn: 280488
|
|
|
|
|
|
|
| |
These folds already have tests for scalar and vector types, except
for the vector div-by-0 case, so I'm adding tests for that.
llvm-svn: 280115
|
|
|
|
|
|
|
|
|
|
|
|
| |
Completes the m_APInt changes for simplifyICmpWithConstant().
Other commits in this series:
https://reviews.llvm.org/rL279492
https://reviews.llvm.org/rL279530
https://reviews.llvm.org/rL279534
https://reviews.llvm.org/rL279538
llvm-svn: 279543
|
|
|
|
| |
llvm-svn: 279538
|
|
|
|
| |
llvm-svn: 279534
|
|
|
|
|
|
|
|
|
|
|
| |
...because like the corresponding code, this is just too big to keep adding to.
And the next step is to add a vector version of each of these tests to show
missed folds.
Also, auto-generate CHECK lines and add comments for the tests that correspond to
the source code.
llvm-svn: 279530
|
|
|
|
| |
llvm-svn: 278779
|
|
|
|
| |
llvm-svn: 277952
|
|
|
|
|
|
|
| |
Simplify ptrtoint comparisons involving operands with different source
types.
llvm-svn: 277951
|
|
|
|
| |
llvm-svn: 277744
|
|
|
|
|
|
|
|
|
| |
constant vectors
I'm removing a misplaced pair of more specific folds from InstCombine in this patch as well,
so we know where those folds are happening in InstSimplify.
llvm-svn: 277738
|
|
|
|
| |
llvm-svn: 277736
|
|
|
|
|
|
|
|
|
| |
ConstantExpr::getWithOperands does much of the hard work that
ConstantFoldInstOperandsImpl tries to do but more completely.
This lets us fold ExtractValue/InsertValue expressions.
llvm-svn: 277100
|
|
|
|
|
|
|
|
|
|
|
|
| |
When folding an expression, we run ConstantFoldConstantExpression on
each operand of that expression.
However, ConstantFoldConstantExpression can fail and retur nullptr.
Previously, we would bail on further refining the expression.
Instead, use the original operand and see if we can refine a later
operand.
llvm-svn: 276959
|
|
|
|
|
|
|
|
|
|
|
| |
ConstantFoldConstantExpressionImpl
Failures in ConstantFoldConstantExpressionImpl were ignored causing
crashes down the line.
This fixes PR28725.
llvm-svn: 276827
|
|
|
|
|
|
|
| |
This reverts commit r276700 and reapplies r276698.
The relevant clang tests have been updated.
llvm-svn: 276727
|
|
|
|
|
|
|
| |
This reverts commit r276698. Clang has tests which rely on the
optimizer :(
llvm-svn: 276700
|
|
|
|
|
|
|
| |
BitCasts of BitCasts can be folded away as can BitCasts which don't
change the type of the operand.
llvm-svn: 276698
|
|
|
|
| |
llvm-svn: 276345
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
simplifications (PR28466)
rL245171 exposed a hole in InstSimplify that manifested in a strange way in PR28466:
https://llvm.org/bugs/show_bug.cgi?id=28466
It's possible to use trunc + icmp sgt/slt in place of an and + icmp eq/ne, so we need to
recognize that pattern to eliminate selects that are choosing between some value and some
bitmasked version of that value.
Note that there is significant room for improvement (refactoring) and enhancement (more
patterns, possibly in InstCombine rather than here).
Differential Revision: https://reviews.llvm.org/D22537
llvm-svn: 276341
|
|
|
|
| |
llvm-svn: 276328
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D22602
llvm-svn: 276209
|
|
|
|
| |
llvm-svn: 276024
|
|
|
|
| |
llvm-svn: 275995
|
|
|
|
| |
llvm-svn: 275990
|
|
|
|
| |
llvm-svn: 275899
|