|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | which doesn't affect the memory address being promoted.
llvm-svn: 122172 | 
| | 
| 
| 
| 
| 
| 
| | does not make the alias set for that pointer volatile, just stores
*to* the pointer.
llvm-svn: 122171 | 
| | 
| 
| 
| | llvm-svn: 122168 | 
| | 
| 
| 
| 
| 
| 
| 
| | which have trapping constant exprs in them due to PHI nodes.
Eliminating them can cause the constant expr to be evalutated
on new paths if the input edges are critical.
llvm-svn: 122164 | 
| | 
| 
| 
| | llvm-svn: 122156 | 
| | 
| 
| 
| | llvm-svn: 122110 | 
| | 
| 
| 
| 
| 
| | matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
llvm-svn: 122105 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 122054 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | comparisons formed by comparisons.  For example,
this:
void foo(unsigned x) {
  if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) 
    bar();
}
compiles into:
_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$6, %edi
	ja	LBB0_2
## BB#1:                                ## %entry
	movl	%edi, %eax
	movl	$91, %ecx
	btq	%rax, %rcx
	jb	LBB0_3
instead of:
_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$2, %edi
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	cmpl	$6, %edi
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movl	%edi, %eax
	movl	$88, %ecx
	btq	%rax, %rcx
	jb	LBB0_4
This catches a bunch of cases in GCC, which look like this:
 %804 = load i32* @which_alternative, align 4, !tbaa !0
 %805 = icmp ult i32 %804, 2
 %806 = icmp eq i32 %804, 3
 %or.cond121 = or i1 %805, %806
 %807 = icmp eq i32 %804, 4
 %or.cond124 = or i1 %or.cond121, %807
 br i1 %or.cond124, label %.thread, label %808
turning this into a range comparison.
llvm-svn: 122045 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | a null endptr argument, because they may write to errno.
This fixes a seflhost miscompile observed on Linux targets when TBAA
was enabled.
llvm-svn: 122014 | 
| | 
| 
| 
| 
| 
| 
| 
| | could falsely produce a MultipleDestSentinel value if the first predecessor ended with an 'indirectbr'. If that happened, it caused an unnecessary FindMostPopularDest() call.
This wasn't a correctness problem, but it broke the fast path for single-predecessor blocks.
llvm-svn: 121966 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 121944 | 
| | 
| 
| 
| | llvm-svn: 121921 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| | function so that it can live in Analysis instead of
VMCore.
llvm-svn: 121885 | 
| | 
| 
| 
| 
| 
| | instcombine and into InstructionSimplify.
llvm-svn: 121861 | 
| | 
| 
| 
| 
| 
| 
| 
| | a terminator depends on it.
When it sees a promising select it now tries to figure out whether the condition of the select is known in any of the predecessors and if so it maps the operands appropriately.
llvm-svn: 121859 | 
| | 
| 
| 
| | llvm-svn: 121838 | 
| | 
| 
| 
| 
| 
| 
| 
| | simplification to fail,
this case involve a select that simplifies to itself.
llvm-svn: 121817 | 
| | 
| 
| 
| | llvm-svn: 121816 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | which is simpler than finding a place to insert in BB.
 - Don't perform the 'if condition hoisting' xform on certain
   i1 PHIs, as it interferes with switch formation.
This re-fixes "example 7", without breaking the world hopefully.
llvm-svn: 121764 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | first, it can kick in on blocks whose conditions have been
folded to a constant, even though one of the edges will be
trivially folded.
second, it doesn't clean up the "if diamond" that it just 
eliminated away.  This is a problem because other simplifycfg
xforms kick in depending on the order of block visitation,
causing pointless work.
llvm-svn: 121762 | 
| | 
| 
| 
| 
| 
| | breaking the selfhost builds, though I can't fathom how.
llvm-svn: 121761 | 
| | 
| 
| 
| 
| 
| | when all 2-entry phis are simplified away.
llvm-svn: 121760 | 
| | 
| 
| 
| 
| 
| | don't print it unless the xform happens.
llvm-svn: 121758 | 
| | 
| 
| 
| | llvm-svn: 121757 | 
| | 
| 
| 
| | llvm-svn: 121756 | 
| | 
| 
| 
| | llvm-svn: 121755 | 
| | 
| 
| 
| 
| 
| 
| | GetIfCondition faster by avoiding pred_iterator.  No
really interesting change.
llvm-svn: 121754 | 
| | 
| 
| 
| | llvm-svn: 121753 | 
| | 
| 
| 
| 
| 
| | code a bit, switch from constant folding to instsimplify.
llvm-svn: 121751 | 
| | 
| 
| 
| 
| 
| | work, but fixes 400.perlbmk.
llvm-svn: 121749 | 
| | 
| 
| 
| 
| 
| 
| 
| | r121694, the most recent state
where I'm confident there were no crashes or miscompilations.  XFAIL the test added since then for now.
llvm-svn: 121733 | 
| | 
| 
| 
| 
| 
| | invalidation issue, causing a crash on some versions of perlbmk.
llvm-svn: 121728 | 
| | 
| 
| 
| | llvm-svn: 121711 | 
| | 
| 
| 
| 
| 
| | Fixes PR 8780.
llvm-svn: 121705 | 
| | 
| 
| 
| 
| 
| | 'and' case.
llvm-svn: 121695 | 
| | 
| 
| 
| 
| 
| 
| | I can track down a miscompile.  This should bring the buildbots
back to life
llvm-svn: 121693 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | when simplifying, allowing them to be eagerly turned into switches.  This
is the last step required to get "Example 7" from this blog post:
http://blog.regehr.org/archives/320
On X86, we now generate this machine code, which (to my eye) seems better
than the ICC generated code:
_crud:                                  ## @crud
## BB#0:                                ## %entry
	cmpb	$33, %dil
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	addb	$-34, %dil
	cmpb	$58, %dil
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movzbl	%dil, %eax
	movabsq	$288230376537592865, %rcx ## imm = 0x400000017001421
	btq	%rax, %rcx
	jb	LBB0_4
LBB0_3:                                 ## %lor.rhs
	xorl	%eax, %eax
	ret
LBB0_4:                                 ## %lor.end
	movl	$1, %eax
	ret
llvm-svn: 121690 | 
| | 
| 
| 
| | llvm-svn: 121689 | 
| | 
| 
| 
| 
| 
| | per terminator kind.
llvm-svn: 121688 | 
| | 
| 
| 
| | llvm-svn: 121687 | 
| | 
| 
| 
| 
| 
| 
| 
| | code instead of
doing a cfg search for every block simplified.
llvm-svn: 121686 | 
| | 
| 
| 
| | llvm-svn: 121685 | 
| | 
| 
| 
| | llvm-svn: 121684 |