summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/getelementptr.ll
Commit message (Collapse)AuthorAge
* Make gep i8* X, -(ptrtoint Y) transform work with address spacesMatt Arsenault2013-10-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191920 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Canonicalize (gep i8* X, -(ptrtoint Y)) to (sub (ptrtoint X), ↵Benjamin Kramer2013-09-20
| | | | | | | | | | (ptrtoint Y)) The GEP pattern is what SCEV expander emits for "ugly geps". The latter is what you get for pointer subtraction in C code. The rest of instcombine already knows how to deal with that so just canonicalize on that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191090 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach InstCombine about address spacesMatt Arsenault2013-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188926 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test for bitcast array ptrs with address spacesMatt Arsenault2013-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188919 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ConstantFolding about pointer address spacesMatt Arsenault2013-08-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188831 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix assert with GEP ptr vector indexing structsMatt Arsenault2013-08-19
| | | | | | | | Also fix it calculating the wrong value. The struct index is not a ConstantInt, so it was being interpreted as an array index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188713 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing test for GEP + bitcast transformationMatt Arsenault2013-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188529 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't do FoldCmpLoadFromIndexedGlobal for non inbounds GEPsMatt Arsenault2013-08-15
| | | | | | | This path wasn't tested before without a datalayout, so add some more tests and re-run with and without one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188507 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-14
| | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: FoldGEPICmp shouldn't change sign of base pointer comparisonDavid Majnemer2013-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | Changing the sign when comparing the base pointer would introduce all sorts of unexpected things like: %gep.i = getelementptr inbounds [1 x i8]* %a, i32 0, i32 0 %gep2.i = getelementptr inbounds [1 x i8]* %b, i32 0, i32 0 %cmp.i = icmp ult i8* %gep.i, %gep2.i %cmp.i1 = icmp ult [1 x i8]* %a, %b %cmp = icmp ne i1 %cmp.i, %cmp.i1 ret i1 %cmp into: %cmp.i = icmp slt [1 x i8]* %a, %b %cmp.i1 = icmp ult [1 x i8]* %a, %b %cmp = xor i1 %cmp.i, %cmp.i1 ret i1 %cmp By preserving the original sign, we now get: ret i1 false This fixes PR16483. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185259 91177308-0d34-0410-b5e6-96231b3b80d8
* Use references to attribute groups on the call/invoke instructions.Bill Wendling2013-02-22
| | | | | | | | Listing all of the attributes for the callee of a call/invoke instruction is way too much and makes the IR unreadable. Use references to attributes instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175877 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "InstCombine: Clean up weird code that talks about a modulus that's ↵Benjamin Kramer2013-01-23
| | | | | | | | | long gone." This causes crashes during the build of compiler-rt during selfhost. Add a testcase for coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173279 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a small gep optimization I noticed was missing while reading some IL.Rafael Espindola2011-07-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136585 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't duplicate the work done by a gep into a "bitcast" if the gep hasRafael Espindola2011-07-11
| | | | | | | | more than one use. Fixes PR10322. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134883 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* manually upgrade a bunch of tests to modern syntax, and remove some thatChris Lattner2011-06-17
| | | | | | | | are either unreduced or only test old syntax. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a testcase for getelementptr index promotion.Dan Gohman2010-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104944 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize target-independent folding rules for sizeof to handle moreDan Gohman2010-02-01
| | | | | | | | | | | | | | | | | | | | 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
* Teach ConstantFolding to do a better job when folding gep(bitcast).Nick Lewycky2009-11-29
| | | | | | | 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
* Autoupgrade malloc insts to malloc calls.Victor Hernandez2009-10-17
| | | | | | | | | | Update testcases that rely on malloc insts being present. Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it ↵Victor Hernandez2009-09-25
| | | | | | causes regressions in the nightly tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
* Auto-upgrade malloc instructions to malloc calls.Victor Hernandez2009-09-24
| | | | | | | | Reviewed by Devang Patel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
* Change tests from "opt %s" to "opt < %s" so that opt doesn't see theDan Gohman2009-09-11
| | | | | | | | | input filename so that opt doesn't print the input filename in the output so that grep lines in the tests don't unintentionally match strings in the input filename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword andDan Gohman2009-09-11
| | | | | | | | | | | | | | 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
* Factor out the code for checking that all indices in a getelementptr areDan Gohman2009-09-10
| | | | | | | | | | within the notional bounds of the static type of the getelementptr (which is not the same as "inbounds") from GlobalOpt into a utility routine, and use it in ConstantFold.cpp to check whether there are any mis-behaved indices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81478 91177308-0d34-0410-b5e6-96231b3b80d8
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-08
| | | | | | | of using llvm-as, now that opt supports this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
* suck a bunch more gep tests into getelementptr.ll and filecheckize them all.Chris Lattner2009-08-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80517 91177308-0d34-0410-b5e6-96231b3b80d8
* consolodate various GEP tests into getelementptr.ll using filecheck.Chris Lattner2009-08-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80514 91177308-0d34-0410-b5e6-96231b3b80d8
* convert to filecheckChris Lattner2009-08-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80510 91177308-0d34-0410-b5e6-96231b3b80d8
* Byebye llvm-upgrade!Tanya Lattner2008-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48762 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1319:Reid Spencer2007-04-15
| | | | | | | | Make use of the END. facility on all files > 1K so that we aren't wasting CPU cycles searching for RUN: lines that we'll never find. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36059 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1319:Reid Spencer2007-04-14
| | | | | | | Upgrade tests to work with new llvm.exp version of llvm_runtest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36013 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2007-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35340 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the llvm-upgrade program to upgrade llvm assembly.Reid Spencer2006-12-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32115 91177308-0d34-0410-b5e6-96231b3b80d8
* Promote GEP ubyte indices to uint. Backwards compatibility for 1.2 andReid Spencer2006-11-23
| | | | | | | | older features will be dropped soon and these test cases must not rely on the upgrade capability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31896 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2005-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21646 91177308-0d34-0410-b5e6-96231b3b80d8
* rename fnChris Lattner2005-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21540 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2005-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21539 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcase, rework testcases to fail if there are any gep's other than thoseChris Lattner2004-10-16
| | | | | | | involving %B instead of allowing any geps except %A's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17065 91177308-0d34-0410-b5e6-96231b3b80d8
* The instruction combining pass removes dead instructions, there is no needChris Lattner2004-02-28
| | | | | | | to run the die pass after it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11942 91177308-0d34-0410-b5e6-96231b3b80d8
* Renamed `as' => `llvm-as', `dis' => `llvm-dis', `link' => `llvm-link'.Misha Brukman2003-09-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8558 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove usage of grep-not scriptChris Lattner2003-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6966 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert scripts from using explicit control flow to use the new grep-not scriptChris Lattner2003-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6955 91177308-0d34-0410-b5e6-96231b3b80d8
* Add testcase for reason that typesafety of power is being brokenChris Lattner2003-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6836 91177308-0d34-0410-b5e6-96231b3b80d8
* Add testcase for new instcombine xformChris Lattner2003-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5703 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new getelementptr elimination testChris Lattner2002-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4535 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert to use long indexes instead of uintChris Lattner2002-09-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3781 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new testcase for gep instruction -> get constexpr promotionChris Lattner2002-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3364 91177308-0d34-0410-b5e6-96231b3b80d8
* These tests should not run -dce pass to cleanup instcombine.Chris Lattner2002-08-02
| | | | | | | If instcombine is making dead instructions, ALL that should be used is -die git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3221 91177308-0d34-0410-b5e6-96231b3b80d8