From 3d8f1b2d22be79aab3d246fa5bc9c24b911b0bd2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 4 Jan 2020 11:51:50 -0500 Subject: [PATCH] AMDGPU/GlobalISel: Set insert point after waterfall loop The current users of the waterfall loop utility functions do not make use of the restored original insert point. The insertion is either done, or they set the insert point somewhere else. A future change will want to insert instructions after the waterfall loop, but figuring out the point after the loop is more difficult than ensuring the insert point is there after the loop. --- llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp index da94099..1bb01dc 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp @@ -1021,8 +1021,9 @@ bool AMDGPURegisterBankInfo::executeInWaterfallLoop( .addDef(ExecReg) .addReg(SaveExecReg); - // Restore the insert point before the original instruction. - B.setInsertPt(MBB, MBB.end()); + // Set the insert point after the original instruction, so any new + // instructions will be in the remainder. + B.setInsertPt(*RemainderBB, RemainderBB->begin()); return true; } -- 2.7.4