mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[PATCH] Force LoopReroll to reset the loop trip count value after reroll.
It's a bug fix. For rerolled loops SE trip count remains unchanged. It leads to incorrect work of the next passes. My patch just resets SE info for rerolled loop forcing SE to re-evaluate it next time it requested. I also added a verifier call in the exisitng test to be sure no invalid SE data remain. Without my fix this test would fail with -verify-scev. Differential Revision: http://reviews.llvm.org/D18316 llvm-svn: 264051
This commit is contained in:
parent
21a35dfebb
commit
490efbdf4e
@ -1551,14 +1551,12 @@ bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
"] Loop %" << Header->getName() << " (" <<
|
||||
L->getNumBlocks() << " block(s))\n");
|
||||
|
||||
bool Changed = false;
|
||||
|
||||
// For now, we'll handle only single BB loops.
|
||||
if (L->getNumBlocks() > 1)
|
||||
return Changed;
|
||||
return false;
|
||||
|
||||
if (!SE->hasLoopInvariantBackedgeTakenCount(L))
|
||||
return Changed;
|
||||
return false;
|
||||
|
||||
const SCEV *LIBETC = SE->getBackedgeTakenCount(L);
|
||||
const SCEV *IterCount = SE->getAddExpr(LIBETC, SE->getOne(LIBETC->getType()));
|
||||
@ -1572,11 +1570,12 @@ bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
|
||||
if (PossibleIVs.empty()) {
|
||||
DEBUG(dbgs() << "LRR: No possible IVs found\n");
|
||||
return Changed;
|
||||
return false;
|
||||
}
|
||||
|
||||
ReductionTracker Reductions;
|
||||
collectPossibleReductions(L, Reductions);
|
||||
bool Changed = false;
|
||||
|
||||
// For each possible IV, collect the associated possible set of 'root' nodes
|
||||
// (i+1, i+2, etc.).
|
||||
@ -1587,5 +1586,9 @@ bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Trip count of L has changed so SE must be re-evaluated.
|
||||
if (Changed)
|
||||
SE->forgetLoop(L);
|
||||
|
||||
return Changed;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: opt < %s -loop-reroll -S | FileCheck %s
|
||||
; RUN: opt < %s -loop-reroll -verify-scev -S | FileCheck %s
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user