Skip to content

Commit db7197f

Browse files
committed
Correct comment and add missing bounds check for OPTCopyLoad
1 parent 6653fa5 commit db7197f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • Packages/blueamulet.udonsharpoptimizer/Editor/Optimizations

Packages/blueamulet.udonsharpoptimizer/Editor/Optimizations/OPTCopyLoad.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public bool Enabled()
1313

1414
public void ProcessInstruction(Optimizer optimizer, List<AssemblyInstruction> instrs, int i)
1515
{
16-
// Remove Copy: Copy + JumpIf
17-
if (instrs[i] is CopyInstruction cInst && instrs[i + 1] is PushInstruction pInst)
16+
// Remove Copy: Copy + Push
17+
if (instrs[i] is CopyInstruction cInst && i < instrs.Count - 1 && instrs[i + 1] is PushInstruction pInst)
1818
{
1919
if (Optimizer.IsPrivate(cInst.TargetValue) && cInst.TargetValue.UniqueID == pInst.PushValue.UniqueID && !optimizer.HasJump(pInst) && !optimizer.ReadScan(n => n == i + 1, cInst.TargetValue))
2020
{

0 commit comments

Comments
 (0)