@@ -1175,16 +1175,21 @@ bool PurgeTemps(const IRWriter &in, IRWriter &out, const IROptions &opts) {
1175
1175
case IRTEMP_LR_VALUE:
1176
1176
case IRTEMP_LR_MASK:
1177
1177
case IRTEMP_LR_SHIFT:
1178
- // Unlike other registers, these don't need to persist between blocks.
1179
- // So we consider them not read unless proven read.
1180
- lastWrittenTo[dest] = i;
1181
- // If this is a copy, we might be able to optimize out the copy.
1182
- if (inst.op == IROp::Mov) {
1183
- Check check (dest, i, false );
1184
- check.srcReg = inst.src1 ;
1185
- checks.push_back (check);
1178
+ // Check that it's not a barrier instruction (like CallReplacement). Don't want to even consider optimizing those.
1179
+ if (!(inst.m .flags & IRFLAG_BARRIER)) {
1180
+ // Unlike other registers, these don't need to persist between blocks.
1181
+ // So we consider them not read unless proven read.
1182
+ lastWrittenTo[dest] = i;
1183
+ // If this is a copy, we might be able to optimize out the copy.
1184
+ if (inst.op == IROp::Mov) {
1185
+ Check check (dest, i, false );
1186
+ check.srcReg = inst.src1 ;
1187
+ checks.push_back (check);
1188
+ } else {
1189
+ checks.push_back (Check (dest, i, false ));
1190
+ }
1186
1191
} else {
1187
- checks. push_back ( Check ( dest, i, false )) ;
1192
+ lastWrittenTo[ dest] = i ;
1188
1193
}
1189
1194
break ;
1190
1195
0 commit comments