[all-commits] [llvm/llvm-project] 8fbba3: [StructurizeCFG] Fix a crash caused by not updatin...

Shilei Tian via All-commits all-commits at lists.llvm.org
Wed Jan 22 19:04:06 PST 2025


  Branch: refs/heads/users/shiltian/structurizecfg-crash
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fbba30d42eb58ad17cec03b90f5c79390444ea9
      https://github.com/llvm/llvm-project/commit/8fbba30d42eb58ad17cec03b90f5c79390444ea9
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2025-01-22 (Wed, 22 Jan 2025)

  Changed paths:
    M llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
    A llvm/test/Transforms/StructurizeCFG/simple-structurizecfg-crash.ll

  Log Message:
  -----------
  [StructurizeCFG] Fix a crash caused by not updating `Predicates` properly

A very simple IR could crash the pass at `assert(BB != Parent);`.

```
define void @foo() {
entry:
  br i1 false, label %cond.true, label %cond.false

cond.true:                                        ; preds = %entry
  br label %cond.end

cond.false:                                       ; preds = %entry
  br label %cond.end

cond.end:                                         ; preds = %cond.false, %cond.true
  ret void
}
```

TBH I'm not sure if my fix is right. I don't know why we don't update
`Predicates` after we replace a conditional branch with a branch, given the one
not taken will no longer be a sucessor of the current BB. There are many test
cases need to be updated but I'd like to update them after I fix this properly.
Any help would be appreciated.



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