aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-07-25Convert GetElementPtrInst to use ArrayRef.Jay Foad1-2/+1
llvm-svn: 135904
2011-07-21Convert ConstantExpr::getGetElementPtr andJay Foad1-4/+3
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. llvm-svn: 135673
2011-07-19Convert TargetData::getIndexedOffset to use ArrayRef.Jay Foad1-7/+5
llvm-svn: 135478
2011-07-19Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.Jay Foad1-22/+21
llvm-svn: 135477
2011-07-18land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner1-31/+31
llvm-svn: 135375
2011-07-13Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad1-2/+2
llvm-svn: 135040
2011-06-23Revert "revert 133714"Rafael Espindola1-2/+1
This reverts commit e8e00f5efb4a22238f2407bf813de4606f30c5aa. The cmake build on OS X is still broken. llvm-svn: 133718
2011-06-23revert 133714Dylan Noblesmith1-1/+2
It broke the build worse. llvm-svn: 133716
2011-06-23133713 broke the build, revert it.Rafael Espindola1-2/+1
llvm-svn: 133714
2011-06-23Support: make floating-exception header privateDylan Noblesmith1-1/+2
It has only one user. This eliminates the last include of config.h from the public headers -- ideally, config.h shouldn't even be installed by `make install` anymore. llvm-svn: 133713
2011-06-20Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner1-1/+1
all over the place in different styles and variants. Standardize on two preferred entrypoints: one that takes a StructType and ArrayRef, and one that takes StructType and varargs. In cases where there isn't a struct type convenient, we now add a ConstantStruct::getAnon method (whose name will make more sense after a few more patches land). It would be "really really nice" if the ConstantStruct::get and ConstantVector::get methods didn't make temporary std::vectors. llvm-svn: 133412
2011-05-22implement PR9315, constant folding exp2 in terms of pow (since hosts withoutChris Lattner1-1/+7
C99 runtimes don't have exp2). llvm-svn: 131872
2011-04-11Don't include Operator.h from InstrTypes.h.Jay Foad1-0/+1
llvm-svn: 129271
2011-03-27Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel1-3/+8
identical to the smul.with.overflow() code. llvm-svn: 128379
2011-02-15convert ConstantVector::get to use ArrayRef.Chris Lattner1-2/+2
llvm-svn: 125537
2011-02-14revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner1-2/+2
builders unhappy. llvm-svn: 125504
2011-02-14Switch ConstantVector::get to use ArrayRef instead of a pointer+sizeChris Lattner1-2/+2
idiom. Change various clients to simplify their code. llvm-svn: 125487
2011-02-06Simplify test, as suggested by Chris.Anders Carlsson1-6/+2
llvm-svn: 124990
2011-02-06When loading from a constant, fold inttoptr if the integer type and the ↵Anders Carlsson1-0/+11
resulting pointer type both have the same size. llvm-svn: 124987
2011-01-24Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman1-1/+2
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. llvm-svn: 124134
2011-01-16fix PR8983, a broken assertion.Chris Lattner1-1/+1
llvm-svn: 123562
2011-01-11Teach constant folding to perform conversions from constant floatingChandler Carruth1-0/+56
point values to their integer representation through the SSE intrinsic calls. This is the last part of a README.txt entry for which I have real world examples. llvm-svn: 123206
2011-01-10Cleanup some of the constant folding code to consistently test intrinsicChandler Carruth1-16/+18
IDs when available rather than using a mixture of IDs and textual name comparisons. llvm-svn: 123165
2011-01-06use isNullValue() to simplify code, add an assert.Chris Lattner1-5/+6
llvm-svn: 122977
2011-01-06implement constant folding support for an exotic constant expr:Chris Lattner1-1/+19
ret i64 ptrtoint (i8* getelementptr ([1000 x i8]* @X, i64 1, i64 sub (i64 0, i64 ptrtoint ([1000 x i8]* @X to i64))) to i64) to "ret i64 1000". This allows us to correctly compute the trip count on a loop in PR8883, which occurs with std::fill on a char array. This allows us to transform it into a memset with a constant size. llvm-svn: 122950
2010-12-23Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin1-2/+1
new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
2010-12-15Move Value::getUnderlyingObject to be a standaloneDan Gohman1-1/+1
function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
2010-12-07PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad1-4/+2
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
2010-11-29Teach ConstantFoldInstruction() how to fold insertvalue and extractvalue.Frits van Bommel1-1/+12
llvm-svn: 120316
2010-11-29Merge System into Support.Michael J. Spencer1-1/+1
llvm-svn: 120298
2010-11-23Clarify that constant folding of instructions applies when all operandsDuncan Sands1-10/+11
are constant. There was in fact one exception to this (phi nodes) - so remove that exception (InstructionSimplify handles this so there should be no loss). llvm-svn: 120015
2010-11-21Fix spelling.Duncan Sands1-2/+2
llvm-svn: 119941
2010-11-21apply Dan's fix for PR8268 which allows constant folding to handle indexes overChris Lattner1-7/+15
zero sized elements. This allows us to compile: #include <string> void foo() { std::string s; } into an empty function. llvm-svn: 119933
2010-11-14Boost the power of phi node constant folding slightly: if allDuncan Sands1-12/+18
operands are the phi node itself or undef, then return undef. This logic already existed at a higher level so in practice it shouldn't make the slightest difference. Note that this code could be replaced by a call to PN->hasConstantValue(). However since we bail out the moment we see a non-constant operand, it is more efficient to have a specialized version of that logic. llvm-svn: 119041
2010-10-14add uadd_ov/usub_ov to apint, consolidate constant foldingChris Lattner1-32/+28
logic to use the new APInt methods. Among other things this implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold which comes from "clang -ftrapv", originally brought to my attention from PR8221. llvm-svn: 116457
2010-09-27Don't try to constant fold libm functions with non-finite arguments.Jakob Stoklund Olesen1-0/+7
Usually we wouldn't do this anyway because llvm_fenv_testexcept would return an exception, but we have seen some cases where neither errno nor fenv detect an exception on arm-linux. llvm-svn: 114893
2010-09-17Don't include <fenv.h> now that we have llvm/System/FEnv.h.Jakob Stoklund Olesen1-1/+0
llvm-svn: 114219
2010-09-17Attempt to support platforms which don't have fenv.h.Dan Gohman1-12/+7
llvm-svn: 114196
2010-09-17Fix the folding of floating-point math library calls, like sin(infinity),Dan Gohman1-2/+9
so that it detects errors on platforms where libm doesn't set errno. It's still subject to host libm details though. llvm-svn: 114148
2010-07-16eliminate CallInst::ArgOffsetGabor Greif1-2/+2
llvm-svn: 108522
2010-07-12Add parentheses around an || to correct the logic. Also silences a GCC warningChandler Carruth1-1/+1
that was actually useful here. Chris, please double check that this is the correct interpretation. I was pretty sure, and ran it by Nick as well. llvm-svn: 108129
2010-07-12fix PR7429, a crash turning a load from a string into a float.Chris Lattner1-3/+9
llvm-svn: 108113
2010-07-07conditionalize by CallInst::ArgOffsetGabor Greif1-2/+2
llvm-svn: 107767
2010-06-18Eliminate unnecessary uses of getZExtValue().Dan Gohman1-1/+1
llvm-svn: 106279
2010-04-16Revert 101465, it broke internal OpenGL testing.Eric Christopher1-2/+2
Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
2010-04-16reapply r101434Gabor Greif1-2/+2
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 llvm-svn: 101465
2010-04-16back out r101423 and r101397, they break llvm-gcc self-host on darwin10Gabor Greif1-2/+2
llvm-svn: 101434
2010-04-15reapply r101364, which has been backed out in r101368Gabor Greif1-2/+2
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 llvm-svn: 101397
2010-04-15back out r101364, as it trips the linux nightlybot on some clang C++ testsGabor Greif1-2/+2
llvm-svn: 101368
2010-04-15rotate CallInst operands, i.e. move callee to the backGabor Greif1-2/+2
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 llvm-svn: 101364