[llvm] [ConstraintSys] Solve sub-system with variables needed for query (NFC) (PR #210432)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 05:58:50 PDT 2026


================
@@ -616,7 +616,8 @@ define i4 @ptr_N_signed_positive_assume(ptr %src, ptr %lower, ptr %upper, i16 %N
 ; CHECK-NEXT:    [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]]
 ; CHECK-NEXT:    [[CMP_STEP_START:%.*]] = icmp slt ptr [[SRC_STEP]], [[LOWER]]
 ; CHECK-NEXT:    [[CMP_STEP_END:%.*]] = icmp sge ptr [[SRC_STEP]], [[UPPER]]
-; CHECK-NEXT:    br i1 true, label [[TRAP_BB]], label [[EXIT]]
+; CHECK-NEXT:    [[OR_CHECK:%.*]] = or i1 [[CMP_STEP_START]], [[CMP_STEP_END]]
----------------
fhahn wrote:

I suppose strictly speaking it is not purely NFC. The reason for that is that we now fail to fold branches in code that we earlier proved to be unreachable.

In this particular case, we simplified the only branch condition leading to the block to false

I tried to summarize the reasoning in the PR description (also slightly edited the wording)

> Note that we will now stop to simplify conditions in code we proved dead/unreachable earlier; before, unrelated constraints in the system that form contradictions would allow proving any unrelated fact. After pruning, unrelated facts will no longer contribute.

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


More information about the llvm-commits mailing list