[PATCH] D21210: AMDGPU: Fix verifier errors in SILowerControlFlow

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 03:58:30 PDT 2016


nhaehnle added a subscriber: nhaehnle.
nhaehnle added a comment.

LGTM.


================
Comment at: lib/Target/AMDGPU/SILowerControlFlow.cpp:458-463
@@ -413,8 +457,8 @@
+  MachineBasicBlock *RemainderBB = MF.CreateMachineBasicBlock();
+  MachineFunction::iterator MBBI(MBB);
+  MF.insert(MBBI, LoopBB);
+  MF.insert(MBBI, RemainderBB);
 
-    if (Offset) {
-      BuildMI(MBB, &MI, DL, TII->get(AMDGPU::S_ADD_I32), AMDGPU::M0)
-              .addReg(AMDGPU::M0)
-              .addImm(Offset);
-    }
-    // Do the actual move
-    MBB.insert(I, MovRel);
+  LoopBB->moveAfter(&MBB);
+  RemainderBB->moveAfter(LoopBB);
+  LoopBB->addSuccessor(LoopBB);
----------------
I believe this can be simplified by incrementing MBBI before doing the insert.


http://reviews.llvm.org/D21210





More information about the llvm-commits mailing list