llvm.org GIT mirror llvm / 16193ef
[MustExecute] Shwo the effect of using full loop info variant Most basic possible test for the logic used by LICM. Also contains a speculative build fix for compiles which complain about a definition of a stuct K; followed by a declaration as class K; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328058 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 2 years ago
3 changed file(s) with 13 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
3939 class DataLayout;
4040 class Loop;
4141 class LoopInfo;
42 class LoopSafetyInfo;
4342 class OptimizationRemarkEmitter;
4443 class PredicatedScalarEvolution;
4544 class PredIteratorCache;
184184 }
185185
186186 bool isMustExecuteIn(const Instruction &I, Loop *L, DominatorTree *DT) {
187 // TODO: move loop specific code to analysis
188 //LoopSafetyInfo LSI;
189 //computeLoopSafetyInfo(&LSI, L);
190 //return isGuaranteedToExecute(I, DT, L, &LSI);
191 return isGuaranteedToExecuteForEveryIteration(&I, L);
187 // TODO: merge these two routines. For the moment, we display the best
188 // result obtained by *either* implementation. This is a bit unfair since no
189 // caller actually gets the full power at the moment.
190 LoopSafetyInfo LSI;
191 computeLoopSafetyInfo(&LSI, L);
192 return isGuaranteedToExecute(I, DT, L, &LSI) ||
193 isGuaranteedToExecuteForEveryIteration(&I, L);
192194 }
193195
194196 /// \brief An assembly annotator class to print must execute information in
8787 ; FIXME: handled by loop safety info, test it
8888 define i1 @nothrow_loop(i32* noalias %p, i32 %high) {
8989 ; CHECK-LABEL: @nothrow_loop(
90 ; CHECK-LABEL: loop:
90 ; CHECK-LABEL: loop:
9191 ; CHECK: %iv = phi i32 [ 0, %entry ], [ %iv.next, %next ] ; (mustexec in: loop)
9292 ; CHECK: br label %next ; (mustexec in: loop)
93 ; CHECK-LABEL: next:
94 ; CHECK: %v = load i32, i32* %p ; (mustexec in: loop)
95 ; CHECK: %iv.next = add nuw nsw i32 %iv, 1 ; (mustexec in: loop)
96 ; CHECK: %exit.test = icmp slt i32 %iv, %high ; (mustexec in: loop)
97 ; CHECK: br i1 %exit.test, label %exit, label %loop ; (mustexec in: loop)
9398 ; CHECK-NOT: mustexec
9499
95100 entry: