Chris Lattner
e6214557e7
Change lower atomic pass to use IntrinsicInst to simplify it a bit.
...
llvm-svn: 113114
2010-09-05 20:10:47 +00:00
Chris Lattner
05ef361b5e
eliminate some non-obvious casts. UndefValue isa Constant.
...
llvm-svn: 113113
2010-09-05 20:03:09 +00:00
Duncan Sands
6778149f7e
Reapply commit 112699, speculatively reverted by echristo, since
...
I'm sure it is harmless. Original commit message:
If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112810
2010-09-02 08:14:03 +00:00
Owen Anderson
73f988cafa
JumpThreading keeps LazyValueInfo up to date, so we don't need to rerun it
...
if we schedule another LVI-using pass afterwards.
llvm-svn: 112722
2010-09-01 18:27:22 +00:00
Eric Christopher
a5d315c665
Speculatively revert 112699 and 112702, they seem to be causing
...
self host errors on clang-x86-64.
llvm-svn: 112719
2010-09-01 17:29:10 +00:00
Duncan Sands
f7b18437b5
If PrototypeValue is erased in the middle of using the SSAUpdator
...
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112699
2010-09-01 10:29:33 +00:00
Owen Anderson
3c84ecb067
More cleanups of my JumpThreading transforms, including extracting some duplicated code into a helper function.
...
llvm-svn: 112634
2010-08-31 20:26:04 +00:00
Owen Anderson
6fdcb172a9
Add an RAII helper to make cleanup of the RecursionSet more fool-proof.
...
llvm-svn: 112628
2010-08-31 19:24:27 +00:00
Owen Anderson
cd4de7f399
Refactor my fix for PR5652 to terminate the predecessor lookups after the first failure.
...
llvm-svn: 112620
2010-08-31 18:48:48 +00:00
Owen Anderson
3997a07fb9
More Chris-inspired JumpThreading fixes: use ConstantExpr to correctly constant-fold undef, and be more careful with its return value.
...
This actually exposed an infinite recursion bug in ComputeValueKnownInPredecessors which theoretically already existed (in JumpThreading's
handling of and/or of i1's), but never manifested before. This patch adds a tracking set to prevent this case.
llvm-svn: 112589
2010-08-31 07:36:34 +00:00
Owen Anderson
c910acb54a
Re-apply r112539, being more careful to respect the return values of the constant folding methods. Additionally,
...
use the ConstantExpr::get*() methods to simplify some constant folding.
llvm-svn: 112550
2010-08-30 23:22:36 +00:00
Owen Anderson
1ddcbbe49c
Revert r112539. It accidentally introduced a miscompilation.
...
llvm-svn: 112543
2010-08-30 22:33:41 +00:00
Owen Anderson
75f6037c7c
Fixes and cleanups pointed out by Chris. In general, be careful to handle 0 results from ComputeValueKnownInPredecessors
...
(indicating undef), and re-use existing constant folding APIs.
llvm-svn: 112539
2010-08-30 22:07:52 +00:00
Owen Anderson
99d4cb861b
Fix typos in comments.
...
llvm-svn: 112286
2010-08-27 20:32:56 +00:00
Owen Anderson
6ebbd92380
Use LVI to eliminate conditional branches where we've tested a related condition previously. Update tests for this change.
...
This fixes PR5652.
llvm-svn: 112270
2010-08-27 17:12:29 +00:00
Owen Anderson
bd2ecc7e68
Make JumpThreading smart enough to properly thread StrSwitch when it's compiled with clang++.
...
llvm-svn: 112198
2010-08-26 17:40:24 +00:00
Owen Anderson
7c853e877e
Turn LVI on, previously detected failures should be fixed now.
...
llvm-svn: 111923
2010-08-24 17:21:18 +00:00
Owen Anderson
6ffa3f2aea
Turn LVI back off, I have a testcase now.
...
llvm-svn: 111834
2010-08-23 19:59:27 +00:00
Owen Anderson
630add39a6
Re-enable LazyValueInfo. Monitoring for failures.
...
llvm-svn: 111816
2010-08-23 18:12:23 +00:00
Owen Anderson
aac8cbb261
Disable LVI while I evaluate a failure.
...
llvm-svn: 111551
2010-08-19 19:47:08 +00:00
Owen Anderson
5c87dd55d3
Tentatively enabled LVI by default. I'll be monitoring for any failures.
...
llvm-svn: 111543
2010-08-19 19:04:40 +00:00
Owen Anderson
208636fa33
Inform LazyValueInfo whenever a block is deleted, to avoid dangling pointer issues.
...
llvm-svn: 111382
2010-08-18 18:39:01 +00:00
Chris Lattner
3c603024bb
Fix PR7755: knowing something about an inval for a pred
...
from the LHS should disable reconsidering that pred on the
RHS. However, knowing something about the pred on the RHS
shouldn't disable subsequent additions on the RHS from
happening.
llvm-svn: 111349
2010-08-18 03:14:36 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
...
ID member as the sole unique type identifier. Clean up APIs related to this change.
llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Owen Anderson
4674dd6cf5
Give JumpThreading+LVI a long-form cl::opt so that it's easier to toggle the default.
...
llvm-svn: 110384
2010-08-05 22:11:31 +00:00
Owen Anderson
aa7f66ba67
Add an initial implementation of LazyValueInfo updating for JumpThreading. Disabled for now.
...
llvm-svn: 109424
2010-07-26 18:48:03 +00:00
Owen Anderson
a57b97e7e7
Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
...
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Gabor Greif
a5fa885d47
cache results of operator*
...
llvm-svn: 108142
2010-07-12 14:10:24 +00:00
Chris Lattner
bbc25ff5cc
if jump threading is able to infer interesting values on both
...
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values. This fixes the crash on testcase
from PR7498
llvm-svn: 108114
2010-07-12 00:47:34 +00:00
Chris Lattner
329ea064ed
jump threading can't split a critical edge from an indirectbr. This
...
fixes PR7356.
llvm-svn: 105950
2010-06-14 19:45:43 +00:00
Dan Gohman
826bdf8c10
Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
...
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.
llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Chris Lattner
9ae28b141f
fix PR6743, a case where we'd delete an instruction before using it
...
in some cases.
llvm-svn: 100937
2010-04-10 18:26:57 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands
9dff9bec31
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Chris Lattner
d924f63692
Make jump threading honor x|undef -> true and x&undef -> false,
...
instead of considering x|undef -> x, which may not be true.
llvm-svn: 95850
2010-02-11 04:40:44 +00:00
Chris Lattner
29b15c5cfd
third bug from PR6119: the xor dupe extension allows
...
for arbitrary terminators in predecessors, don't assume
it is a conditional or uncond branch. The testcase shows
an example where they can happen with switches.
llvm-svn: 94323
2010-01-23 19:21:31 +00:00
Chris Lattner
ba2d0b89ff
add an early out to ProcessBranchOnXOR to speed it up,
...
handle the case when we can infer an input to the xor
from all inputs that agree, instead of going into an
infinite loop. Another part of PR6199
llvm-svn: 94321
2010-01-23 19:16:25 +00:00
Chris Lattner
de5ab4860f
fix a crash in jump threading, PR6119
...
llvm-svn: 94319
2010-01-23 18:56:07 +00:00
Chris Lattner
573da8ac90
1) Use the new SimplifyInstructionsInBlock routine instead of the copy
...
in JT.
2) When cloning blocks for PHI or xor conditions, use
instsimplify to simplify the code as we go. This allows us to
squish common cases early in JT which opens up opportunities for
subsequent iterations, and allows it to completely simplify the
testcase.
llvm-svn: 93253
2010-01-12 20:41:47 +00:00
Chris Lattner
af7855d571
tidy up
...
llvm-svn: 93222
2010-01-12 02:07:50 +00:00
Chris Lattner
eb73bdb2e1
Teach jump threading to duplicate small blocks when the branch
...
condition is a xor with a phi node. This eliminates nonsense
like this from 176.gcc in several places:
LBB166_84:
testl %eax, %eax
- setne %al
- xorb %cl, %al
- notb %al
- testb $1, %al
- je LBB166_85
+ je LBB166_69
+ jmp LBB166_85
This is rdar://7391699
llvm-svn: 93221
2010-01-12 02:07:17 +00:00
Chris Lattner
6a19ed0b86
some cleanup, and make it obvious that ProcessJumpOnPHI only works
...
on branches by renaming it and checking for a branch at the call site.
llvm-svn: 93208
2010-01-11 23:41:09 +00:00
Benjamin Kramer
76e2766442
Use a do-while loop instead of while + boolean.
...
llvm-svn: 92912
2010-01-07 13:50:07 +00:00
David Greene
1efdb45562
Change errs() to dbgs().
...
llvm-svn: 92614
2010-01-05 01:27:19 +00:00
Chris Lattner
f8d22fc77d
Metadata.h doesn't need to include ValueHandle.h anymore.
...
llvm-svn: 92211
2009-12-28 08:20:46 +00:00
Chris Lattner
6d6f10fe91
fix PR5698
...
llvm-svn: 90708
2009-12-06 17:17:23 +00:00
Chris Lattner
3c9aca9079
fix PR5640 by tracking whether a block is the header of a loop more
...
precisely, which prevents us from infinitely peeling the loop.
llvm-svn: 90211
2009-12-01 06:04:43 +00:00
Chris Lattner
9d9812a636
make PRE of loads preserve the alignment of the moved load instruction.
...
llvm-svn: 88865
2009-11-15 19:58:31 +00:00