[PATCH] D68956: [IndVars] Fix a miscompile in off-by-default loop predication implementation

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 06:31:56 PDT 2019


ebrevnov added inline comments.


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2804
+
+  // If we have any exits which can't be predicated themselves, than we can't
+  // predicate any exit which isn't guaranteed to execute before it.  Consider
----------------
than->then


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2825
+    if (!DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]))
+      return Changed;
+
----------------
This is not incorrect but too conservative. If for say last exit we are optimizing has index k, then it's enough to check that exit k dominates all consecutive blocks. Saying that I don't think it will make any difference in practice since back edge taken count won't be computed anyway.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D68956





More information about the llvm-commits mailing list