freedreno/ir3: allow block->predecessors to be null
authorRob Clark <robdclark@chromium.org>
Sun, 23 Feb 2020 19:52:02 +0000 (11:52 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Feb 2020 21:31:53 +0000 (21:31 +0000)
This way we can also use ir3_print from computerator, which mostly
bypasses the ir3_block construct (since it doesn't need to do
scheduling, etc)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3926>

src/freedreno/ir3/ir3_print.c

index 381319311a334f040723a23e8faf69a7264b9c55..a19b8b3629be44ff198e1f2333aea29bc357be60 100644 (file)
@@ -273,7 +273,10 @@ print_block(struct ir3_block *block, int lvl)
 {
        tab(lvl); printf("block%u {\n", block_id(block));
 
-       if (block->predecessors->entries > 0) {
+       /* computerator (ir3 assembler) doesn't really use blocks for flow
+        * control, so block->predecessors will be null.
+        */
+       if (block->predecessors && block->predecessors->entries > 0) {
                unsigned i = 0;
                tab(lvl+1);
                printf("pred: ");