[Beignet] [PATCH] GBE: fix the overflow bug in register spilling.
Zhigang Gong
zhigang.gong at intel.com
Wed Feb 19 00:41:25 PST 2014
Change to use int32 to represent the maxID.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
backend/src/backend/gen_reg_allocation.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index 726b78c..8243f19 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -53,19 +53,16 @@ namespace gbe
};
typedef struct GenRegIntervalKey {
- GenRegIntervalKey(uint16_t reg, uint16_t maxID) {
- if (maxID == INT_MAX)
- maxID = 0xFFFF;
- GBE_ASSERT(reg <= 0xFFFF && maxID <= 0xFFFF);
- key = (maxID << 16) | reg;
+ GenRegIntervalKey(uint16_t reg, int32_t maxID) {
+ key = ((uint64_t)maxID << 16) | reg;
}
const ir::Register getReg() const {
return (ir::Register)(key & 0xFFFF);
}
- const uint16_t getMaxID() const {
+ const int32_t getMaxID() const {
return key >> 16;
}
- uint32_t key;
+ uint64_t key;
} GenRegIntervalKey;
struct spillCmp {
--
1.7.9.5
More information about the Beignet
mailing list