[llvm-branch-commits] [llvm] [GVN] Simple GVN-based hoisting of scalars: precommit tests (NFC) (PR #210336)

Antonio Frighetto via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 17 09:49:09 PDT 2026


================
@@ -0,0 +1,155 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S --passes=gvn --gvn-max-num-insns=3 %s -o - | FileCheck %s --check-prefix=MAX-DEPTH3
+; RUN: opt -S --passes=gvn --gvn-max-num-insns=4 %s -o - | FileCheck %s --check-prefix=MAX-DEPTH4
+; RUN: opt -S --passes=gvn --gvn-max-num-insns=5 %s -o - | FileCheck %s --check-prefix=MAX-DEPTH5
+
+; Check effect of limiting the how deep in a block we look for
+; instructions to hoist; At max depth 3 we shouldn't hoist
+; anything to the `entry` block, at max depth 4 we should hoist
+; the first `add` and at max depth 5 the second `add`.
+
+; In any case we shouldn't hoist the `and` and the `icmp`, in order
+; to not separate them from the `br`
+
+define i32 @f(i1 %c, i32 %a, i32 %b, i32 %d) {
----------------
antoniofrighetto wrote:

```suggestion
define i32 @test_hoist_limit(i1 %c, i32 %a, i32 %b, i32 %d) {
```

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


More information about the llvm-branch-commits mailing list