llvm.org GIT mirror llvm / f8c1b77
Merging r155984: ------------------------------------------------------------------------ r155984 | void | 2012-05-02 02:59:45 -0700 (Wed, 02 May 2012) | 4 lines The value held in the vector may be RAUW'ed by some of the canonicalization methods. Use a weak value handle to keep up with this. PR12245 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_31@155985 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 53 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
558558
559559 /// EmitAddTreeOfValues - Emit a tree of add instructions, summing Ops together
560560 /// and returning the result. Insert the tree before I.
561 static Value *EmitAddTreeOfValues(Instruction *I, SmallVectorImpl &Ops){
561 static Value *EmitAddTreeOfValues(Instruction *I,
562 SmallVectorImpl &Ops){
562563 if (Ops.size() == 1) return Ops.back();
563564
564565 Value *V1 = Ops.back();
832833 // from an expression will drop a use of maxocc, and this can cause
833834 // RemoveFactorFromExpression on successive values to behave differently.
834835 Instruction *DummyInst = BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal);
835 SmallVector<Value*, 4> NewMulOps;
836 SmallVector<WeakVH, 4> NewMulOps;
836837 for (unsigned i = 0; i != Ops.size(); ++i) {
837838 // Only try to remove factors from expressions we're allowed to.
838839 BinaryOperator *BOp = dyn_cast(Ops[i].Op);
0 ; RUN: opt < %s -basicaa -inline -instcombine -reassociate -dse -disable-output
1 ; PR12245
2
3 @a = common global i32 0, align 4
4 @d = common global i32 0, align 4
5
6 define i32 @fn2() nounwind uwtable ssp {
7 entry:
8 %0 = load i32* @a, align 4, !tbaa !0
9 %dec = add nsw i32 %0, -1
10 store i32 %dec, i32* @a, align 4, !tbaa !0
11 %1 = load i32* @d, align 4, !tbaa !0
12 %sub = sub nsw i32 %dec, %1
13 store i32 %sub, i32* @d, align 4, !tbaa !0
14 %2 = load i32* @a, align 4, !tbaa !0
15 %dec1 = add nsw i32 %2, -1
16 store i32 %dec1, i32* @a, align 4, !tbaa !0
17 %3 = load i32* @d, align 4, !tbaa !0
18 %sub2 = sub nsw i32 %dec1, %3
19 store i32 %sub2, i32* @d, align 4, !tbaa !0
20 %4 = load i32* @a, align 4, !tbaa !0
21 %dec3 = add nsw i32 %4, -1
22 store i32 %dec3, i32* @a, align 4, !tbaa !0
23 %5 = load i32* @d, align 4, !tbaa !0
24 %sub4 = sub nsw i32 %dec3, %5
25 store i32 %sub4, i32* @d, align 4, !tbaa !0
26 %6 = load i32* @a, align 4, !tbaa !0
27 %dec5 = add nsw i32 %6, -1
28 store i32 %dec5, i32* @a, align 4, !tbaa !0
29 %7 = load i32* @d, align 4, !tbaa !0
30 %sub6 = sub nsw i32 %dec5, %7
31 store i32 %sub6, i32* @d, align 4, !tbaa !0
32 %8 = load i32* @a, align 4, !tbaa !0
33 %dec7 = add nsw i32 %8, -1
34 store i32 %dec7, i32* @a, align 4, !tbaa !0
35 %9 = load i32* @d, align 4, !tbaa !0
36 %sub8 = sub nsw i32 %dec7, %9
37 store i32 %sub8, i32* @d, align 4, !tbaa !0
38 ret i32 0
39 }
40
41 define i32 @fn1() nounwind uwtable ssp {
42 entry:
43 %call = call i32 @fn2()
44 ret i32 %call
45 }
46
47 !0 = metadata !{metadata !"int", metadata !1}
48 !1 = metadata !{metadata !"omnipotent char", metadata !2}
49 !2 = metadata !{metadata !"Simple C/C++ TBAA"}