llvm.org GIT mirror llvm / f331316
make GVN try to rename inputs to the resultant replaced values, which cleans up the generated code a bit. This should have the added benefit of not randomly renaming functions/globals like my previous patch did. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61023 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
9 changed file(s) with 18 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
10391039 // Perform PHI construction.
10401040 Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true);
10411041 LI->replaceAllUsesWith(v);
1042
1043 if (!isa(v))
1044 v->takeName(LI);
10421045 if (isa(v->getType()))
10431046 MD->invalidateCachedPointerInfo(v);
10441047 toErase.push_back(LI);
11341137 // Perform PHI construction.
11351138 Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true);
11361139 LI->replaceAllUsesWith(v);
1137 v->takeName(LI);
1140 if (!isa(v))
1141 v->takeName(LI);
11381142 if (isa(v->getType()))
11391143 MD->invalidateCachedPointerInfo(v);
11401144 toErase.push_back(LI);
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {tmp17625 =}
1 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {tmp17631 =}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp17625 = phi i32. }
1 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp17631.* = phi i32. }
22
33 @last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=1]
44
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {tmp298316 =}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp298316 = phi i32 }
11
22 %struct..0anon = type { i32 }
33 %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep tmp51.rle
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp47 = phi i32 }
11
22 %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
33 @debug = external constant i32 ; [#uses=0]
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep DEAD
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep load | count 2
11
22 define i32 @main(i32** %p) {
33 block1:
1313 br label %block4
1414
1515 block4:
16 %DEAD = load i32** %p
17 %c = load i32* %DEAD
18 ret i32 %c
16 %c = load i32** %p
17 %d = load i32* %c
18 ret i32 %d
1919 }
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {DEAD.rle = phi i32}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {DEAD = phi i32 }
11 ; XFAIL: *
22
33 ; FIXME: GVN should eliminate the fully redundant %9 GEP which
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {DEAD =}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%DEAD = phi i32. }
11
22 define i32 @main(i32** %p) {
33 block1:
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%cv.rle = phi i32}
1 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%bv.rle = phi i32}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%cv = phi i32}
1 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%bv = phi i32}
22 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
33 target triple = "i386-apple-darwin7"
44
None ; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {DEAD =}
0 ; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {DEAD = phi i32 }
11
22 define i32 @main(i32* %p) {
33 block1: