On Mon, May 11, 2015 at 02:02:52PM +0800, Yang Rong wrote:
> 1. When there are a mismatch AddImm/Load, may be a indirect load, should 
> return false.
> 2. Can't remove load in REMOVE_INSN, because load's use is not empty. Force 
> remove it.
> 
> Signed-off-by: Yang Rong <[email protected]>
> ---
>  backend/src/ir/lowering.cpp | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp
> index 73b1dd2..0e36907 100644
> --- a/backend/src/ir/lowering.cpp
> +++ b/backend/src/ir/lowering.cpp
> @@ -259,11 +259,12 @@ namespace ir {
>          replaced = true;
>        }
>  
> -      if (replaced)
> +      if (replaced) {
>          dead.insert(load);
> +        load->remove();
> +      }
>      }
>  
> -    REMOVE_INSN(load)
>      REMOVE_INSN(add)
>      REMOVE_INSN(loadImm)
Actually, we have the same issue for both add and loadImm. Considering those 
instructions
will all be eliminated latter in instruction selction stage, we can live with 
it currently.

This patch LGTM will push latter.

Thanks,
Zhigang Gong

>    }
> @@ -298,6 +299,7 @@ namespace ir {
>    {
>      const FunctionArgument &arg = fn->getArg(argID);
>      LoadAddImmSeq tmpSeq;
> +    bool match = true;
>  
>      // Inspect all uses of the function argument pointer
>      const UseSet &useSet = dag->getUse(&arg);
> @@ -345,7 +347,8 @@ namespace ir {
>          if (matchLoad(insn, add, loadImm, offset, argID, loadAddImm)) {
>            tmpSeq.push_back(loadAddImm);
>            continue;
> -        }
> +        } else
> +          match = false;
>        }
>      }
>  
> @@ -353,7 +356,7 @@ namespace ir {
>      // direct load definitions we found
>      for (const auto &loadImmSeq : tmpSeq)
>        seq.push_back(loadImmSeq);
> -    return true;
> +    return match;
>    }
>  
>    ArgUse FunctionArgumentLowerer::getArgUse(uint32_t argID)
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Beignet mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to