llvm.org GIT mirror llvm / 8cd9fe4
Merging r155809: ------------------------------------------------------------------------ r155809 | rafael | 2012-04-29 20:53:06 -0700 (Sun, 29 Apr 2012) | 2 lines Make sure HoistInsertPosition finds a position that is dominated by all inputs. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_31@155828 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 35 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
41074107 // Attempt to find an insert position in the middle of the block,
41084108 // instead of at the end, so that it can be used for other expansions.
41094109 if (IDom == Inst->getParent() &&
4110 (!BetterPos || DT.dominates(BetterPos, Inst)))
4110 (!BetterPos || !DT.dominates(Inst, BetterPos)))
41114111 BetterPos = llvm::next(BasicBlock::iterator(Inst));
41124112 }
41134113 if (!AllDominate)
0 ; RUN: opt < %s -loop-reduce -S | FileCheck %s
1
2 @d = common global i32 0, align 4
3
4 define void @fn2(i32 %x) nounwind uwtable {
5 entry:
6 br label %for.cond
7
8 for.cond:
9 %g.0 = phi i32 [ 0, %entry ], [ %dec, %for.cond ]
10 %tobool = icmp eq i32 %x, 0
11 %dec = add nsw i32 %g.0, -1
12 br i1 %tobool, label %for.cond, label %for.end
13
14 for.end:
15 ; CHECK: %tmp1 = load i32* @d, align 4
16 ; CHECK-NEXT: %tmp2 = load i32* @d, align 4
17 ; CHECK-NEXT: %0 = sub i32 %tmp1, %tmp2
18
19 %tmp1 = load i32* @d, align 4
20 %add = add nsw i32 %tmp1, %g.0
21 %tmp2 = load i32* @d, align 4
22 %tobool26 = icmp eq i32 %x, 0
23 br i1 %tobool26, label %for.end5, label %for.body.lr.ph
24
25 for.body.lr.ph:
26 %tobool3 = icmp ne i32 %tmp2, %add
27 br label %for.end5
28
29 for.end5:
30 ret void
31 }
32
33