GBE: don't put a long live register to a selection vector.
authorZhigang Gong <zhigang.gong@intel.com>
Fri, 21 Feb 2014 02:40:08 +0000 (10:40 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Mon, 24 Feb 2014 06:57:19 +0000 (14:57 +0800)
If an element has very long interval, we don't want to put it into a
vector as it will add more pressure to the register allocation.

With this patch, it can reduce more than 20% spill registers for luxmark's
median scene benchmark(from 288 to 224).

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
backend/src/backend/gen_reg_allocation.cpp

index 4e276c3..c282b36 100644 (file)
@@ -271,9 +271,12 @@ namespace gbe
       // case 1: the register is not already in a vector, so it can stay in this
       // vector. Note that local IDs are *non-scalar* special registers but will
       // require a MOV anyway since pre-allocated in the CURBE
+      // If an element has very long interval, we don't want to put it into a
+      // vector as it will add more pressure to the register allocation.
       if (it == vectorMap.end() &&
           ctx.sel->isScalarOrBool(reg) == false &&
-          ctx.isSpecialReg(reg) == false)
+          ctx.isSpecialReg(reg) == false &&
+          (intervals[reg].maxID - intervals[reg].minID) < 2048)
       {
         const VectorLocation location = std::make_pair(vector, regID);
         this->vectorMap.insert(std::make_pair(reg, location));