[Beignet] [PATCH] GBE: We need use exiting block here.
Ruiling Song
ruiling.song at intel.com
Wed Feb 11 00:38:33 PST 2015
According to the API explanation, we should use exiting block instead of
latch block. llvm 3.6 place an assert on this.
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
backend/src/llvm/llvm_unroll.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/backend/src/llvm/llvm_unroll.cpp b/backend/src/llvm/llvm_unroll.cpp
index f0ad4b4..38bfa3e 100644
--- a/backend/src/llvm/llvm_unroll.cpp
+++ b/backend/src/llvm/llvm_unroll.cpp
@@ -177,19 +177,19 @@ namespace gbe {
bool handleParentLoops(Loop *L, LPPassManager &LPM) {
Loop *currL = L;
ScalarEvolution *SE = &getAnalysis<ScalarEvolution>();
- BasicBlock *latchBlock = currL->getLoopLatch();
+ BasicBlock *ExitBlock = currL->getExitingBlock();
unsigned currTripCount = 0;
bool shouldUnroll = true;
- if (latchBlock)
- currTripCount = SE->getSmallConstantTripCount(L, latchBlock);
+ if (ExitBlock)
+ currTripCount = SE->getSmallConstantTripCount(L, ExitBlock);
while(currL) {
Loop *parentL = currL->getParentLoop();
unsigned parentTripCount = 0;
if (parentL) {
- BasicBlock *parentLatchBlock = parentL->getLoopLatch();
- if (parentLatchBlock)
- parentTripCount = SE->getSmallConstantTripCount(parentL, parentLatchBlock);
+ BasicBlock *parentExitBlock = parentL->getExitingBlock();
+ if (parentExitBlock)
+ parentTripCount = SE->getSmallConstantTripCount(parentL, parentExitBlock);
}
if ((parentTripCount != 0 && currTripCount / parentTripCount > 16) ||
(currTripCount > 32)) {
--
1.7.10.4
More information about the Beignet
mailing list