[llvm] 0a321f3 - [GVN] Track visited nodes in equality propagation to avoid OOM (#212265)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 02:13:22 PDT 2026


Author: Sven van Haastregt
Date: 2026-08-05T11:13:18+02:00
New Revision: 0a321f38147fc46608f05d423afcfdeb2b144052

URL: https://github.com/llvm/llvm-project/commit/0a321f38147fc46608f05d423afcfdeb2b144052
DIFF: https://github.com/llvm/llvm-project/commit/0a321f38147fc46608f05d423afcfdeb2b144052.diff

LOG: [GVN] Track visited nodes in equality propagation to avoid OOM (#212265)

The added test ended up being out-of-memory (OOM) killed, because GVN
computed the same equality facts through exponentially many paths.

Co-authored-by: Katy Thackray <katy.thackray2 at arm.com>

Added: 
    llvm/test/Transforms/GVN/select_exponential_blowup.ll

Modified: 
    llvm/lib/Transforms/Scalar/GVN.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 42fd413423129..a698b839b7f3a 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -3092,6 +3092,7 @@ bool GVNPass::propagateEquality(
     Value *LHS, Value *RHS,
     const std::variant<BasicBlockEdge, Instruction *> &Root) {
   SmallVector<std::pair<Value*, Value*>, 4> Worklist;
+  DenseSet<std::pair<Value *, Value *>> Visited;
   Worklist.push_back(std::make_pair(LHS, RHS));
   bool Changed = false;
   SmallVector<const BasicBlock *> DominatedBlocks;
@@ -3143,6 +3144,9 @@ bool GVNPass::propagateEquality(
       }
     }
 
+    if (!Visited.insert({LHS, RHS}).second)
+      continue;
+
     // If value numbering later sees that an instruction in the scope is equal
     // to 'LHS' then ensure it will be turned into 'RHS'.  In order to preserve
     // the invariant that instructions only occur in the leader table for their

diff  --git a/llvm/test/Transforms/GVN/select_exponential_blowup.ll b/llvm/test/Transforms/GVN/select_exponential_blowup.ll
new file mode 100644
index 0000000000000..7538482f9b060
--- /dev/null
+++ b/llvm/test/Transforms/GVN/select_exponential_blowup.ll
@@ -0,0 +1,280 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -passes=gvn -S | FileCheck %s
+
+; Repeated logical-or selects used to cause GVN equality propagation to
+; rediscover the same equality facts through exponentially many paths.
+
+define void @logical_select_or_worklist_dedup(i1 %initial_cond, i1 %leaf_a, i1 %leaf_b, i1 %leaf_c, i1 %leaf_d) {
+; CHECK-LABEL: define void @logical_select_or_worklist_dedup(
+; CHECK-SAME: i1 [[INITIAL_COND:%.*]], i1 [[LEAF_A:%.*]], i1 [[LEAF_B:%.*]], i1 [[LEAF_C:%.*]], i1 [[LEAF_D:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[STAGE0_SELECT_A:%.*]] = select i1 [[INITIAL_COND]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE0_SELECT_B:%.*]] = select i1 [[INITIAL_COND]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE0_SELECT_C:%.*]] = select i1 [[INITIAL_COND]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE0_SELECT_D:%.*]] = select i1 [[INITIAL_COND]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE0_OR_AB:%.*]] = or i1 [[STAGE0_SELECT_A]], [[STAGE0_SELECT_B]]
+; CHECK-NEXT:    [[STAGE0_OR_CD:%.*]] = or i1 [[STAGE0_SELECT_C]], [[STAGE0_SELECT_D]]
+; CHECK-NEXT:    [[STAGE0_RESULT:%.*]] = or i1 [[STAGE0_OR_AB]], [[STAGE0_OR_CD]]
+; CHECK-NEXT:    [[STAGE1_SELECT_A:%.*]] = select i1 [[STAGE0_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE1_SELECT_B:%.*]] = select i1 [[STAGE0_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE1_SELECT_C:%.*]] = select i1 [[STAGE0_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE1_SELECT_D:%.*]] = select i1 [[STAGE0_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE1_OR_AB:%.*]] = or i1 [[STAGE1_SELECT_A]], [[STAGE1_SELECT_B]]
+; CHECK-NEXT:    [[STAGE1_OR_CD:%.*]] = or i1 [[STAGE1_SELECT_C]], [[STAGE1_SELECT_D]]
+; CHECK-NEXT:    [[STAGE1_RESULT:%.*]] = or i1 [[STAGE1_OR_AB]], [[STAGE1_OR_CD]]
+; CHECK-NEXT:    [[STAGE2_SELECT_A:%.*]] = select i1 [[STAGE1_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE2_SELECT_B:%.*]] = select i1 [[STAGE1_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE2_SELECT_C:%.*]] = select i1 [[STAGE1_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE2_SELECT_D:%.*]] = select i1 [[STAGE1_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE2_OR_AB:%.*]] = or i1 [[STAGE2_SELECT_A]], [[STAGE2_SELECT_B]]
+; CHECK-NEXT:    [[STAGE2_OR_CD:%.*]] = or i1 [[STAGE2_SELECT_C]], [[STAGE2_SELECT_D]]
+; CHECK-NEXT:    [[STAGE2_RESULT:%.*]] = or i1 [[STAGE2_OR_AB]], [[STAGE2_OR_CD]]
+; CHECK-NEXT:    [[STAGE3_SELECT_A:%.*]] = select i1 [[STAGE2_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE3_SELECT_B:%.*]] = select i1 [[STAGE2_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE3_SELECT_C:%.*]] = select i1 [[STAGE2_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE3_SELECT_D:%.*]] = select i1 [[STAGE2_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE3_OR_AB:%.*]] = or i1 [[STAGE3_SELECT_A]], [[STAGE3_SELECT_B]]
+; CHECK-NEXT:    [[STAGE3_OR_CD:%.*]] = or i1 [[STAGE3_SELECT_C]], [[STAGE3_SELECT_D]]
+; CHECK-NEXT:    [[STAGE3_RESULT:%.*]] = or i1 [[STAGE3_OR_AB]], [[STAGE3_OR_CD]]
+; CHECK-NEXT:    [[STAGE4_SELECT_A:%.*]] = select i1 [[STAGE3_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE4_SELECT_B:%.*]] = select i1 [[STAGE3_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE4_SELECT_C:%.*]] = select i1 [[STAGE3_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE4_SELECT_D:%.*]] = select i1 [[STAGE3_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE4_OR_AB:%.*]] = or i1 [[STAGE4_SELECT_A]], [[STAGE4_SELECT_B]]
+; CHECK-NEXT:    [[STAGE4_OR_CD:%.*]] = or i1 [[STAGE4_SELECT_C]], [[STAGE4_SELECT_D]]
+; CHECK-NEXT:    [[STAGE4_RESULT:%.*]] = or i1 [[STAGE4_OR_AB]], [[STAGE4_OR_CD]]
+; CHECK-NEXT:    [[STAGE5_SELECT_A:%.*]] = select i1 [[STAGE4_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE5_SELECT_B:%.*]] = select i1 [[STAGE4_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE5_SELECT_C:%.*]] = select i1 [[STAGE4_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE5_SELECT_D:%.*]] = select i1 [[STAGE4_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE5_OR_AB:%.*]] = or i1 [[STAGE5_SELECT_A]], [[STAGE5_SELECT_B]]
+; CHECK-NEXT:    [[STAGE5_OR_CD:%.*]] = or i1 [[STAGE5_SELECT_C]], [[STAGE5_SELECT_D]]
+; CHECK-NEXT:    [[STAGE5_RESULT:%.*]] = or i1 [[STAGE5_OR_AB]], [[STAGE5_OR_CD]]
+; CHECK-NEXT:    [[STAGE6_SELECT_A:%.*]] = select i1 [[STAGE5_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE6_SELECT_B:%.*]] = select i1 [[STAGE5_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE6_SELECT_C:%.*]] = select i1 [[STAGE5_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE6_SELECT_D:%.*]] = select i1 [[STAGE5_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE6_OR_AB:%.*]] = or i1 [[STAGE6_SELECT_A]], [[STAGE6_SELECT_B]]
+; CHECK-NEXT:    [[STAGE6_OR_CD:%.*]] = or i1 [[STAGE6_SELECT_C]], [[STAGE6_SELECT_D]]
+; CHECK-NEXT:    [[STAGE6_RESULT:%.*]] = or i1 [[STAGE6_OR_AB]], [[STAGE6_OR_CD]]
+; CHECK-NEXT:    [[STAGE7_SELECT_A:%.*]] = select i1 [[STAGE6_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE7_SELECT_B:%.*]] = select i1 [[STAGE6_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE7_SELECT_C:%.*]] = select i1 [[STAGE6_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE7_SELECT_D:%.*]] = select i1 [[STAGE6_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE7_OR_AB:%.*]] = or i1 [[STAGE7_SELECT_A]], [[STAGE7_SELECT_B]]
+; CHECK-NEXT:    [[STAGE7_OR_CD:%.*]] = or i1 [[STAGE7_SELECT_C]], [[STAGE7_SELECT_D]]
+; CHECK-NEXT:    [[STAGE7_RESULT:%.*]] = or i1 [[STAGE7_OR_AB]], [[STAGE7_OR_CD]]
+; CHECK-NEXT:    [[STAGE8_SELECT_A:%.*]] = select i1 [[STAGE7_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE8_SELECT_B:%.*]] = select i1 [[STAGE7_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE8_SELECT_C:%.*]] = select i1 [[STAGE7_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE8_SELECT_D:%.*]] = select i1 [[STAGE7_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE8_OR_AB:%.*]] = or i1 [[STAGE8_SELECT_A]], [[STAGE8_SELECT_B]]
+; CHECK-NEXT:    [[STAGE8_OR_CD:%.*]] = or i1 [[STAGE8_SELECT_C]], [[STAGE8_SELECT_D]]
+; CHECK-NEXT:    [[STAGE8_RESULT:%.*]] = or i1 [[STAGE8_OR_AB]], [[STAGE8_OR_CD]]
+; CHECK-NEXT:    [[STAGE9_SELECT_A:%.*]] = select i1 [[STAGE8_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE9_SELECT_B:%.*]] = select i1 [[STAGE8_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE9_SELECT_C:%.*]] = select i1 [[STAGE8_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE9_SELECT_D:%.*]] = select i1 [[STAGE8_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE9_OR_AB:%.*]] = or i1 [[STAGE9_SELECT_A]], [[STAGE9_SELECT_B]]
+; CHECK-NEXT:    [[STAGE9_OR_CD:%.*]] = or i1 [[STAGE9_SELECT_C]], [[STAGE9_SELECT_D]]
+; CHECK-NEXT:    [[STAGE9_RESULT:%.*]] = or i1 [[STAGE9_OR_AB]], [[STAGE9_OR_CD]]
+; CHECK-NEXT:    [[STAGE10_SELECT_A:%.*]] = select i1 [[STAGE9_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE10_SELECT_B:%.*]] = select i1 [[STAGE9_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE10_SELECT_C:%.*]] = select i1 [[STAGE9_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE10_SELECT_D:%.*]] = select i1 [[STAGE9_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE10_OR_AB:%.*]] = or i1 [[STAGE10_SELECT_A]], [[STAGE10_SELECT_B]]
+; CHECK-NEXT:    [[STAGE10_OR_CD:%.*]] = or i1 [[STAGE10_SELECT_C]], [[STAGE10_SELECT_D]]
+; CHECK-NEXT:    [[STAGE10_RESULT:%.*]] = or i1 [[STAGE10_OR_AB]], [[STAGE10_OR_CD]]
+; CHECK-NEXT:    [[STAGE11_SELECT_A:%.*]] = select i1 [[STAGE10_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE11_SELECT_B:%.*]] = select i1 [[STAGE10_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE11_SELECT_C:%.*]] = select i1 [[STAGE10_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE11_SELECT_D:%.*]] = select i1 [[STAGE10_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE11_OR_AB:%.*]] = or i1 [[STAGE11_SELECT_A]], [[STAGE11_SELECT_B]]
+; CHECK-NEXT:    [[STAGE11_OR_CD:%.*]] = or i1 [[STAGE11_SELECT_C]], [[STAGE11_SELECT_D]]
+; CHECK-NEXT:    [[STAGE11_RESULT:%.*]] = or i1 [[STAGE11_OR_AB]], [[STAGE11_OR_CD]]
+; CHECK-NEXT:    [[STAGE12_SELECT_A:%.*]] = select i1 [[STAGE11_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE12_SELECT_B:%.*]] = select i1 [[STAGE11_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE12_SELECT_C:%.*]] = select i1 [[STAGE11_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE12_SELECT_D:%.*]] = select i1 [[STAGE11_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE12_OR_AB:%.*]] = or i1 [[STAGE12_SELECT_A]], [[STAGE12_SELECT_B]]
+; CHECK-NEXT:    [[STAGE12_OR_CD:%.*]] = or i1 [[STAGE12_SELECT_C]], [[STAGE12_SELECT_D]]
+; CHECK-NEXT:    [[STAGE12_RESULT:%.*]] = or i1 [[STAGE12_OR_AB]], [[STAGE12_OR_CD]]
+; CHECK-NEXT:    [[STAGE13_SELECT_A:%.*]] = select i1 [[STAGE12_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE13_SELECT_B:%.*]] = select i1 [[STAGE12_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE13_SELECT_C:%.*]] = select i1 [[STAGE12_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE13_SELECT_D:%.*]] = select i1 [[STAGE12_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE13_OR_AB:%.*]] = or i1 [[STAGE13_SELECT_A]], [[STAGE13_SELECT_B]]
+; CHECK-NEXT:    [[STAGE13_OR_CD:%.*]] = or i1 [[STAGE13_SELECT_C]], [[STAGE13_SELECT_D]]
+; CHECK-NEXT:    [[STAGE13_RESULT:%.*]] = or i1 [[STAGE13_OR_AB]], [[STAGE13_OR_CD]]
+; CHECK-NEXT:    [[STAGE14_SELECT_A:%.*]] = select i1 [[STAGE13_RESULT]], i1 true, i1 [[LEAF_A]]
+; CHECK-NEXT:    [[STAGE14_SELECT_B:%.*]] = select i1 [[STAGE13_RESULT]], i1 true, i1 [[LEAF_B]]
+; CHECK-NEXT:    [[STAGE14_SELECT_C:%.*]] = select i1 [[STAGE13_RESULT]], i1 true, i1 [[LEAF_C]]
+; CHECK-NEXT:    [[STAGE14_SELECT_D:%.*]] = select i1 [[STAGE13_RESULT]], i1 true, i1 [[LEAF_D]]
+; CHECK-NEXT:    [[STAGE14_OR_AB:%.*]] = or i1 [[STAGE14_SELECT_A]], [[STAGE14_SELECT_B]]
+; CHECK-NEXT:    [[STAGE14_OR_CD:%.*]] = or i1 [[STAGE14_SELECT_C]], [[STAGE14_SELECT_D]]
+; CHECK-NEXT:    [[STAGE14_RESULT:%.*]] = or i1 [[STAGE14_OR_AB]], [[STAGE14_OR_CD]]
+; CHECK-NEXT:    br i1 [[STAGE14_RESULT]], label %[[TRUE_BLOCK:.*]], label %[[FALSE_BLOCK:.*]]
+; CHECK:       [[TRUE_BLOCK]]:
+; CHECK-NEXT:    ret void
+; CHECK:       [[FALSE_BLOCK]]:
+; CHECK-NEXT:    ret void
+;
+entry:
+  br label %stage0
+
+stage0:
+  %stage0_select_a = select i1 %initial_cond, i1 true, i1 %leaf_a
+  %stage0_select_b = select i1 %initial_cond, i1 true, i1 %leaf_b
+  %stage0_select_c = select i1 %initial_cond, i1 true, i1 %leaf_c
+  %stage0_select_d = select i1 %initial_cond, i1 true, i1 %leaf_d
+  %stage0_or_ab = or i1 %stage0_select_a, %stage0_select_b
+  %stage0_or_cd = or i1 %stage0_select_c, %stage0_select_d
+  %stage0_result = or i1 %stage0_or_ab, %stage0_or_cd
+  br label %stage1
+
+stage1:
+  %stage1_select_a = select i1 %stage0_result, i1 true, i1 %leaf_a
+  %stage1_select_b = select i1 %stage0_result, i1 true, i1 %leaf_b
+  %stage1_select_c = select i1 %stage0_result, i1 true, i1 %leaf_c
+  %stage1_select_d = select i1 %stage0_result, i1 true, i1 %leaf_d
+  %stage1_or_ab = or i1 %stage1_select_a, %stage1_select_b
+  %stage1_or_cd = or i1 %stage1_select_c, %stage1_select_d
+  %stage1_result = or i1 %stage1_or_ab, %stage1_or_cd
+  br label %stage2
+
+stage2:
+  %stage2_select_a = select i1 %stage1_result, i1 true, i1 %leaf_a
+  %stage2_select_b = select i1 %stage1_result, i1 true, i1 %leaf_b
+  %stage2_select_c = select i1 %stage1_result, i1 true, i1 %leaf_c
+  %stage2_select_d = select i1 %stage1_result, i1 true, i1 %leaf_d
+  %stage2_or_ab = or i1 %stage2_select_a, %stage2_select_b
+  %stage2_or_cd = or i1 %stage2_select_c, %stage2_select_d
+  %stage2_result = or i1 %stage2_or_ab, %stage2_or_cd
+  br label %stage3
+
+stage3:
+  %stage3_select_a = select i1 %stage2_result, i1 true, i1 %leaf_a
+  %stage3_select_b = select i1 %stage2_result, i1 true, i1 %leaf_b
+  %stage3_select_c = select i1 %stage2_result, i1 true, i1 %leaf_c
+  %stage3_select_d = select i1 %stage2_result, i1 true, i1 %leaf_d
+  %stage3_or_ab = or i1 %stage3_select_a, %stage3_select_b
+  %stage3_or_cd = or i1 %stage3_select_c, %stage3_select_d
+  %stage3_result = or i1 %stage3_or_ab, %stage3_or_cd
+  br label %stage4
+
+stage4:
+  %stage4_select_a = select i1 %stage3_result, i1 true, i1 %leaf_a
+  %stage4_select_b = select i1 %stage3_result, i1 true, i1 %leaf_b
+  %stage4_select_c = select i1 %stage3_result, i1 true, i1 %leaf_c
+  %stage4_select_d = select i1 %stage3_result, i1 true, i1 %leaf_d
+  %stage4_or_ab = or i1 %stage4_select_a, %stage4_select_b
+  %stage4_or_cd = or i1 %stage4_select_c, %stage4_select_d
+  %stage4_result = or i1 %stage4_or_ab, %stage4_or_cd
+  br label %stage5
+
+stage5:
+  %stage5_select_a = select i1 %stage4_result, i1 true, i1 %leaf_a
+  %stage5_select_b = select i1 %stage4_result, i1 true, i1 %leaf_b
+  %stage5_select_c = select i1 %stage4_result, i1 true, i1 %leaf_c
+  %stage5_select_d = select i1 %stage4_result, i1 true, i1 %leaf_d
+  %stage5_or_ab = or i1 %stage5_select_a, %stage5_select_b
+  %stage5_or_cd = or i1 %stage5_select_c, %stage5_select_d
+  %stage5_result = or i1 %stage5_or_ab, %stage5_or_cd
+  br label %stage6
+
+stage6:
+  %stage6_select_a = select i1 %stage5_result, i1 true, i1 %leaf_a
+  %stage6_select_b = select i1 %stage5_result, i1 true, i1 %leaf_b
+  %stage6_select_c = select i1 %stage5_result, i1 true, i1 %leaf_c
+  %stage6_select_d = select i1 %stage5_result, i1 true, i1 %leaf_d
+  %stage6_or_ab = or i1 %stage6_select_a, %stage6_select_b
+  %stage6_or_cd = or i1 %stage6_select_c, %stage6_select_d
+  %stage6_result = or i1 %stage6_or_ab, %stage6_or_cd
+  br label %stage7
+
+stage7:
+  %stage7_select_a = select i1 %stage6_result, i1 true, i1 %leaf_a
+  %stage7_select_b = select i1 %stage6_result, i1 true, i1 %leaf_b
+  %stage7_select_c = select i1 %stage6_result, i1 true, i1 %leaf_c
+  %stage7_select_d = select i1 %stage6_result, i1 true, i1 %leaf_d
+  %stage7_or_ab = or i1 %stage7_select_a, %stage7_select_b
+  %stage7_or_cd = or i1 %stage7_select_c, %stage7_select_d
+  %stage7_result = or i1 %stage7_or_ab, %stage7_or_cd
+  br label %stage8
+
+stage8:
+  %stage8_select_a = select i1 %stage7_result, i1 true, i1 %leaf_a
+  %stage8_select_b = select i1 %stage7_result, i1 true, i1 %leaf_b
+  %stage8_select_c = select i1 %stage7_result, i1 true, i1 %leaf_c
+  %stage8_select_d = select i1 %stage7_result, i1 true, i1 %leaf_d
+  %stage8_or_ab = or i1 %stage8_select_a, %stage8_select_b
+  %stage8_or_cd = or i1 %stage8_select_c, %stage8_select_d
+  %stage8_result = or i1 %stage8_or_ab, %stage8_or_cd
+  br label %stage9
+
+stage9:
+  %stage9_select_a = select i1 %stage8_result, i1 true, i1 %leaf_a
+  %stage9_select_b = select i1 %stage8_result, i1 true, i1 %leaf_b
+  %stage9_select_c = select i1 %stage8_result, i1 true, i1 %leaf_c
+  %stage9_select_d = select i1 %stage8_result, i1 true, i1 %leaf_d
+  %stage9_or_ab = or i1 %stage9_select_a, %stage9_select_b
+  %stage9_or_cd = or i1 %stage9_select_c, %stage9_select_d
+  %stage9_result = or i1 %stage9_or_ab, %stage9_or_cd
+  br label %stage10
+
+stage10:
+  %stage10_select_a = select i1 %stage9_result, i1 true, i1 %leaf_a
+  %stage10_select_b = select i1 %stage9_result, i1 true, i1 %leaf_b
+  %stage10_select_c = select i1 %stage9_result, i1 true, i1 %leaf_c
+  %stage10_select_d = select i1 %stage9_result, i1 true, i1 %leaf_d
+  %stage10_or_ab = or i1 %stage10_select_a, %stage10_select_b
+  %stage10_or_cd = or i1 %stage10_select_c, %stage10_select_d
+  %stage10_result = or i1 %stage10_or_ab, %stage10_or_cd
+  br label %stage11
+
+stage11:
+  %stage11_select_a = select i1 %stage10_result, i1 true, i1 %leaf_a
+  %stage11_select_b = select i1 %stage10_result, i1 true, i1 %leaf_b
+  %stage11_select_c = select i1 %stage10_result, i1 true, i1 %leaf_c
+  %stage11_select_d = select i1 %stage10_result, i1 true, i1 %leaf_d
+  %stage11_or_ab = or i1 %stage11_select_a, %stage11_select_b
+  %stage11_or_cd = or i1 %stage11_select_c, %stage11_select_d
+  %stage11_result = or i1 %stage11_or_ab, %stage11_or_cd
+  br label %stage12
+
+stage12:
+  %stage12_select_a = select i1 %stage11_result, i1 true, i1 %leaf_a
+  %stage12_select_b = select i1 %stage11_result, i1 true, i1 %leaf_b
+  %stage12_select_c = select i1 %stage11_result, i1 true, i1 %leaf_c
+  %stage12_select_d = select i1 %stage11_result, i1 true, i1 %leaf_d
+  %stage12_or_ab = or i1 %stage12_select_a, %stage12_select_b
+  %stage12_or_cd = or i1 %stage12_select_c, %stage12_select_d
+  %stage12_result = or i1 %stage12_or_ab, %stage12_or_cd
+  br label %stage13
+
+stage13:
+  %stage13_select_a = select i1 %stage12_result, i1 true, i1 %leaf_a
+  %stage13_select_b = select i1 %stage12_result, i1 true, i1 %leaf_b
+  %stage13_select_c = select i1 %stage12_result, i1 true, i1 %leaf_c
+  %stage13_select_d = select i1 %stage12_result, i1 true, i1 %leaf_d
+  %stage13_or_ab = or i1 %stage13_select_a, %stage13_select_b
+  %stage13_or_cd = or i1 %stage13_select_c, %stage13_select_d
+  %stage13_result = or i1 %stage13_or_ab, %stage13_or_cd
+  br label %stage14
+
+stage14:
+  %stage14_select_a = select i1 %stage13_result, i1 true, i1 %leaf_a
+  %stage14_select_b = select i1 %stage13_result, i1 true, i1 %leaf_b
+  %stage14_select_c = select i1 %stage13_result, i1 true, i1 %leaf_c
+  %stage14_select_d = select i1 %stage13_result, i1 true, i1 %leaf_d
+  %stage14_or_ab = or i1 %stage14_select_a, %stage14_select_b
+  %stage14_or_cd = or i1 %stage14_select_c, %stage14_select_d
+  %stage14_result = or i1 %stage14_or_ab, %stage14_or_cd
+  br i1 %stage14_result, label %true_block, label %false_block
+
+true_block:
+  ret void
+
+false_block:
+  ret void
+}


        


More information about the llvm-commits mailing list