| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
rdar://problem/9267970
Patch by Julien Lerouge!
llvm-svn: 131339
|
| |
|
|
|
|
| |
side of the icmp is an exact shift.
llvm-svn: 130954
|
| |
|
|
|
|
|
|
|
|
| |
when X has multiple uses. This is useful for exposing secondary optimizations,
but the X86 backend isn't ready for this when X has a single use. For example,
this can disable load folding.
This is inching towards resolving PR6627.
llvm-svn: 130238
|
| |
|
|
| |
llvm-svn: 130237
|
| |
|
|
|
|
| |
Luis Felipe Strano Moraes!
llvm-svn: 129558
|
| |
|
|
|
|
|
|
| |
even try.
Thanks Eli!
llvm-svn: 128676
|
| |
|
|
|
|
| |
Thanks Frits!
llvm-svn: 128628
|
| |
|
|
| |
llvm-svn: 128627
|
| |
|
|
| |
llvm-svn: 128626
|
| |
|
|
|
|
|
|
| |
losslessly converted to the type of x.
Fixes PR9592.
llvm-svn: 128625
|
| |
|
|
| |
llvm-svn: 128624
|
| |
|
|
| |
llvm-svn: 127220
|
| |
|
|
|
|
|
|
| |
the value splatted into every element. Extend this to getTrue and getFalse which
by providing new overloads that take Types that are either i1 or <N x i1>. Use
it in InstCombine to add vector support to some code, fixing PR8469!
llvm-svn: 127116
|
| |
|
|
|
|
|
|
|
| |
possible. This goes into instcombine and instsimplify because instsimplify
doesn't need to check hasOneUse since it returns (almost exclusively) constants.
This fixes PR9343 #4 #5 and #8!
llvm-svn: 127064
|
| |
|
|
|
|
| |
true/false or "icmp slt/sge Y, 0".
llvm-svn: 127063
|
| |
|
|
|
|
|
| |
also have a zero when numerator = denominator. Reverts parts of r126635 and
r126637.
llvm-svn: 126644
|
| |
|
|
|
|
| |
PR9343.
llvm-svn: 126643
|
| |
|
|
|
|
|
| |
argument), regardless of the divisor. Teach instcombine about this and fix
test7 in PR9343!
llvm-svn: 126635
|
| |
|
|
|
|
| |
overflow. These subsume some existing equality transforms, so zap those.
llvm-svn: 125843
|
| |
|
|
|
|
|
|
|
| |
for some
variations (some of these were already present so I unified the code). Spotted by my
auto-simplifier as occurring a lot.
llvm-svn: 125734
|
| |
|
|
| |
llvm-svn: 125464
|
| |
|
|
|
|
| |
We were previously simplifying divisions, but not right shifts!
llvm-svn: 125454
|
| |
|
|
| |
llvm-svn: 125451
|
| |
|
|
| |
llvm-svn: 125411
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
optimizations to be much more aggressive in the face of
exact/nsw/nuw div and shifts. For example, these (which
are the same except the first is 'exact' sdiv:
define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
%A = sdiv exact i64 %X, -5 ; X/-5 == 0 --> x == 0
%B = icmp eq i64 %A, 0
ret i1 %B
}
define i1 @sdiv_icmp4(i64 %X) nounwind {
%A = sdiv i64 %X, -5 ; X/-5 == 0 --> x == 0
%B = icmp eq i64 %A, 0
ret i1 %B
}
compile down to:
define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
%1 = icmp eq i64 %X, 0
ret i1 %1
}
define i1 @sdiv_icmp4(i64 %X) nounwind {
%X.off = add i64 %X, 4
%1 = icmp ult i64 %X.off, 9
ret i1 %1
}
This happens when you do something like:
(ptr1-ptr2) == 42
where the pointers are pointers to non-unit types.
llvm-svn: 125266
|
| |
|
|
|
|
|
| |
(A+B) == A -> B == 0
A == (A+B) -> B == 0
llvm-svn: 124567
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
auto-simplier the transform most missed by early-cse is (zext X) != 0 -> X != 0.
This patch adds this transform and some related logic to InstructionSimplify
and removes some of the logic from instcombine (unfortunately not all because
there are several situations in which instcombine can improve things by making
new instructions, whereas instsimplify is not allowed to do this). At -O2 this
often results in more than 15% more simplifications by early-cse, and results in
hundreds of lines of bitcode being eliminated from the testsuite. I did see some
small negative effects in the testsuite, for example a few additional instructions
in three programs. One program, 483.xalancbmk, got an additional 35 instructions,
which seems to be due to a function getting an additional instruction and then
being inlined all over the place.
llvm-svn: 123911
|
| |
|
|
|
|
|
|
| |
in the
first line of the function because it isn't a good idea, even for compares.
llvm-svn: 123566
|
| |
|
|
| |
llvm-svn: 123516
|
| |
|
|
|
|
| |
means that are about to disappear.
llvm-svn: 123515
|
| |
|
|
| |
llvm-svn: 123248
|
| |
|
|
|
|
|
|
| |
determining which bits are demanded by
a comparison against a constant.
llvm-svn: 123203
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This resolves a README entry and technically resolves PR4916,
but we still get poor code for the testcase in that PR because
GVN isn't CSE'ing uadd with add, filed as PR8817.
Previously we got:
_test7: ## @test7
addq %rsi, %rdi
cmpq %rdi, %rsi
movl $42, %eax
cmovaq %rsi, %rax
ret
Now we get:
_test7: ## @test7
addq %rsi, %rdi
movl $42, %eax
cmovbq %rsi, %rax
ret
llvm-svn: 122182
|
| |
|
|
|
|
|
|
| |
the old thing end up on the instcombine worklist. Not doing this
can cause an extra top-level iteration of instcombine, burning
compile time.
llvm-svn: 122179
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
sadd formed is half the size of the original type. We can
now compile this into a sadd.i8:
unsigned char X(char a, char b) {
int res = a+b;
if ((unsigned )(res+128) > 255U)
abort();
return res;
}
llvm-svn: 122178
|
| |
|
|
|
|
|
|
|
| |
checking to see if the high bits of the original add result were dead.
Inserting a smaller add and zexting back to that size is not good enough.
This is likely to be the fix for 8816.
llvm-svn: 122177
|
| |
|
|
|
|
|
| |
profitable (or safe) to promote code when the add-with-constant
has other uses.
llvm-svn: 122175
|
| |
|
|
|
|
|
| |
helper function, clean up comments, and reduce indentation.
No functionality change.
llvm-svn: 122174
|
| |
|
|
|
|
|
|
|
| |
for a bug that manifested itself
on the DragonEgg self-host bot. Unfortunately, the testcase is pretty messy and doesn't reduce well due to
interactions with other parts of InstCombine.
llvm-svn: 122072
|
| |
|
|
|
|
|
|
|
|
|
| |
dragonegg self-host buildbot. Original commit message:
Add an InstCombine transform to recognize instances of manual overflow-safe addition
(performing the addition in a wider type and explicitly checking for overflow), and
fold them down to intrinsics. This currently only supports signed-addition, but could
be generalized if someone works out the magic constant formulas for other operations.
llvm-svn: 121965
|
| |
|
|
|
|
|
|
|
|
|
|
| |
addition
(performing the addition in a wider type and explicitly checking for overflow), and
fold them down to intrinsics. This currently only supports signed-addition, but could
be generalized if someone works out the magic constant formulas for other operations.
Fixes <rdar://problem/8558713>.
llvm-svn: 121905
|
| |
|
|
|
|
|
|
| |
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
llvm-svn: 121120
|
| |
|
|
|
|
| |
setAllBits(), setBit(unsigned), etc.
llvm-svn: 120564
|
| |
|
|
|
|
| |
on this instcombine xform. This fixes a miscompilation of 403.gcc.
llvm-svn: 119988
|
| |
|
|
|
|
|
|
|
| |
void a(int x) { if (((1<<x)&8)==0) b(); }
into "x != 3", which occurs over 100 times in 403.gcc but in no
other program in llvm-test.
llvm-svn: 119922
|
| |
|
|
|
|
| |
if CExpr is a ConstantInt.
llvm-svn: 109773
|
| |
|
|
| |
llvm-svn: 108130
|
| |
|
|
| |
llvm-svn: 106752
|
| |
|
|
|
|
| |
to null. Patch by Matti Niemenmaa.
llvm-svn: 104871
|
| |
|
|
|
|
|
| |
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.
llvm-svn: 101579
|