[PATCH] D38730: X86: Fix X86CallFrameOptimization to search for the COPY StackPointer

David Kreitzer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 08:05:43 PDT 2017


DavidKreitzer added inline comments.


================
Comment at: llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp:393
 
-  while ((Classification = classifyInstruction(MBB, I, RegInfo, UsedRegs)) !=
-         Exit) {
-    if (Classification == Skip) {
-      ++I;
+  for (InstClassification Classification = Skip; Classification != Exit; ++I) {
+    // If this is the COPY of the stack pointer, it's ok to ignore.
----------------
I think there is a potential problem with this new loop structure. If the loop terminates by reaching MBB.end(), the code will attempt to advance the iterator beyond MBB.end().  Having the loop terminate by reaching MBB.end() is probably not an expected situation, but it seems like we should fix this regardless (unless I'm misunderstanding something).



Repository:
  rL LLVM

https://reviews.llvm.org/D38730





More information about the llvm-commits mailing list