Mesa (master): intel/compiler: Remove unreachable() from brw_reg_type.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 30 18:12:44 UTC 2019


Module: Mesa
Branch: master
Commit: ded9fb2b18b114d311a5425916b64a12fb7ff36b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ded9fb2b18b114d311a5425916b64a12fb7ff36b

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Oct 16 12:45:55 2019 -0700

intel/compiler: Remove unreachable() from brw_reg_type.c

The EU compaction unit test fuzzes the compaction code by flipping bits.
We use a simple skip_bits() function with a list of reserved bits to
ignore, but for more complex cases like invalid combinations of register
file:type, we need either machinery to check validity or for these
functions to simply inform us whether a combination was valid.

enum brw_reg_type a 4-bit field in brw_reg, so rather than expanding it
with an "INVALID" value, just return -1 and let the caller check for
that.

Scott suggested redefining unreachable() within the unit test to
longjmp() which would allow driver code like this to still use it and
allow the test to handle expected failures like this. If that plan works
out, I plan to revert this.

---

 src/intel/compiler/brw_reg_type.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_reg_type.c b/src/intel/compiler/brw_reg_type.c
index 35555390985..6cf69051ea2 100644
--- a/src/intel/compiler/brw_reg_type.c
+++ b/src/intel/compiler/brw_reg_type.c
@@ -287,7 +287,7 @@ brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
          }
       }
    }
-   unreachable("not reached");
+   return (enum brw_reg_type)-1;
 }
 
 /**
@@ -337,7 +337,7 @@ brw_a16_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
          return i;
       }
    }
-   unreachable("not reached");
+   return (enum brw_reg_type)-1;
 }
 
 /**
@@ -357,7 +357,7 @@ brw_a1_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
          return i;
       }
    }
-   unreachable("not reached");
+   return (enum brw_reg_type)-1;
 }
 
 /**




More information about the mesa-commit mailing list