[all-commits] [llvm/llvm-project] b7e08b: [SCEV] Fix ScalarEvolution::getBackedgeTakenInfo w...

Thurston Dang via All-commits all-commits at lists.llvm.org
Thu Jun 4 09:33:32 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7e08b6467d554c73997b6eb6b7a2bdec51c444e
      https://github.com/llvm/llvm-project/commit/b7e08b6467d554c73997b6eb6b7a2bdec51c444e
  Author: Thurston Dang <thurston at google.com>
  Date:   2026-06-04 (Thu, 04 Jun 2026)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    A llvm/test/Transforms/IndVarSimplify/issue195176.ll

  Log Message:
  -----------
  [SCEV] Fix ScalarEvolution::getBackedgeTakenInfo when L not found (#201502)

By the end of ScalarEvolution::getBackEdgeTakenInfo():
```
  ...
  BackedgeTakenInfo Result = computeBackedgeTakenCount(L);

  if (Result.hasAnyInfo()) {
    // Invalidate any expression using an addrec in this loop.
    ...
  }

  return BackedgeTakenCounts.find(L)->second = std::move(Result);
```
BackedgeTakenCounts may no longer contain an entry for L, resulting in a
crash (https://github.com/llvm/llvm-project/issues/195176). This patch
fixes the issue by inserting the entry if it does not exist (and
otherwise keeping the same behavior).

This adds a regression test (crash on opt 19.1.0 onwards e.g.,
https://godbolt.org/z/Wq3n3rEqT), metarenamed from
https://github.com/dtcxzyw/llvm-autoreduce/issues/106, which in turn was
derived from https://github.com/llvm/llvm-project/issues/195176.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list