[llvm] [LoopPeel] LCSSA form is destroyed by LoopPeel, preserve it (PR #78696)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 02:04:20 PST 2024


================
@@ -0,0 +1,117 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -S -passes=loop-unroll < %s | FileCheck %s
+source_filename = "./reduced.ll"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @wombat() gc "statepoint-example" !prof !0 {
----------------
nikic wrote:

With `-unroll-peel-count=2`, running llvm-reduce produces this smaller test case:
```llvm

define void @wombat() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb11, %bb
  %phi = phi i32 [ 1, %bb ], [ 0, %bb11 ]
  br label %bb2

bb2:                                              ; preds = %bb11, %bb1
  %phi3 = phi i64 [ 0, %bb1 ], [ %sext, %bb11 ]
  br label %bb4

bb4:                                              ; preds = %bb9, %bb2
  %phi5 = phi i64 [ %phi3, %bb2 ], [ %sext, %bb9 ]
  %trunc = trunc i64 %phi5 to i32
  br i1 true, label %bb9, label %bb7

bb7:                                              ; preds = %bb4
  %phi8 = phi i32 [ %trunc, %bb4 ]
  ret void

bb9:                                              ; preds = %bb4
  %sext = sext i32 %phi to i64
  br i1 false, label %bb11, label %bb4

bb11:                                             ; preds = %bb9
  br i1 false, label %bb1, label %bb2
}
```

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


More information about the llvm-commits mailing list