[PATCH] D32433: Compute safety information in a much finer granularity.

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 10:52:46 PDT 2017


sanjoy added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Scalar/LICM.cpp:482
+  // Iterate over loop instructions and compute early exit points.
+  for (Loop::block_iterator BB = CurLoop->block_begin(),
                             BBE = CurLoop->block_end();
----------------
This can be a range for over `blocks()`.


================
Comment at: llvm/trunk/lib/Transforms/Scalar/LICM.cpp:485
+       BB != BBE; ++BB) {
+    for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E;
+         ++I) {
----------------
This can be a range for also.


================
Comment at: llvm/trunk/lib/Transforms/Scalar/LICM.cpp:487
+         ++I) {
+      if (isGuaranteedToTransferExecutionToSuccessor(&*I))
+        continue;
----------------
This is subjective, but in this kind of situation, I tend to avoid early exits since you just have one line after the early exit.


================
Comment at: llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp:1049
+  // which does not execute this instruction and its not guaranteed to execute.
+  for (Instruction *ExitInst : SafetyInfo->EarlyExits)
+    if (!DT->dominates(&Inst, ExitInst))
----------------
Note: you could use `all_of` here, but this is fine too.


Repository:
  rL LLVM

https://reviews.llvm.org/D32433





More information about the llvm-commits mailing list