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

Author: Alyssa Rosenzweig <aly...@rosenzweig.io>
Date:   Mon Nov  6 17:06:06 2023 -0400

nir/validate: Use unlikely for validate_assert

No apparent performance difference, but documents the intention.

Signed-off-by: Alyssa Rosenzweig <aly...@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstr...@collabora.com>
Reviewed-by: Rhys Perry <pendingchao...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26084>

---

 src/compiler/nir/nir_validate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 0193a6c0ca8..b113b2f5234 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -112,7 +112,7 @@ static bool
 validate_assert_impl(validate_state *state, bool cond, const char *str,
                      const char *file, unsigned line)
 {
-   if (!cond)
+   if (unlikely(!cond))
       log_error(state, str, file, line);
    return cond;
 }

Reply via email to