}
/* branch block */
- if (block->linear_preds.size() == 1) {
+ if (block->linear_preds.size() == 1 && !(block->kind & block_kind_loop_exit)) {
/* keep variables spilled if they are alive and not used in the current block */
unsigned pred_idx = block->linear_preds[0];
for (std::pair<Temp, uint32_t> pair : ctx.spills_exit[pred_idx]) {
std::vector<aco_ptr<Instruction>> instructions;
/* branch block: TODO take other branch into consideration */
- if (block->linear_preds.size() == 1) {
+ if (block->linear_preds.size() == 1 && !(block->kind & block_kind_loop_exit)) {
assert(ctx.processed[block->linear_preds[0]]);
if (block->logical_preds.size() == 1) {