1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

34 Commits

Author SHA1 Message Date
Stephen Lin
cf082ae903 Update Transforms tests to use CHECK-LABEL for easier debugging. No 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
2013-07-14 01:42:54 +00:00
Bill Wendling
db672f1bc8 Use references to attribute groups on the call/invoke instructions.
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.

llvm-svn: 175877
2013-02-22 09:09:42 +00:00
Dmitri Gribenko
fa45287455 Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID
This is done to avoid odd test failures, like the one fixed in r171243.

My previous regex was not good enough to find these.

llvm-svn: 171343
2013-01-01 13:57:25 +00:00
James Molloy
de926c367f Add a new attribute, 'noduplicate'. If a function contains a noduplicate call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call.
Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage).

llvm-svn: 170704
2012-12-20 16:04:27 +00:00
Owen Anderson
788b93febd Remove dead option from tests.
llvm-svn: 113855
2010-09-14 21:03:40 +00:00
Owen Anderson
3ab91d56b4 Add a test for the duplicated-conditional situation illutrated by PR5652.
llvm-svn: 112621
2010-08-31 18:49:12 +00:00
Owen Anderson
e4af4b10f1 Add a micro-test for the transforms I added to JumpThreading.
I have not been able to find a way to test each in isolation, for a few reasons:
1) The ability to look-through non-i1 BinaryOperator's requires the ability to look through non-constant
   ICmps in order for it to ever trigger.
2) The ability to do LVI-powered PHI value determination only matters in cases that ProcessBranchOnPHI
   can't handle.  Since it already handles all the cases without other instructions in the def-use chain
   between the PHI and the branch, it requires the ability to look through ICmps and/or BinaryOperators
   as well.

llvm-svn: 112611
2010-08-31 17:59:07 +00:00
Owen Anderson
35ff7a208e Use LVI to eliminate conditional branches where we've tested a related condition previously. Update tests for this change.
This fixes PR5652.

llvm-svn: 112270
2010-08-27 17:12:29 +00:00
Chris Lattner
21bbaf49d5 1) Use the new SimplifyInstructionsInBlock routine instead of the copy
in JT.

2) When cloning blocks for PHI or xor conditions, use
instsimplify to simplify the code as we go.  This allows us to 
squish common cases early in JT which opens up opportunities for
subsequent iterations, and allows it to completely simplify the
testcase.

llvm-svn: 93253
2010-01-12 20:41:47 +00:00
Chris Lattner
774e3967ad Teach jump threading to duplicate small blocks when the branch
condition is a xor with a phi node.  This eliminates nonsense
like this from 176.gcc in several places:

 LBB166_84:
        testl   %eax, %eax
-       setne   %al
-       xorb    %cl, %al
-       notb    %al
-       testb   $1, %al
-       je      LBB166_85
+       je      LBB166_69
+       jmp     LBB166_85

This is rdar://7391699

llvm-svn: 93221
2010-01-12 02:07:17 +00:00
Gabor Greif
15afbc8fa9 typo
llvm-svn: 86980
2009-11-12 09:44:17 +00:00
Chris Lattner
01fddcec53 use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046.  This also gets us 360 more
jump threads on 176.gcc.

llvm-svn: 86953
2009-11-12 05:24:05 +00:00
Chris Lattner
b976027c91 should not commit when distracted.
llvm-svn: 86929
2009-11-12 02:04:17 +00:00
Chris Lattner
32bb09e867 We now thread some impossible condition information with LVI.
llvm-svn: 86927
2009-11-12 01:55:20 +00:00
Chris Lattner
68f3b53ddc with the new code we can thread non-instruction values. This
allows us to handle the test10 testcase.

llvm-svn: 86924
2009-11-12 01:41:34 +00:00
Chris Lattner
46056d81aa move some stuff into DEBUG's and turn on lazy-value-info for
the basic.ll testcase.

llvm-svn: 86918
2009-11-12 01:22:16 +00:00
Chris Lattner
47b6f3432e oops, didn't mean to commit this, no harm, but add a todoops, didn't mean to commit this, no harm, but add a todoo
llvm-svn: 86768
2009-11-11 00:27:54 +00:00
Chris Lattner
6c04051d2a Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.

llvm-svn: 86767
2009-11-11 00:22:30 +00:00
Chris Lattner
f66a81aecd implement a TODO by teaching jump threading about "xor x, 1".
llvm-svn: 86739
2009-11-10 22:39:16 +00:00
Chris Lattner
fca84b3dff Make jump threading eliminate blocks that just contain phi nodes,
debug intrinsics, and an unconditional branch when possible.  This
reuses the TryToSimplifyUncondBranchFromEmptyBlock function split
out of simplifycfg.

llvm-svn: 86722
2009-11-10 21:40:01 +00:00
Chris Lattner
f3fc70a936 make jump threading recursively simplify expressions instead of doing it
just one level deep.  On the testcase we go from getting this:

F1:                                               ; preds = %T2
  %F = and i1 true, %cond                         ; <i1> [#uses=1]
  br i1 %F, label %X, label %Y

to a fully threaded:

F1:                                               ; preds = %T2
  br label %Y


This changes gets us to the point where we're forming (too many) switch 
instructions on doug's strswitch testcase.

llvm-svn: 86646
2009-11-10 01:57:31 +00:00
Chris Lattner
3482ad7de0 reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fix
(making pred factoring only happen if threading is guaranteed
to be successful).

This now survives an X86-64 bootstrap of llvm-gcc.

llvm-svn: 86355
2009-11-07 08:05:03 +00:00
Devang Patel
84b2af870e Revert following patches to fix llvmgcc bootstrap.
86289, 86278, 86270, 86267, 86266 & 86264
Chris, please take a look.

llvm-svn: 86321
2009-11-07 01:32:59 +00:00
Chris Lattner
b688868418 Extend jump threading to support much more general threading
predicates.  This allows us to jump thread things like:

_ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit119:
  %tmp1.i24166 = phi i8 [ 1, %bb5.i117 ], [ %tmp1.i24165, %_Z....exit ], [ %tmp1.i24165, %bb4.i114 ] 
  %toBoolnot.i87 = icmp eq i8 %tmp1.i24166, 0     ; <i1> [#uses=1]
  %tmp4.i90 = icmp eq i32 %tmp2.i, 6              ; <i1> [#uses=1]
  %or.cond173 = and i1 %toBoolnot.i87, %tmp4.i90  ; <i1> [#uses=1]
  br i1 %or.cond173, label %bb4.i96, label %_ZN12...

Where it is "obvious" that when coming from %bb5.i117 that the 'and' is always 
false.  This triggers a surprisingly high number of times in the testsuite, 
and gets us closer to generating good code for doug's strswitch testcase.

This also make a bunch of other code in jump threading redundant, I'll rip
out in the next patch.  This survived an enable-checking llvm-gcc bootstrap.

llvm-svn: 86264
2009-11-06 18:15:14 +00:00
Chris Lattner
8ae883b5f0 when folding duplicate conditions, delete the
now-probably-dead instruction tree feeding it.

llvm-svn: 83778
2009-10-11 18:39:58 +00:00
Chris Lattner
1832a32b78 implement a transformation in jump threading that is currently
done by condprop, but do it in a much more general form.  The
basic idea is that we can do a limited form of tail duplication
in the case when we have a branch on a phi.  Moving the branch
up in to the predecessor block makes instruction selection
much easier and encourages chained jump threadings.

llvm-svn: 83759
2009-10-11 07:24:57 +00:00
Chris Lattner
525c0272aa make jump threading on a phi with undef inputs happen.
llvm-svn: 83754
2009-10-11 04:18:15 +00:00
Chris Lattner
dedd4ca17b merge two tests.
llvm-svn: 83751
2009-10-11 03:55:30 +00:00
Chris Lattner
3acb62d9ea simplify some run lines, convert a test to filecheck.
llvm-svn: 83750
2009-10-11 03:54:21 +00:00
Dan Gohman
205b641954 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
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
2009-09-11 18:01:28 +00:00
Dan Gohman
c95df8b6d8 Use opt -S instead of piping bitcode output through llvm-dis.
llvm-svn: 81257
2009-09-08 22:34:10 +00:00
Dan Gohman
8d84372836 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.

llvm-svn: 81226
2009-09-08 16:50:01 +00:00
Chris Lattner
f00b2f3fb4 Teach jump threading some more simple tricks:
1) have it fold "br undef", which does occur with
   surprising frequency as jump threading iterates.
2) teach j-t to delete dead blocks.  This removes the successor
   edges, reducing the in-edges of other blocks, allowing 
   recursive simplification.
3) Fold things like:
     br COND, BBX, BBY
  BBX:
     br COND, BBZ, BBW

   which also happens because jump threading iterates.

llvm-svn: 60470
2008-12-03 07:48:08 +00:00
Chris Lattner
4638234905 add a basic testcase.
llvm-svn: 50093
2008-04-22 06:35:14 +00:00