[llvm] [ShrinkWrap] Modify shrink wrapping to accommodate functions terminated by no-return blocks (PR #167548)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 29 02:14:42 PST 2025


asb wrote:

Here's a minimised test case:
```llvm
; ModuleID = 'reduced.ll'
source_filename = "reduced.ll"
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"

declare void @widget()

declare i64 @baz()

define void @snork(ptr %arg, i1 %arg1) {
bb:
  br i1 %arg1, label %bb3, label %bb2

bb2:                                              ; preds = %bb
  ret void

bb3:                                              ; preds = %bb
  %call = call i64 @baz()
  %icmp = icmp eq i64 %call, 0
  br i1 %icmp, label %bb4, label %bb5

bb4:                                              ; preds = %bb3
  store volatile ptr %arg, ptr null, align 8
  call void @widget()
  unreachable

bb5:                                              ; preds = %bb3
  call void @widget()
  unreachable
}
```

https://github.com/llvm/llvm-project/pull/167548


More information about the llvm-commits mailing list