From b4a595204b4c7efc8015595f0e6eaac48119404b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 11 Mar 2024 00:23:52 -0700 Subject: [PATCH] intel/brw: Add a idom_tree::dominates(a, b) helper. Simpler to use than the existing methods. Reviewed-by: Caio Oliveira Part-of: --- src/intel/compiler/brw_cfg.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/intel/compiler/brw_cfg.h b/src/intel/compiler/brw_cfg.h index 7d0431bbbea..a5a162e40ad 100644 --- a/src/intel/compiler/brw_cfg.h +++ b/src/intel/compiler/brw_cfg.h @@ -511,6 +511,21 @@ namespace brw { bblock_t * intersect(bblock_t *b1, bblock_t *b2) const; + /** + * Returns true if block `a` dominates block `b`. + */ + bool + dominates(const bblock_t *a, const bblock_t *b) const + { + while (a != b) { + if (b->num == 0) + return false; + + b = parent(b); + } + return true; + } + void dump() const;