History log of /external/llvm/lib/Analysis/ConstantFolding.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
89879ec76b5d81b0cc82e9f402dfe7c4cc63b0d6 29-Aug-2011 Nadav Rotem <nadav.rotem@intel.com> Fixes following the CR by Chris and Duncan:

Optimize chained bitcasts of the form A->B->A.
Undo r138722 and change isEliminableCastPair to allow this case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
be6ceb6ebcfb48e09ffab297c1537c87383f0ce9 28-Aug-2011 Nadav Rotem <nadav.rotem@intel.com> Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
4c7c0f23533565c7e2ddf71e01bf50f2aede5f1b 24-Aug-2011 Nadav Rotem <nadav.rotem@intel.com> Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
acc8f2d938dbf00c79c34f4541a5a05662964797 23-Aug-2011 Eric Christopher <echristo@apple.com> Revert "Address Duncan's CR request:"

This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340)

Conflicts:

test/Transforms/InstCombine/bitcast.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
20a05be15ea5271ab6185b83200fa88263362400 23-Aug-2011 Nadav Rotem <nadav.rotem@intel.com> Address Duncan's CR request:
1. Cleanup the tests in ConstantFolding.cpp
2. Implement isAllOnes for Constant, ConstantFP, ConstantVector





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1c9fe0361b3f9f5c814ce761b97ecd11637a1d7d 20-Aug-2011 Nadav Rotem <nadav.rotem@intel.com> Add constant folding support for bitcasts of splat vectors to integers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
a9203109f4ac95aa7e9624f2838e3d89623ec902 25-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert GetElementPtrInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
dab3d29605a5c83db41b28176273ef55961120c1 21-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
8fbbb3980755d74539a0aed02bc18842ed2bd18d 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert TargetData::getIndexedOffset to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1d2f569c3428d70d0cf690c9adb459ad4a3ecff2 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
fc6d3a49867cd38954dc40936a88f1907252c6d2 13-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
83471853b1d5a9efe6b9e7565c457fc901f84926 23-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert "revert 133714"

This reverts commit e8e00f5efb4a22238f2407bf813de4606f30c5aa.

The cmake build on OS X is still broken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e8e00f5efb4a22238f2407bf813de4606f30c5aa 23-Jun-2011 Dylan Noblesmith <nobled@dreamwidth.org> revert 133714

It broke the build worse.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
cd3448658125aaf88b32f226d84b53a44e2ba0ab 23-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> 133713 broke the build, revert it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5417eed2014a2fb46057bdd9931e878968b810dc 23-Jun-2011 Dylan Noblesmith <nobled@dreamwidth.org> Support: make floating-exception header private

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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b065b06c12dba6001b8140df2744d0c856ef6ea1 20-Jun-2011 Chris Lattner <sabre@nondot.org> Revamp the "ConstantStruct::get" methods. Previously, these were scattered
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
805fa97a0f5ff61624855da37d4881708fb8f0fb 23-May-2011 Chris Lattner <sabre@nondot.org> implement PR9315, constant folding exp2 in terms of pow (since hosts without
C99 runtimes don't have exp2).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
562b84b3aea359d1f918184e355da82bf05eb290 11-Apr-2011 Jay Foad <jay.foad@gmail.com> Don't include Operator.h from InstrTypes.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6208610fd602ebdb18bb793152899573d0b2b7ab 27-Mar-2011 Frits van Bommel <fvbommel@gmail.com> Constant folding support for calls to umul.with.overflow(), basically identical to the smul.with.overflow() code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b 15-Feb-2011 Chris Lattner <sabre@nondot.org> convert ConstantVector::get to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
75831904220042260c4faece8507a2807acba47f 14-Feb-2011 Chris Lattner <sabre@nondot.org> revert my ConstantVector patch, it seems to have made the llvm-gcc
builders unhappy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
283c8caccd093f8e1d4f0bdd01ac240b4edbd20a 14-Feb-2011 Chris Lattner <sabre@nondot.org> Switch ConstantVector::get to use ArrayRef instead of a pointer+size
idiom. Change various clients to simplify their code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5d43ff4e7ea30eaf5a1c417f0ec528900f5c83f2 06-Feb-2011 Anders Carlsson <andersca@mac.com> Simplify test, as suggested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6475d9434ff3e981160f85d3f1aa07c9e0ace6f2 06-Feb-2011 Anders Carlsson <andersca@mac.com> When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
bd1801b5553c8be3960255a92738464e0010b6f6 24-Jan-2011 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
156eb0a569a1ebac86ad8438645f690d8a3894c4 16-Jan-2011 Chris Lattner <sabre@nondot.org> fix PR8983, a broken assertion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
15ed90c859e5df11112c614c83d0d2e786d4c73a 11-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Teach constant folding to perform conversions from constant floating
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f4db877cff62340aaf9f29d3994562ae1cee8d72 10-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Cleanup some of the constant folding code to consistently test intrinsic
IDs when available rather than using a mixture of IDs and textual name
comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f1cadf28991b2643128bfe38990ff235f2cb1491 06-Jan-2011 Chris Lattner <sabre@nondot.org> use isNullValue() to simplify code, add an assert.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
8cd4efb6a5e51b4e77039c17338f290ca3a8ee92 06-Jan-2011 Chris Lattner <sabre@nondot.org> implement constant folding support for an exotic constant expr:
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
8e68c3873549ca31533e2e3e40dda3a43cb79566 23-Dec-2010 Jeffrey Yasskin <jyasskin@google.com> Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d 15-Dec-2010 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
40f8f6264d5af2c38e797e0dc59827cd231e8ff7 07-Dec-2010 Jay Foad <jay.foad@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
3ee0af35842999c1781052fe74fdcb19997de950 29-Nov-2010 Frits van Bommel <fvbommel@gmail.com> Teach ConstantFoldInstruction() how to fold insertvalue and extractvalue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1f6efa3996dd1929fbc129203ce5009b620e6969 29-Nov-2010 Michael J. Spencer <bigcheesegs@gmail.com> Merge System into Support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b9b369fa9983843c4ed77b3a35b6e9b7933955bb 23-Nov-2010 Duncan Sands <baldrick@free.fr> Clarify that constant folding of instructions applies when all operands
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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e58391073f6e17cd1024f737618a6f6b8d1323ce 21-Nov-2010 Duncan Sands <baldrick@free.fr> Fix spelling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c1da204c433459713cbf4c62f0addf458e6b4b9f 21-Nov-2010 Chris Lattner <sabre@nondot.org> apply Dan's fix for PR8268 which allows constant folding to handle indexes over
zero sized elements. This allows us to compile:

#include <string>
void foo() { std::string s; }

into an empty function.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c0362d5c6e0066c741bce056a65d8b4c026de19f 14-Nov-2010 Duncan Sands <baldrick@free.fr> Boost the power of phi node constant folding slightly: if all
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
eafc5cb80d58cb9447623a557be4d4f55f42fbc3 14-Oct-2010 Chris Lattner <sabre@nondot.org> add uadd_ov/usub_ov to apint, consolidate constant folding
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1f386c4ce1983c448320aecca8d3cd27d1497867 27-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't try to constant fold libm functions with non-finite arguments.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
38cb1cdfb7308e82ed00985427f78d11d817d88a 17-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't include <fenv.h> now that we have llvm/System/FEnv.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
3f2f21e640682c604d9322ba0708e122d1fcf5ee 17-Sep-2010 Dan Gohman <gohman@apple.com> Attempt to support platforms which don't have fenv.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
8ee731f2ce62d936f81c12283a192375a87f323a 17-Sep-2010 Dan Gohman <gohman@apple.com> Fix the folding of floating-point math library calls, like sin(infinity),
so that it detects errors on platforms where libm doesn't set errno.
It's still subject to host libm details though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
a6aac4c5bc22bb10c7adb11eee3f82c703af7002 16-Jul-2010 Gabor Greif <ggreif@gmail.com> eliminate CallInst::ArgOffset

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
490b8f5d64823d998fc12ad3a91ecacd82c1901e 12-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Add parentheses around an || to correct the logic. Also silences a GCC warning
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
eae2895120500d06bf6de9725efeeff498f60385 12-Jul-2010 Chris Lattner <sabre@nondot.org> fix PR7429, a crash turning a load from a string into a float.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
274fefdd968c594983e19e9debc0ba9674d01991 07-Jul-2010 Gabor Greif <ggreif@gmail.com> conditionalize by CallInst::ArgOffset

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e368b460a206fafa0d31d5d059b1779b94f7df8c 18-Jun-2010 Dan Gohman <gohman@apple.com> Eliminate unnecessary uses of getZExtValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
551754c4958086cc6910da7c950f2875e212f5cf 17-Apr-2010 Eric Christopher <echristo@apple.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
4ec2258ffb495d7ce00177e447740ef1123a27db 16-Apr-2010 Gabor Greif <ggreif@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
607a7ab3da72a2eb53553a520507cbb8068dd1d8 16-Apr-2010 Gabor Greif <ggreif@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
2ff961f66816daab8bbc58a19025161d969821c2 15-Apr-2010 Gabor Greif <ggreif@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
9ee17208115482441953127615231c59a2f4d052 15-Apr-2010 Gabor Greif <ggreif@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
165dac08d1bb8428b32a5f39cdd3dbee2888987f 15-Apr-2010 Gabor Greif <ggreif@gmail.com> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
ce800511701135ed86845b451693a248c83a7973 12-Apr-2010 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
faa75f6e47350f491a44d5e8773acd9457185d51 19-Mar-2010 Anton Korobeynikov <asl@math.spbu.ru> FP16 constfolding

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
40b037ef611efc5c43ffc43a911d0eb57e0d444d 18-Mar-2010 Dan Gohman <gohman@apple.com> Simplify this code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
890edda7c22dd8525f9fe44085cfd7080e67dfee 12-Mar-2010 Duncan Sands <baldrick@free.fr> When constant folding GEP of GEP, do not crash if an index of
the inner GEP is not a ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
0891d752a68a25025ffc3339aab1f0ad3221b0ed 10-Mar-2010 Dan Gohman <gohman@apple.com> Constant-fold GEP-of-GEP into a single GEP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b80a2a686fe76496d71397f8bdda394d5718ab01 23-Feb-2010 Dan Gohman <gohman@apple.com> Remove the code which constant-folded ptrtoint(inttoptr(x)+c) to
getelementptr. Despite only doing so in the case where x is a known
array object and c can be converted to an index within range, this
could still be invalid if c is actually the address of an object
allocated outside of LLVM. Also, SCEVExpander, the original motivation
for this code, has since been improved to avoid inttoptr+ptroint in
more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
0e488b3d1c9293bbf2d64d0ecc4d6339f9100351 22-Feb-2010 Dan Gohman <gohman@apple.com> Canonicalize ConstantInts to the right operand of commutative
operators.

The test difference is just due to the multiplication operands
being commuted (and thus requiring a more elaborate match). In
optimized code, that expression would be folded.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
95056e4808d2e3730983b4d93c21737a12cf7fee 22-Feb-2010 Dan Gohman <gohman@apple.com> Minor formatting cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
9ee7123ab462d97a2b242280e9bf0b47883531cb 17-Feb-2010 Dan Gohman <gohman@apple.com> Fold bswap(undef) to undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1df9859c40492511b8aa4321eb76496005d3b75b 16-Feb-2010 Duncan Sands <baldrick@free.fr> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
b0bc6c361da9009e8414efde317d9bbff755f6c0 15-Feb-2010 Duncan Sands <baldrick@free.fr> 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
/external/llvm/lib/Analysis/ConstantFolding.cpp
baf0c67988feec5b7698f89dce499ddb7d0c3c42 08-Feb-2010 Dan Gohman <gohman@apple.com> Add const qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
4f8eea82d8967cffa85b9df6c9255717b059009e 01-Feb-2010 Dan Gohman <gohman@apple.com> Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b31189f26297fe30214da3e8d14a4575d5fdd262 08-Jan-2010 Chris Lattner <sabre@nondot.org> fix PR5978 by peeling the loop so that we avoid shifting the
result int by 8 for the first byte. While normally harmless,
if the result is smaller than a byte, this shift is invalid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
79fa3cf451a74dd1cec0be2d77d7ea9737dffc69 02-Jan-2010 Chris Lattner <sabre@nondot.org> constant fold nasty constant expressions formed by llvm-gcc,
wrapping up PR3351.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
44a7a380aa9fbb303f57f4f8269062b7b56be980 04-Dec-2009 Chris Lattner <sabre@nondot.org> Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e568fa2d29c58aaedcaa832f805949d5e4371b4b 03-Dec-2009 Chris Lattner <sabre@nondot.org> fix PR5673 by being more careful about pointers to functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
fac554a1317bf32daf5698740670025ae14e6bcc 29-Nov-2009 Nick Lewycky <nicholas@mxc.ca> Teach ConstantFolding to do a better job when folding gep(bitcast).

This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
01b97dd01eec1197d79fceb7229f5ec233994de3 23-Nov-2009 Dan Gohman <gohman@apple.com> Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
8f73deaa8732a556046bf4ac6207be55972e3b74 10-Nov-2009 Chris Lattner <sabre@nondot.org> fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
7b550ccfc5a3346c17e0390a59e2d6d19bc52705 06-Nov-2009 Chris Lattner <sabre@nondot.org> remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
93798daa3ecbfb29624052d3e54d2404ab65897a 25-Oct-2009 Chris Lattner <sabre@nondot.org> Teach FoldBitCast to be able to handle bitcasts from (e.g.) i128 -> <4 x float>.

This allows us to simplify this:
union vec2d {
double e[2];
double v __attribute__((vector_size(16)));
};
typedef union vec2d vec2d;

static vec2d a={{1,2}}, b={{3,4}};

vec2d foo () {
return (vec2d){ .v = a.v + b.v * (vec2d){{5,5}}.v };
}

down to:

define %0 @foo() nounwind ssp {
entry:
%mrv5 = insertvalue %0 undef, double 1.600000e+01, 0 ; <%0> [#uses=1]
%mrv6 = insertvalue %0 %mrv5, double 2.200000e+01, 1 ; <%0> [#uses=1]
ret %0 %mrv6
}

instead of:

define %0 @foo() nounwind ssp {
entry:
%mrv5 = insertvalue %0 undef, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 0), 0 ; <%0> [#uses=1]
%mrv6 = insertvalue %0 %mrv5, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 1), 1 ; <%0> [#uses=1]
ret %0 %mrv6
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6333c3959b7e3e43930ab523f0657791e9eb5d48 25-Oct-2009 Chris Lattner <sabre@nondot.org> move FoldBitCast earlier in the file, and use it instead of
ConstantExpr::getBitCast in various places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
ea9d57bc9a8eb6aaa07b250cc59774d1a1981221 25-Oct-2009 Chris Lattner <sabre@nondot.org> refactor FoldBitCast to reduce nesting and to always return a constantexpr
instead of returning null on failure. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c7b1382e351249774be63bd73839e8a0671635e1 24-Oct-2009 Chris Lattner <sabre@nondot.org> various cleanups suggested by Duncan


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c5af649758ac8c6ffb896d7d5c570640a9fa1dee 24-Oct-2009 Chris Lattner <sabre@nondot.org> fix PR5287, a serious regression from my previous patches. Thanks to
Duncan for the nice tiny testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
17f0cd3cc1432231f2bc5601e7e463986a59d817 23-Oct-2009 Chris Lattner <sabre@nondot.org> teach libanalysis to simplify vector loads with bitcast sources. This
implements something out of Target/README.txt producing:

_foo: ## @foo
movl 4(%esp), %eax
movapd LCPI1_0, %xmm0
movapd %xmm0, (%eax)
ret $4

instead of:

_foo: ## @foo
movl 4(%esp), %eax
movapd _b, %xmm0
mulpd LCPI1_0, %xmm0
addpd _a, %xmm0
movapd %xmm0, (%eax)
ret $4



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
739208a790398cf1f9da05149c768371e48781e8 23-Oct-2009 Chris Lattner <sabre@nondot.org> enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32
bytes (i256).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
fe8c7c807c6f815561bc2bdddfd330b05dbdfc93 23-Oct-2009 Chris Lattner <sabre@nondot.org> teach libanalysis to fold int and fp loads from almost arbitrary
non-type-safe constant initializers. This sort of thing happens
quite a bit for 4-byte loads out of string constants, unions,
bitfields, and an interesting endianness check from sqlite, which
is something like this:

const int sqlite3one = 1;
# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)

all of these macros now constant fold away.

This implements PR3152 and is based on a patch started by Eli, but heavily
modified and extended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e00c43fc35d64b2ee8d2b4692c02375d2d7b4aa4 22-Oct-2009 Chris Lattner <sabre@nondot.org> move another load optimization from instcombine -> libanalysis.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
62d327e241f59735eed836e98c8f11ffaa6cf6f8 22-Oct-2009 Chris Lattner <sabre@nondot.org> move 'loading i32 from string' optimization from instcombine
to libanalysis. Instcombine shrinking... does this even
make sense???


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
878e4946700824954d7eb7f3ff660353db8e0d17 22-Oct-2009 Chris Lattner <sabre@nondot.org> Move some constant folding logic for loads out of instcombine into
Analysis/ConstantFolding.cpp. This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads. This was partially extracted from Eli's patch
in PR3152.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1614e50d9f6d48a38e4dafb4b1a51fd4b37614f3 06-Oct-2009 Evan Phoenix <evan@fallingsnow.net> Extend ConstantFolding to understand signed overflow variants


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c6f69e94fa46f585b59bb9d7ace3224b0e638c95 05-Oct-2009 Dan Gohman <gohman@apple.com> Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e65cd40ab99c3bd43dc997873e500643d012bbad 05-Oct-2009 Chris Lattner <sabre@nondot.org> teach the optimizer how to constant fold uadd/usub intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
d0806a1519f3bc450d2dea3e6f22db73fc797e4c 05-Oct-2009 Chris Lattner <sabre@nondot.org> simplify this code a bunch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
68a0603dc5d3d79cd4de2195e950af26c3380cd7 05-Oct-2009 Chris Lattner <sabre@nondot.org> code simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
58665d47aea69875c433fb039c8f10106abc1cee 16-Sep-2009 Chris Lattner <sabre@nondot.org> simplify some code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
3bfbc4587a7e79f08f8c126a9e62c3475fb90f8b 11-Sep-2009 Dan Gohman <gohman@apple.com> Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword and
how to fold notionally-out-of-bounds array getelementptr indices instead
of just doing these in lib/Analysis/ConstantFolding.cpp, because it can
be done in a fairly general way without TargetData, and because not all
constants are visited by lib/Analysis/ConstantFolding.cpp. This enables
more constant folding.

Also, set the "inbounds" flag when the getelementptr indices are
one-past-the-end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
83e3c4f9d796a5da223a3ebd5d4ba985c7ecc39d 11-Sep-2009 Dan Gohman <gohman@apple.com> Give these files top-level comments that describe the current code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81473 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6e7ad958683f34bf6c014c88fef723e5a2d741be 04-Sep-2009 Dan Gohman <gohman@apple.com> Revert 80959. It isn't sufficient to solve the full problem. And it
introduced regressions in the Ocaml bindings tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e56a94ef91009ddb8d8b68783ff1650bcad3b326 04-Sep-2009 Dan Gohman <gohman@apple.com> Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,
and exact flags. Because ConstantExprs are uniqued, creating an
expression with this flag causes all expressions with the same operands
to have the same flag, which may not be safe. Add, sub, mul, and sdiv
ConstantExprs are usually folded anyway, so the main interesting flag
here is inbounds, and the constant folder already knows how to set the
inbounds flag automatically in most cases, so there isn't an urgent need
for the API support.

This can be reconsidered in the future, but for now just removing these
API bits eliminates a source of potential trouble with little downside.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f19f9347b85279100f7d549154e37b6d726c3c94 02-Sep-2009 Chris Lattner <sabre@nondot.org> fix PR4848 an infinite loop when indexing down through a recursive gep
and we get the original pointer type. This doesn't mean that we're
at the first pointer being indexed. Correct the predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
7178010a168a378df5d9be95956093a3e5f963fd 21-Aug-2009 Dan Gohman <gohman@apple.com> Don't assume that the operand of an inttoptr is an pointer-sized integer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
cda9706cb74a65d2feb2175613cb0fe46acc5aa2 21-Aug-2009 Dan Gohman <gohman@apple.com> Change getelementptr folding to use APInt instead of uint64_t for
offset computations. This fixes a truncation bug on targets that
don't have 64-bit pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
4c0d5d5db876b0628bdf6a2174263a1c0a9130e2 20-Aug-2009 Dan Gohman <gohman@apple.com> Various comment and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
3d01334e6fa5caba1361d088fabf728c64b23c58 20-Aug-2009 Dan Gohman <gohman@apple.com> Fix a bug in the over-index constant folding. When over-indexing an
array member of a struct, it's possible to land in an arbitrary position
inside that struct, such that attempting to find further getelementptr
indices will fail. In such cases, folding cannot be done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
de0e587e63f71afb2ac53c9880c262089fe798bb 19-Aug-2009 Dan Gohman <gohman@apple.com> Canonicalize indices in a constantexpr GEP. If Indices exceed the
static extents of the static array type, it causes GlobalOpt and
other passes to be more conservative. This canonicalization also
allows the constant folder to add "inbounds" to GEPs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1d0be15f89cb5056e20e2d24faa8d6afb1573bca 13-Aug-2009 Owen Anderson <resistor@mac.com> Push LLVMContexts through the IntegerType APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
a7235ea7245028a0723e8ab7fd011386b3900777 31-Jul-2009 Owen Anderson <resistor@mac.com> Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
9e9a0d5fc26878e51a58a8b57900fcbf952c2691 31-Jul-2009 Owen Anderson <resistor@mac.com> Move more code back to 2.5 APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
debcb01b0f0a15f568ca69e8f288fade4bfc7297 30-Jul-2009 Owen Anderson <resistor@mac.com> Move types back to the 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
baf3c404409d5e47b13984a7f95bfbd6d1f2e79e 29-Jul-2009 Owen Anderson <resistor@mac.com> Move ConstantExpr to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
af7ec975870f92245f1f1484ac80a1e2db6a0afa 28-Jul-2009 Owen Anderson <resistor@mac.com> Return ConstantVector to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6f83c9c6ef0e7f79825a0a8f22941815e4b684c7 27-Jul-2009 Owen Anderson <resistor@mac.com> Move ConstantFP construction back to the 2.5-ish API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f0443c1eb44d737d9bd78962932fc80f74c6113c 26-Jul-2009 Daniel Dunbar <daniel@zuster.org> Remove Value::getNameLen


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
eed707b1e6097aac2bb6b3d47271f6300ace7f2e 25-Jul-2009 Owen Anderson <resistor@mac.com> Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e922c0201916e0b980ab3cfe91e1413e68d55647 22-Jul-2009 Owen Anderson <resistor@mac.com> Get rid of the Pass+Context magic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c23197a26f34f559ea9797de51e187087c039c42 14-Jul-2009 Torok Edwin <edwintorok@gmail.com> llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c25e7581b9b8088910da31702d4ca21c4734c6d7 11-Jul-2009 Torok Edwin <edwintorok@gmail.com> assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
7f6aa2b162e5daaf7b9ccf05d749597d3d7cf460 08-Jul-2009 Nick Lewycky <nicholas@mxc.ca> Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
07cf79ef537caff6d39145f190a28a336e629b6f 07-Jul-2009 Owen Anderson <resistor@mac.com> "LLVMContext* " --> "LLVMContext *"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
508955156a25a9abc470a29e1760aa176d341cf9 06-Jul-2009 Owen Anderson <resistor@mac.com> Thread LLVMContext through the constant folding APIs, which touches a lot of files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6de29f8d960505421d61c80cdb738e16720b6c0e 16-Jun-2009 Dan Gohman <gohman@apple.com> Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
7714285efd2a7f4e503f0f600667193e63ee6d08 02-Jun-2009 Dan Gohman <gohman@apple.com> Change ConstantFoldConstantExpression to accept a null
TargetData pointer. The only thing it's used for are
calls to ConstantFoldCompareInstOperands and
ConstantFoldInstOperands, which both already accept a
null TargetData pointer. This makes
ConstantFoldConstantExpression easier to use in clients
where TargetData is optional.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e3e51c0038bd6ba2add82e2246e97edec0ab2204 21-May-2009 Jay Foad <jay.foad@gmail.com> Use v.data() instead of &v[0] when SmallVector v might be empty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
777d2306b36816a53bc1ae1244c0dc7d998ae691 09-May-2009 Duncan Sands <baldrick@free.fr> Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
9a38e3e3991ea443e555d8060f91202a786acdd4 07-May-2009 Dan Gohman <gohman@apple.com> Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5b8479c38532a28d86dea8ded09a30ff68f26912 07-May-2009 Bill Wendling <isanbard@gmail.com> Temporarily revert r71158. It was causing a failure during a full bootstrap:

checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
704b6980b8d45d5b6b981850bd82634d2d91e4c4 07-May-2009 Dan Gohman <gohman@apple.com> Constant-fold ptrtoint+add+inttoptr to gep when the pointer is an
array and the add is within range. This helps simplify expressions
expanded by ScalarEvolutionExpander.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6f532a988e5c02fcb271fb65e9e7b83f0147d3f2 03-Apr-2009 Chris Lattner <sabre@nondot.org> use higher level APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
ceb4d1aecb9deffe59b3dcdc9a783ffde8477be9 12-Jan-2009 Duncan Sands <baldrick@free.fr> Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
67e3566d8f6875e9c92d224f493023408a66227e 15-Dec-2008 Nick Lewycky <nicholas@mxc.ca> Fix whitespace in comment.
Remove TODO; icmp isn't a binary operator, so this function will never deal
with them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61020 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
d43390498291c475a6e277fcd5d3bbf5abd3b41e 20-Nov-2008 Nick Lewycky <nicholas@mxc.ca> undef beats zero. Fix this missed optimization opportunity. Patch by Matt Elder!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
04aa2c3520c049333ca216fb794d700310c4a33d 24-Oct-2008 Nick Lewycky <nicholas@mxc.ca> Don't try to create a mask when we don't need one. Fixes a crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
81b06be055e74a3c23a1c8f17ead97f9f76335ee 13-Aug-2008 Duncan Sands <baldrick@free.fr> Teach constant folding that an inttoptr of a
ptrtoint can be turned into a bitcast if the
integer is at least as wide as a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b5557abcf13a7b375cae683e9ec200d499645d02 25-Jul-2008 Nate Begeman <natebegeman@mac.com> Fix minor issues with VICmp/VFCmp constant expressions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
3dfd7bf5110c47e99fd0fcce96122b90f699ca3a 25-May-2008 Nick Lewycky <nicholas@mxc.ca> "ret (constexpr)" can't be folded into a Constant. Add a method to
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.

Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
785c6af9797fcf551feef70f2ecb5cd075b6e3c4 22-May-2008 Gabor Greif <ggreif@gmail.com> transform more loops to iterator form, detabify

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
de2d74b213844b17eb5327fba27f21e699d3af66 22-May-2008 Gabor Greif <ggreif@gmail.com> Rewrite operand loops to use iterators. This shrinks .o file (at gcc4.0.1 -O3 x86) substantially (>500 bytes). Reason still unknown.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
33e456d5f3909e0c7b96e04e5674c25a182da100 21-May-2008 Gabor Greif <ggreif@gmail.com> suppress gcc3.4.6's <no value returned> warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
76e2e4a2bc78a0ca2617e3b336081e29cb00d749 08-May-2008 Chris Lattner <sabre@nondot.org> Remove dead return. Thanks to Bill for the review!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
268e7d7a9446bb89b80472cdb7b9803f16c0191e 08-May-2008 Chris Lattner <sabre@nondot.org> Add support for constant folding the 'offsetof' pattern even if the
base is not zero. This fixes test/C++Frontend/2008-05-07-CrazyOffsetOf.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
02a260aa11a2e1b2c14335274d3c42ca3f3eabc0 20-Apr-2008 Chris Lattner <sabre@nondot.org> Switch to using Simplified ConstantFP::get API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f19f58a9360927f8ef50b9a029e8efb780d3d8a8 30-Mar-2008 Chris Lattner <sabre@nondot.org> minor code cleanups, allow constant folding sinf/cosf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
fa9b80eb64127b3d9691e18537975635520e51e9 31-Jan-2008 Dan Gohman <gohman@apple.com> Avoid unnecessarily casting away const, fixing a FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
4ee451de366474b9c228b4e5fa573795a715216d 29-Dec-2007 Chris Lattner <sabre@nondot.org> Remove attribution from file headers, per discussion on llvmdev.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
7f135cc802435171ab09ebd6a514db26a122b99a 12-Dec-2007 Chris Lattner <sabre@nondot.org> Fix a bug in my previous patch, thanks to Jay Foad for
pointing this out and correcting the patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
1afab9c1e0ae2d145ce01718aa14065393117e70 11-Dec-2007 Chris Lattner <sabre@nondot.org> Implement constant folding if vector<->vector bitcasts where the number
of source/dest elements changes. This implements
test/Transforms/InstCombine/bitcast-vector-fold.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
f286f6fd93d569befe6e77c94a947e6e04e95685 10-Dec-2007 Chris Lattner <sabre@nondot.org> Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe. While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
ecc0274a54658a4ee76d783b285a0690ad760928 23-Nov-2007 Chris Lattner <sabre@nondot.org> splice some lines together, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
514ab348fddcdffa8367685dc608b2f8d5de986d 01-Nov-2007 Duncan Sands <baldrick@free.fr> Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment. This gives a primitive type for
which getTypeSize differed from getABITypeSize. For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition). Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type. For a primitive type, this is the minimum number
of bits. For an i36 this is 36 bits. For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it). For an
i36 this is 40 bits, for an x86 long double it is 80 bits. This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes). There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment. For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS. This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes). This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize. This means that the size of an array
is the length times the getABITypeSize. It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize. Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case. So alloca's and mallocs should use getABITypeSize. Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases). I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize. I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers. If someone wants to pack these types more
tightly they can always use a packed struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
9ab7fb3ba47442d521a5bed09a27a5e8e7a786ed 02-Oct-2007 Dale Johannesen <dalej@apple.com> Rewrite sqrt and powi to use anyfloat. By popular demand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
317096ab3710fda0960be58804e9f80c800340f6 28-Sep-2007 Dale Johannesen <dalej@apple.com> Add sqrt and powi intrinsics for long double.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
43421b3dd70af5b70e71816521f37502c397cc65 06-Sep-2007 Dale Johannesen <dalej@apple.com> Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
001f7534e0311508cc93831a595785bb177f8a18 12-Aug-2007 Chris Lattner <sabre@nondot.org> constant fold ptrtoint(inttoptr) with target data when available. This allows
us to fold the entry block of PR1602 to false instead of:

br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label
%cond_true



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
a099b6c7bb574f22bc002e0b3c65c25abccca1d5 08-Aug-2007 Chris Lattner <sabre@nondot.org> Handle functions with no name better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c5f6a1f9d61d74017d90e149728cb3d283e0a0e0 08-Aug-2007 Chris Lattner <sabre@nondot.org> significantly speed up constant folding of calls (and thus all clients that use
ConstantFoldInstruction on calls) by avoiding Value::getName(). getName() constructs
and returns an std::string, which does heap allocation stuff. This slightly speeds up
instcombine.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6994040a952e5fb27605eb3cf29ed86c4e59cf62 04-Aug-2007 Chandler Carruth <chandlerc@gmail.com> This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.

This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
384152444d22d356f7b4090a158da4cbc1f79464 16-Jul-2007 Dan Gohman <gohman@apple.com> Use ConstantFoldFP for folding all unary floating-point operations which may
have an error, and refector out the code for binary operators into
ConstantFoldBinaryFP and use it for all binary floating-point operations
which may have an error. These functions still rely exclusively on errno
to detect errors though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e613555fd9184414fb586e4df3d6a4c716724c66 01-Apr-2007 Reid Spencer <rspencer@reidspencer.com> The bit counting intrinsics return i32 not the operand type. This fixes
last night's regression in SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
e9391fd9b52e93717b365bdd05c471101323a4df 01-Apr-2007 Reid Spencer <rspencer@reidspencer.com> For PR1297:
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
ca5183d445954a9b2a570d6bbba1bc2b00ad6442 05-Mar-2007 Jeff Cohen <jeffc@jolt-lang.org> Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
9d6565a5b1fbc4286d6ee638d8f47a3171a9ed7e 15-Feb-2007 Reid Spencer <rspencer@reidspencer.com> For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
309f87e34a12e3398932e4c2c9e3c47cad0e8f0f 10-Feb-2007 Chris Lattner <sabre@nondot.org> completely eliminate a temporary vector


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b1919e2f08ecb37140af676fd2916f8d5ed7df3d 10-Feb-2007 Chris Lattner <sabre@nondot.org> Privatize StructLayout::MemberOffsets, adding an accessor


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
832254e1c2387c0cbeb0a820b8315fbe85cb003a 02-Feb-2007 Reid Spencer <rspencer@reidspencer.com> Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types. This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
shl i32 %X, 1
instead of
shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
ad58eb34342f70f094008e6d08cb4ed814754e64 31-Jan-2007 Chris Lattner <sabre@nondot.org> Fix a minor bug in my patch yesterday that broken ConstProp/bswap.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
d917fe56926f2f80665fd154eb23ca41e9df6f67 31-Jan-2007 Chris Lattner <sabre@nondot.org> elimiante a temporary vector


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
03dd25ca964813c8b9fe14479443b9c21fb92c55 31-Jan-2007 Chris Lattner <sabre@nondot.org> Move some symbolic constant folding code out of instcombine into a place
it can be used by multiple clients. This specifically allows the inliner
to constant fold symbolically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5520732b24a5a321140dd79af70d321c7ff3dec9 31-Jan-2007 Chris Lattner <sabre@nondot.org> move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
72d88ae5447a3929c97e88f4c806213847b5d988 31-Jan-2007 Chris Lattner <sabre@nondot.org> adjust to constant folding api changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b5282dcf4745be59046f440980a1c0f0a50c9c09 15-Jan-2007 Chris Lattner <sabre@nondot.org> Constant fold llvm.powi.*. This speeds up tramp3d--v4 by 9.5%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
257cbf7a8dca9372882a7a98ec626897247aee6d 07-Jan-2007 Chris Lattner <sabre@nondot.org> remove llvm.isunordered


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
c5b206b6be61d0d933b98b6af5e22f42edd48ad1 31-Dec-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int -> Int32
4. [U]Long -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
and other methods related to signedness. In a few places this warranted
identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
97af751deb9b26fd42fbcee082da9ccc4ded5b45 02-Dec-2006 Jeff Cohen <jeffc@jolt-lang.org> Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
d6c3422e3126927840683574a658a0deada903f0 08-Nov-2006 Jim Laskey <jlaskey@mac.com> Remove redundant <cmath>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
b83eb6447ba155342598f0fabe1f08f5baa9164a 20-Oct-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
5cff2677a68bf7748bbc2d680b59248448a7fc89 17-Jun-2006 Chris Lattner <sabre@nondot.org> Constant fold sqrtf


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
0b118206bf3411722707f2e5cab8fd2eedcd50d6 16-Jan-2006 Reid Spencer <rspencer@reidspencer.com> For PR411:
This patch is an incremental step towards supporting a flat symbol table.
It de-overloads the intrinsic functions by providing type-specific intrinsics
and arranging for automatically upgrading from the old overloaded name to
the new non-overloaded name. Specifically:
llvm.isunordered -> llvm.isunordered.f32, llvm.isunordered.f64
llvm.sqrt -> llvm.sqrt.f32, llvm.sqrt.f64
llvm.ctpop -> llvm.ctpop.i8, llvm.ctpop.i16, llvm.ctpop.i32, llvm.ctpop.i64
llvm.ctlz -> llvm.ctlz.i8, llvm.ctlz.i16, llvm.ctlz.i32, llvm.ctlz.i64
llvm.cttz -> llvm.cttz.i8, llvm.cttz.i16, llvm.cttz.i32, llvm.cttz.i64
New code should not use the overloaded intrinsic names. Warnings will be
emitted if they are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
6fb3bd6a658940287789198d3207b0da04c0a4e6 14-Jan-2006 Nate Begeman <natebegeman@mac.com> Add bswap intrinsics as documented in the Language Reference


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp
bd9d37026a5c17d9a51371a6a5446bf4761ee7d6 27-Oct-2005 John Criswell <criswell@uiuc.edu> Move some constant folding functions into LLVMAnalysis since they are used
by Analysis and Transformation passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ConstantFolding.cpp