[PATCH] D71383: [LoopGuard] Instructions in loop preheader and loop exit must be safe to execute speculatively.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 15:45:37 PST 2019


Meinersbur added inline comments.


================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:402-405
+  // If the loop preheader or loop exit block contain instructions which are not
+  // guaranteed to transfer execution to successors (e.g. instructions that
+  // throw), then loop guard doesn't guarantee the execution of the loop it is
+  // guarding.
----------------
This applies to the preheader, but if an instruction throws in `ExitFromLatch`, the loop has been executed.

I am not arguing that `ExitFromLatch` should allow side-effect instructions, but we should correctly justify why not.


================
Comment at: llvm/unittests/Analysis/LoopInfoTest.cpp:1414
+
+        // No loop guard becuase loop preheader contains instructions not safe
+	//to execute speculatively.
----------------
[typo] "becuase"


================
Comment at: llvm/unittests/Analysis/LoopInfoTest.cpp:1415
+        // No loop guard becuase loop preheader contains instructions not safe
+	//to execute speculatively.
+        EXPECT_EQ(L->getLoopGuardBranch(), nullptr);
----------------
[style] indention


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71383/new/

https://reviews.llvm.org/D71383





More information about the llvm-commits mailing list