[all-commits] [llvm/llvm-project] fdd584: [LoopFlatten] Replace unchecked dyn_cast with cast.

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Jun 7 08:25:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fdd5843572c02bea2ac4d537a09b32e633994a8a
      https://github.com/llvm/llvm-project/commit/fdd5843572c02bea2ac4d537a09b32e633994a8a
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopFlatten.cpp

  Log Message:
  -----------
  [LoopFlatten] Replace unchecked dyn_cast with cast.

Spotted while reading through the code.

Reviewed By: SjoerdMeijer

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


  Commit: d73684e22334f1411abb02e4fb16c18f723a96a2
      https://github.com/llvm/llvm-project/commit/d73684e22334f1411abb02e4fb16c18f723a96a2
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopFlatten.cpp
    M llvm/test/Transforms/LoopFlatten/widen-iv.ll

  Log Message:
  -----------
  [LoopFlatten] Fix crash if the inner loop trip count comes from a sext instruction.

If we look through a truncate in matchLinearIVUser, it's possible
we find a sext/zext instruction that didn't come from widening.
This will fail the MatchedItCount->getType() == InnerInductionPHI->getType()
assertion.

Fix this by checking that we did not look through a truncate already.

Reviewed By: SjoerdMeijer

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


Compare: https://github.com/llvm/llvm-project/compare/0c66deb498e6...d73684e22334


More information about the All-commits mailing list