[all-commits] [llvm/llvm-project] 9bfa5a: [LoopPred] Fix two subtle issues found by inspection

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Nov 6 14:04:49 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bfa5ab3d1982a7cef60ee00b935f4ddc89fc98e
      https://github.com/llvm/llvm-project/commit/9bfa5ab3d1982a7cef60ee00b935f4ddc89fc98e
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2019-11-06 (Wed, 06 Nov 2019)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

  Log Message:
  -----------
  [LoopPred] Fix two subtle issues found by inspection

This patch fixes two issues noticed by inspection when going to enable the loop predication code in IndVarSimplify.

Issue 1 - Both the LoopPredication transform, and the already on by default optimizeLoopExits transform, modify the exit count of the exits they modify. (either to 0 or Infinity) Looking at the code more closely, this was not reflected into SCEV and we were instead running later transforms with incorrect SCEVs. Fixing this requires forgetting the loop, weakening a too strong assert, and updating SCEV to not pessimize results when a loop is provable untaken. I haven't been able to find a test case to demonstrate the miscompile.

Issue 2 - For modules without a data layout, we can end up with unsized pointer typed exit counts. Just bail out of this case.

I think these are the last two issues which need addressed before we enable this by default. The code has already survived a decent amount of fuzzing without revealing either of the above.

Differential Revision: https://reviews.llvm.org/D69695




More information about the All-commits mailing list