[PATCH] D18601: AMDGPU/SI: Optimize adjacent s_nop instructions

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 21:06:43 PDT 2016


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

Looks mostly good, just one comment.


================
Comment at: lib/Target/AMDGPU/SIShrinkInstructions.cpp:260-261
@@ +259,4 @@
+      // s_nop (N + M)
+      if (MI.getOpcode() == AMDGPU::S_NOP &&
+          NextMI.getOpcode() == AMDGPU::S_NOP) {
+        // The instruction encodes the amount to wait with an offset of 1,
----------------
I think you need to guard against the case where Next == MBB.end() - in that case, NextMI.getOpcode() (or I guess technically already the assignment to NextMI) seems to invoke undefined behavior.


http://reviews.llvm.org/D18601





More information about the llvm-commits mailing list