Commit Graph

108 Commits

Author SHA1 Message Date
Chris Lattner
41bfbb0a87 Stores of null pointers should turn into memset, we weren't recognizing
them as splat values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126041 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 19:35:49 +00:00
Nick Lewycky
3b739d278c Tolerate degenerate phi nodes that can occur in the middle of optimization
passes. Fixes PR9112. Patch by Jakub Staszak!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125319 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 23:54:10 +00:00
Duncan Sands
93c780288d Add a m_SignBit pattern for convenience.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 08:50:33 +00:00
Duncan Sands
9136782d27 Fix typo: should have been testing that X was odd, not V.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124533 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 13:27:00 +00:00
Duncan Sands
464a4f349c APInt has a method for determining whether a number is a power of 2
which is more efficient than countPopulation - use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 08:44:16 +00:00
Duncan Sands
227fba11ca In which I discover that zero+zero is zero, d'oh!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 15:14:15 +00:00
Duncan Sands
2539b73128 See if this fixes llvm-gcc bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124184 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 12:15:09 +00:00
Duncan Sands
d70d1a5c44 According to my auto-simplifier the most common missed simplifications in
optimized code are:
  (non-negative number)+(power-of-two) != 0 -> true
and
  (x | 1) != 0 -> true
Instcombine knows about the second one of course, but only does it if X|1
has only one use.  These fire thousands of times in the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 09:38:29 +00:00
Dan Gohman
bd1801b555 Give GetUnderlyingObject a TargetData, to keep it in sync
with BasicAA's DecomposeGEPExpression, which recently began
using a TargetData. This fixes PR8968, though the testcase
is awkward to reduce.

Also, update several off GetUnderlyingObject's users
which happen to have a TargetData handy to pass it in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124134 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 18:53:32 +00:00
Chris Lattner
43b40a4620 fix an off-by-one bug that caused a crash analyzing
ashr's with huge shift amounts, PR8896


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122814 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 18:19:15 +00:00
Chris Lattner
bb89710ddd move isBytewiseValue out to ValueTracking.h/cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122565 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-26 20:15:01 +00:00
Nate Begeman
9a3dc55202 Add vector versions of some existing scalar transforms to aid codegen in matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:12:19 +00:00
Dan Gohman
c01895c7db Reapply r121886, and also update DecomposeGEPExpression to keep
it in sync.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:49:55 +00:00
Dan Gohman
3928d13808 Revert r121886. DecomposeGEPExpression needs to be kept
in sync.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121892 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:39:25 +00:00
Dan Gohman
243712720a Strengthen GetUnderlyingObject using InstructionSimplify.
While LLVM's main design is that analysis code shouldn't
go out of its way to understand code which hasn't been
InstCombined, analysis utility routines like this can
find themselves being called in the middle of transform
passes when instcombine hasn't had a chance to run.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121886 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:10:26 +00:00
Dan Gohman
5034dd318a Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:02:24 +00:00
Jay Foad
40f8f6264d PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:19 +00:00
Jay Foad
7a874ddda0 PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 08:53:58 +00:00
Chris Lattner
ed58a6f96f move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120476 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 22:25:26 +00:00
Jay Foad
a99793c5ea PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 09:02:01 +00:00
Chris Lattner
e971131695 fix PR8063, a crash in globalopt in the malloc analysis code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 17:20:46 +00:00
Chris Lattner
30963fbe8f move gep decomposition out of ValueTracking into BasicAA. The form of
decomposition that it is doing is very basicaa specific and is only used
by basicaa.

Now with less tree breakingness.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 22:07:29 +00:00
Daniel Dunbar
4ae56d725d Revert r111375, "move gep decomposition out of ValueTracking into BasicAA. The
form of", it doesn't pass tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:43:08 +00:00
Chris Lattner
6b63037306 move gep decomposition out of ValueTracking into BasicAA. The form of
decomposition that it is doing is very basicaa specific and is only used
by basicaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:22:17 +00:00
Chris Lattner
91b2307a89 fix PR7589: In brief:
gep P, (zext x) != gep P, (sext x)

DecomposeGEPExpression was getting this wrong, confusing
basicaa.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111352 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 04:28:19 +00:00
Gabor Greif
71339c965c use ArgOperand accessors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106697 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 23:38:07 +00:00
Eric Christopher
551754c495 Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 23:37:20 +00:00
Gabor Greif
4ec2258ffb reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 15:33:14 +00:00
Gabor Greif
607a7ab3da back out r101423 and r101397, they break llvm-gcc self-host on darwin10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:16:20 +00:00
Gabor Greif
2ff961f668 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 20:51:13 +00:00
Gabor Greif
9ee1720811 back out r101364, as it trips the linux nightlybot on some clang C++ tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 12:46:56 +00:00
Gabor Greif
165dac08d1 rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 10:49:53 +00:00
Dan Gohman
0a60fa3321 Constify GetConstantStringInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 22:20:45 +00:00
Evan Cheng
0af20d847a Fix a typo in ValueTracking that's causing instcombine to delete needed shift instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 02:20:29 +00:00
Eric Christopher
25ec483cfc Move GetStringLength and helper from SimplifyLibCalls to ValueTracking.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97793 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 06:58:57 +00:00
Duncan Sands
1df9859c40 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 11:11:14 +00:00
Duncan Sands
b0bc6c361d Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 16:12:20 +00:00
Duncan Sands
cfd54181a4 It looks like the changes to the SRem logic of SimplifyDemandedUseBits
(fix for PR6165) are needed here too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 06:18:37 +00:00
Chris Lattner
8d10f9d4a8 teach ComputeNumSignBits to look through PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 23:44:37 +00:00
Benjamin Kramer
8c65f6e71c Move remaining stuff to the isInteger predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:05:54 +00:00
Chris Lattner
524528e614 Fix GetConstantStringInfo to not look into MDString (it works on
real data, not metadata) and fix DbgInfoPrinter to not abuse
GetConstantStringInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91444 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 19:34:20 +00:00
Mon P Wang
69a008075b Fixed an assertion failure for tracking sext of a vector of integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90290 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 04:59:58 +00:00
Chris Lattner
ab9530ee5d implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 15:12:41 +00:00
Chris Lattner
a650f770d4 limit the recursion depth of GetLinearExpression. This
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90000 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:32:52 +00:00
Chris Lattner
1ce0eaa25f Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 18:53:33 +00:00
Chris Lattner
b18004c13c fix two transposed lines duncan caught and add an explanatory comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 18:35:46 +00:00
Chris Lattner
8fe8ac725b this todo is resolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:14:10 +00:00
Chris Lattner
e405c64f6b move DecomposeGEPExpression out into ValueTracking.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:12:50 +00:00
Chris Lattner
11fe72661d remove some redundant braces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 01:50:12 +00:00
Nick Lewycky
ae3d802953 Remove unused LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:29:18 +00:00