summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ConstProp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a bug around truncating vector in const prop.Jiangning Liu2014-08-211-0/+9
| | | | | | In constant folding stage, "TRUNC" can't handle vector data type. llvm-svn: 216149
* Look through addrspacecast in IsConstantOffsetFromGlobalMatt Arsenault2014-07-141-0/+13
| | | | llvm-svn: 213000
* Teach the constant folder to look through bitcast constant expressionsChandler Carruth2014-05-151-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | much more effectively when trying to constant fold a load of a constant. Previously, we only handled bitcasts by trying to find a totally generic byte representation of the constant and use that. Now, we look through the bitcast to see what constant we might fold the load into, and then try to form a constant expression cast of the found value that would be equivalent to loading the value. You might wonder why on earth this actually matters. Well, turns out that the Itanium ABI causes us to create a single array for a vtable where the first elements are virtual base offsets, followed by the virtual function pointers. Because the array is homogenous the element type is consistently i8* and we inttoptr the virtual base offsets into the initial elements. Then constructors bitcast these pointers to i64 pointers prior to loading them. Boom, no more constant folding of virtual base offsets. This is the first fix to LLVM to address the *insane* performance Eric Niebler discovered with Clang on his range comprehensions[1]. There is more to come though, this doesn't *really* fix the problem fully. [1]: http://ericniebler.com/2014/04/27/range-comprehensions/ llvm-svn: 208856
* Teach ConstantFolding about pointer address spacesMatt Arsenault2013-08-201-3/+17
| | | | llvm-svn: 188831
* [tests] Cleanup initialization of test suffixes.Daniel Dunbar2013-08-161-1/+0
| | | | | | | | | | | | | | | | | - Instead of setting the suffixes in a bunch of places, just set one master list in the top-level config. We now only modify the suffix list in a few suites that have one particular unique suffix (.ml, .mc, .yaml, .td, .py). - Aside from removing the need for a bunch of lit.local.cfg files, this enables 4 tests that were inadvertently being skipped (one in Transforms/BranchFolding, a .s file each in DebugInfo/AArch64 and CodeGen/PowerPC, and one in CodeGen/SI which is now failing and has been XFAILED). - This commit also fixes a bunch of config files to use config.root instead of older copy-pasted code. llvm-svn: 188513
* Catch more CHECK that can be converted to CHECK-LABEL in Transforms for ↵Stephen Lin2013-07-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | easier debugging. No functionality change. This conversion was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)define\([^@]*\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3define\4@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done llvm-svn: 186269
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-147-70/+70
| | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done llvm-svn: 186268
* Add newlines at end of test files, no functionality changeStephen Lin2013-07-131-1/+1
| | | | llvm-svn: 186263
* Remove this testcase until I can figure out how to properly conditionalize it.Owen Anderson2013-02-071-43/+0
| | | | llvm-svn: 174591
* Another attempt at getting the XFAIL line right for this test.Owen Anderson2013-02-071-1/+1
| | | | llvm-svn: 174588
* Fix CMake detection of various cmath functions, and XFAIL the test on ↵Owen Anderson2013-02-071-0/+1
| | | | | | platforms that are known to be missing them. llvm-svn: 174564
* Signficantly generalize our ability to constant fold floating point ↵Owen Anderson2013-02-061-0/+42
| | | | | | intrinsics, including ones on half types. llvm-svn: 174555
* ConstantFolding: Add a missing folding that leads to a miscompile.Benjamin Kramer2013-01-241-1/+1
| | | | | | | | | | We use constant folding to see if an intrinsic evaluates to the same value as a constant that we know. If we don't take the undefinedness into account we get a value that doesn't match the actual implementation, and miscompiled code. This was uncovered by Chandler's simplifycfg changes. llvm-svn: 173356
* llvm/ConstantFolding.cpp: Make ReadDataFromGlobal() and ↵NAKAMURA Takumi2012-11-081-32/+100
| | | | | | FoldReinterpretLoadFromConstPtr() Big-endian-aware. llvm-svn: 167595
* Fix the remaining TCL-style quotes found in the testsuite. This isChandler Carruth2012-07-022-2/+2
| | | | | | | | | | | | | | | | | another mechanical change accomplished though the power of terrible Perl scripts. I have manually switched some "s to 's to make escaping simpler. While I started this to fix tests that aren't run in all configurations, the massive number of tests is due to a really frustrating fragility of our testing infrastructure: things like 'grep -v', 'not grep', and 'expected failures' can mask broken tests all too easily. Essentially, I'm deeply disturbed that I can change the testsuite so radically without causing any change in results for most platforms. =/ llvm-svn: 159547
* Convert all tests using TCL-style quoting to use shell-style quoting.Chandler Carruth2012-07-026-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | This was done through the aid of a terrible Perl creation. I will not paste any of the horrors here. Suffice to say, it require multiple staged rounds of replacements, state carried between, and a few nested-construct-parsing hacks that I'm not proud of. It happens, by luck, to be able to deal with all the TCL-quoting patterns in evidence in the LLVM test suite. If anyone is maintaining large out-of-tree test trees, feel free to poke me and I'll send you the steps I used to convert things, as well as answer any painful questions etc. IRC works best for this type of thing I find. Once converted, switch the LLVM lit config to use ShTests the same as Clang. In addition to being able to delete large amounts of Python code from 'lit', this will also simplify the entire test suite and some of lit's architecture. Finally, the test suite runs 33% faster on Linux now. ;] For my 16-hardware-thread (2x 4-core xeon e5520): 36s -> 24s llvm-svn: 159525
* Replace all instances of dg.exp file with lit.local.cfg, since all tests are ↵Eli Bendersky2012-02-162-3/+1
| | | | | | | | run with LIT now and now Dejagnu. dg.exp is no longer needed. Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches. llvm-svn: 150664
* Add r149110 back with a fix for when the vector and the int have the sameRafael Espindola2012-01-271-0/+11
| | | | | | width. llvm-svn: 149151
* Revert r149110 and add a testcase that was crashing since that revision.Rafael Espindola2012-01-271-11/+0
| | | | | | | Unfortunately I also had to disable constant-pool-sharing.ll the code it tests has been updated to use the IL logic. llvm-svn: 149148
* enhance constant folding to be able to constant fold bitcast of Chris Lattner2012-01-271-0/+11
| | | | | | ConstantVector's to integer type. llvm-svn: 149110
* Manually upgrade the test suite to specify the flag to cttz and ctlz.Chandler Carruth2011-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | I followed three heuristics for deciding whether to set 'true' or 'false': - Everything target independent got 'true' as that is the expected common output of the GCC builtins. - If the target arch only has one way of implementing this operation, set the flag in the way that exercises the most of codegen. For most architectures this is also the likely path from a GCC builtin, with 'true' being set. It will (eventually) require lowering away that difference, and then lowering to the architecture's operation. - Otherwise, set the flag differently dependending on which target operation should be tested. Let me know if anyone has any issue with this pattern or would like specific tests of another form. This should allow the x86 codegen to just iteratively improve as I teach the backend how to differentiate between the two forms, and everything else should remain exactly the same. llvm-svn: 146370
* Add support for constant folding the pow intrinsic.Chad Rosier2011-12-031-0/+9
| | | | | | rdar://10514247 llvm-svn: 145730
* Prevent library calls from being folded if -fno-builtin has been specified.Chad Rosier2011-12-011-0/+79
| | | | | | rdar://10500969 llvm-svn: 145639
* Correctly byte-swap APInts with bit-widths greater than 64.Richard Smith2011-11-231-1/+17
| | | | llvm-svn: 145111
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-093-37/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
* implement PR9315, constant folding exp2 in terms of pow (since hosts withoutChris Lattner2011-05-221-1/+6
| | | | | | C99 runtimes don't have exp2). llvm-svn: 131872
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-154-4/+4
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel2011-03-271-8/+33
| | | | | | identical to the smul.with.overflow() code. llvm-svn: 128379
* When loading from a constant, fold inttoptr if the integer type and the ↵Anders Carlsson2011-02-061-0/+17
| | | | | | resulting pointer type both have the same size. llvm-svn: 124987
* Add the select optimization recently added to instcombine to constant folding.Nick Lewycky2011-01-291-0/+9
| | | | | | | This is the one where one of the branches of the select is another select on the same condition. llvm-svn: 124547
* Add a constant folding of casts from zero to zero. Fixes PR9011!Nick Lewycky2011-01-211-0/+35
| | | | | | | | While here, I'd like to complain about how vector is not an aggregate type according to llvm::Type::isAggregateType(), but they're listed under aggregate types in the LangRef and zero vectors are stored as ConstantAggregateZero. llvm-svn: 123956
* Teach constant folding to perform conversions from constant floatingChandler Carruth2011-01-111-0/+33
| | | | | | | | 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
* FileCheck-ize a test, and move a no-longer calling test case to anotherChandler Carruth2011-01-112-19/+21
| | | | | | file and make it actually test something... llvm-svn: 123205
* test/Transforms/ConstProp/logicaltest.ll: FileCheck-ize.NAKAMURA Takumi2010-12-291-2/+2
| | | | llvm-svn: 122620
* Teach ConstantFoldInstruction() how to fold insertvalue and extractvalue.Frits van Bommel2010-11-292-0/+136
| | | | llvm-svn: 120316
* rename test.Chris Lattner2010-11-141-0/+0
| | | | llvm-svn: 119033
* filecheckize, remove an old and useless testChris Lattner2010-11-142-4/+4
| | | | llvm-svn: 119032
* this test is pretty pointless and "propogation" isn't a word (or so Misha ↵Chris Lattner2010-11-141-19/+0
| | | | | | claims). llvm-svn: 119031
* fix a bug I introduced, no idea how this didn't repro right.Chris Lattner2010-10-141-2/+1
| | | | llvm-svn: 116462
* hack to unbreak buildbotsChris Lattner2010-10-141-1/+2
| | | | llvm-svn: 116461
* add uadd_ov/usub_ov to apint, consolidate constant foldingChris Lattner2010-10-141-0/+11
| | | | | | | | | 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
* remove some noise from tests.Chris Lattner2010-09-021-2/+2
| | | | llvm-svn: 112889
* fix PR6197 - infinite recursion in ipsccp due to block addressesChris Lattner2010-02-011-0/+12
| | | | | | evaluateICmpRelation wasn't handling blockaddress. llvm-svn: 94993
* Fix a crasher trying to fold each element in a comparison between two vectorsNick Lewycky2010-01-211-1/+8
| | | | | | | | | | if one of the vectors didn't have elements (such as undef). Fixes PR 6096. Fix an issue in the constant folder where fcmp (<2 x %ty>, <2 x %ty>) would have <2 x i1> type if constant folding was successful and i1 type if it wasn't. This exposed a related issue in the bitcode reader. llvm-svn: 94069
* fix PR5978 by peeling the loop so that we avoid shifting theChris Lattner2010-01-081-0/+10
| | | | | | | result int by 8 for the first byte. While normally harmless, if the result is smaller than a byte, this shift is invalid. llvm-svn: 93018
* Fix PR5551 by not ignoring the top level constantexpr whenChris Lattner2009-12-041-0/+9
| | | | | | folding a load from constant. llvm-svn: 90545
* Convert a few tests to FileCheck for PR5307.Edward O'Callaghan2009-10-261-2/+5
| | | | llvm-svn: 85171
* fix PR5287, a serious regression from my previous patches. Thanks toChris Lattner2009-10-241-24/+38
| | | | | | Duncan for the nice tiny testcase. llvm-svn: 84992
* teach libanalysis to simplify vector loads with bitcast sources. ThisChris Lattner2009-10-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 84942
* enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32 Chris Lattner2009-10-231-0/+11
| | | | | | bytes (i256). llvm-svn: 84941
OpenPOWER on IntegriCloud