Skip to content
Branch: master
Find file History
marsupial and lgritz Fix `exit` not being recognized as basic block end (#1051)
Stale assignment elision was broken in the presence of `exit`.

In general

    a = 10;
    ... stuff not involving `a`...
    a = 20;

sees two assignments within the same basic block, and because `a` is not used between the two assignments, the first one can be eliminated.

But this optimization ("stale assignment elision") was wrong for this modified code:

    a = 10;
    return;  // note: `return` in the main shader body is the same as `exit()`
    a = 20;

because the `return` changes things -- the second assignment won't be executed, and therefore should not retroactively eliminate the earlier assignment. The correct final value of a is indeed 10.

The problem boiled down to a bug in OSOProcessorBase::find_basic_blocks, where the `exit` op was simply not recognized as terminating its basic block (since it is a jump).
Latest commit 5ee8f86 Aug 15, 2019
You can’t perform that action at this time.