Skip to content
Commit 92a899f6 authored by Alex Zinenko's avatar Alex Zinenko Committed by jpienaar
Browse files

Drop all uses of the ForInst induction variable before deleting ForInst

The `for` instruction defines the loop induction variable it uses.  In the
well-formed IR, the induction variable can only be used by the body of the
`for` loop.  Existing implementation was explicitly cleaning the body of the
for loop to remove all uses of the induction variable before removing its
definition.  However, in ill-formed IR that may appear in some stages of
parsing, there may be (invalid) users of the loop induction variable outside
the loop body.  In case of unsuccessful parsing, destructor of the
ForInst-defined Value would assert because there are remaining though invalid
users of this Value.  Explicitly drop all uses of the loop induction Value when
destroying a ForInst.  It is no longer necessary to explicitly clean the body
of the loop, destructor of the block will take care of this.

PiperOrigin-RevId: 228168880
parent 3b7b0040
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment