[Beignet] [PATCH] Fix utest compiler_function_argument3 error after move -O2 to backend.
Yang Rong
rong.r.yang at intel.com
Mon Dec 30 23:20:52 PST 2013
After move optimize from clang to backend, some pass is removed, and some pass using diff parameters,
will trigger the bug in build pushmap, cause compiler_function_argument3 fail.
There maybe one loadImm/add instruction used by different loads, in set seq. So should not add to pushmap
if the same argID/offset already added, also can't delete loadImm/add instruction again if have been deleted.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/ir/lowering.cpp | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp
index 23dd120..49b6e06 100644
--- a/backend/src/ir/lowering.cpp
+++ b/backend/src/ir/lowering.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright © 2012 Intel Corporation
*
* This library is free software; you can redistribute it and/or
@@ -205,7 +205,7 @@ namespace ir {
break; \
} \
} \
- if (isDead) { \
+ if (isDead && !dead.contains(WHICH)) { \
dead.insert(WHICH); \
WHICH->remove(); \
} \
@@ -231,16 +231,18 @@ namespace ir {
const uint32_t size = getFamilySize(family);
const uint32_t offset = loadAddImm.offset + valueID * size;
const PushLocation argLocation(*fn, loadAddImm.argID, offset);
- if (inserted.contains(argLocation))
- continue;
Register pushed;
const Register reg = load->getValue(valueID);
if (offset != 0) {
+ if(inserted.contains(argLocation)) {
+ pushed = argLocation.getRegister();
+ } else {
pushed = fn->newRegister(family);
this->appendPushedConstant(pushed, argLocation);
inserted.insert(argLocation);
+ }
} else {
- pushed = fn->getArg(loadAddImm.argID).reg;
+ pushed = fn->getArg(loadAddImm.argID).reg;
}
// TODO the MOV instruction can be most of the time avoided if the
@@ -253,7 +255,6 @@ namespace ir {
}
}
- // Remove all unused adds and load immediates
REMOVE_INSN(add)
REMOVE_INSN(loadImm)
}
--
1.8.1.2
More information about the Beignet
mailing list