summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Reassociate/basictest.ll
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-171-0/+297
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-171-297/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [Reassociate] regenerate checks; NFCSanjay Patel2018-07-031-77/+115
| | | | llvm-svn: 336211
* Reassociate: add global reassociation algorithmFiona Glaser2017-12-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | This algorithm (explained more in the source code) takes into account global redundancies by building a "pair map" to find common subexprs. The primary motivation of this is to handle situations like foo = (a * b) * c bar = (a * d) * c where we currently don't identify that "a * c" is redundant. Accordingly, it prioritizes the emission of a * c so that CSE can remove the redundant calculation later. Does not change the actual reassociation algorithm -- only the order in which the reassociated operand chain is reconstructed. Gives ~1.5% floating point math instruction count reduction on a large offline suite of graphics shaders. llvm-svn: 320515
* [Reassociate] Add negated value of negative constant to the Duplicates list.Chad Rosier2017-02-231-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In OptimizeAdd, we scan the operand list to see if there are any common factors between operands that can be factored out to reduce the number of multiplies (e.g., 'A*A+A*B*C+D' -> 'A*(A+B*C)+D'). For each operand of the operand list, we only consider unique factors (which is tracked by the Duplicate set). Now if we find a factor that is a negative constant, we add the negated value as a factor as well, because we can percolate the negate out. However, we mistakenly don't add this negated constant to the Duplicates set. Consider the expression A*2*-2 + B. Obviously, nothing to factor. For the added value A*2*-2 we over count 2 as a factor without this change, which causes the assert reported in PR30256. The problem is that this code is assuming that all the multiply operands of the add are already reassociated. This change avoids the issue by making OptimizeAdd tolerate multiplies which haven't been completely optimized; this sort of works, but we're doing wasted work: we'll end up revisiting the add later anyway. Another possible approach would be to enforce RPO iteration order more strongly. If we have RedoInsts, we process them immediately in RPO order, rather than waiting until we've finished processing the whole function. Intuitively, it seems like the natural approach: reassociation works on expression trees, so the optimization only works in one direction. That said, I'm not sure how practical that is given the current Reassociate; the "optimal" form for an expression depends on its use list (see all the uses of "user_back()"), so Reassociate is really an iterative optimization of sorts, so any changes here would probably get messy. PR30256 Differential Revision: https://reviews.llvm.org/D30228 llvm-svn: 296003
* PM: Port Reassociate to the new pass managerJustin Bogner2016-04-261-0/+1
| | | | llvm-svn: 267631
* [Reassociate] Don't propogate flags when creating negationsDavid Majnemer2015-06-241-2/+6
| | | | | | | | | Reassociate mutated existing instructions in order to form negations which would create additional reassociate opportunities. This fixes PR23926. llvm-svn: 240593
* [Reassociate] Canonicalizing 'x [+-] (-Constant * y)' isn't always a winDavid Majnemer2015-05-281-2/+2
| | | | | | | | | | | | | Canonicalizing 'x [+-] (-Constant * y)' is not a win if we don't *know* we will open up CSE opportunities. If the multiply was 'nsw', then negating 'y' requires us to clear the 'nsw' flag. If this is actually worth pursuing, it is probably more appropriate to do so in GVN or EarlyCSE. This fixes PR23675. llvm-svn: 238397
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-271-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | load instruction Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
* Revert "[Reassociate] As the expression tree is rewritten make sure the ↵Chad Rosier2014-11-191-3/+3
| | | | | | | | | | | | | operands are" This reverts commit r222142. This is causing/exposing an execution-time regression in spec2006/gcc and coremark on AArch64/A57/Ofast. Conflicts: test/Transforms/Reassociate/optional-flags.ll llvm-svn: 222398
* [Reassociate] As the expression tree is rewritten make sure the operands areChad Rosier2014-11-171-3/+3
| | | | | | emitted in canonical form. llvm-svn: 222142
* [Reassociate] Canonicalize negative constants out of expressions.Chad Rosier2014-11-111-1/+1
| | | | | | | | This is a reapplication of r221171, but we only perform the transformation on expressions which include a multiplication. We do not transform rem/div operations as this doesn't appear to be safe in all cases. llvm-svn: 221721
* Revert "[Reassociate] Canonicalize negative constants out of expressions."Reid Kleckner2014-11-041-1/+1
| | | | | | | | | | | | This reverts commit r221171. It performs this invalid transformation: - %div.i = urem i64 -1, %add - %sub.i = sub i64 -2, %div.i + %div.i = urem i64 1, %add + %sub.i1 = add i64 %div.i, -2 llvm-svn: 221317
* [Reassociate] Canonicalize negative constants out of expressions.Chad Rosier2014-11-031-1/+1
| | | | | | | | | This gives CSE/GVN more options to eliminate duplicate expressions. This is a follow up patch to http://reviews.llvm.org/D4904. http://reviews.llvm.org/D5363 llvm-svn: 221171
* [Reassociate] FileCheckize and cleanup a few testcases. No functional changeChad Rosier2014-06-111-99/+102
| | | | | | intended. llvm-svn: 210685
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-15/+15
| | | | | | | | | | | | | | | | | | | | | | 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 a test for my change to disable reassociation for i1 types.Bob Wilson2010-02-061-0/+10
| | | | llvm-svn: 95465
* When factoring multiply expressions across adds, factor both Chris Lattner2010-01-011-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | positive and negative forms of constants together. This allows us to compile: int foo(int x, int y) { return (x-y) + (x-y) + (x-y); } into: _foo: ## @foo subl %esi, %edi leal (%rdi,%rdi,2), %eax ret instead of (where the 3 and -3 were not factored): _foo: imull $-3, 8(%esp), %ecx imull $3, 4(%esp), %eax addl %ecx, %eax ret this started out as: movl 12(%ebp), %ecx imull $3, 8(%ebp), %eax subl %ecx, %eax subl %ecx, %eax subl %ecx, %eax ret This comes from PR5359. llvm-svn: 92381
* test case we alredy get right.Chris Lattner2010-01-011-0/+12
| | | | llvm-svn: 92380
* reuse negates where possible instead of always creating them from scratch.Chris Lattner2009-12-311-0/+13
| | | | | | | | | | | | | | | | | | | | | This allows us to optimize test12 into: define i32 @test12(i32 %X) { %factor = mul i32 %X, -3 ; <i32> [#uses=1] %Z = add i32 %factor, 6 ; <i32> [#uses=1] ret i32 %Z } instead of: define i32 @test12(i32 %X) { %Y = sub i32 6, %X ; <i32> [#uses=1] %C = sub i32 %Y, %X ; <i32> [#uses=1] %Z = sub i32 %C, %X ; <i32> [#uses=1] ret i32 %Z } llvm-svn: 92373
* teach reassociate to factor x+x+x -> x*3. While I'm at it,Chris Lattner2009-12-311-10/+32
| | | | | | fix RemoveDeadBinaryOp to actually do something. llvm-svn: 92368
* simple fix for an incorrect factoring which causes aChris Lattner2009-12-311-0/+11
| | | | | | miscompilation, PR5458. llvm-svn: 92354
* merge some more tests in.Chris Lattner2009-12-311-0/+28
| | | | llvm-svn: 92353
* filecheckizeChris Lattner2009-12-311-4/+101
| | | | llvm-svn: 92352
* Change tests from "opt %s" to "opt < %s" so that opt doesn't see theDan Gohman2009-09-111-1/+1
| | | | | | | | 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. llvm-svn: 81537
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-081-1/+1
| | | | llvm-svn: 81257
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-081-1/+1
| | | | | | of using llvm-as, now that opt supports this. llvm-svn: 81226
* Upgrade tests to not use llvm-upgrade.Tanya Lattner2008-03-191-5/+6
| | | | llvm-svn: 48530
* Regression is gone, don't try to find it on clean target.Reid Spencer2007-01-171-0/+9
llvm-svn: 33296
OpenPOWER on IntegriCloud