[llvm] [ValueTracking] Refactor `isKnownNonEqualFromContext` (PR #127388)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 16 23:23:03 PST 2025
dtcxzyw wrote:
Case 2 (improvement):
```
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"
target triple = "x86_64-unknown-linux-gnu"
define void @_ZN3net17HpackHuffmanTable17BuildDecodeTablesERKSt6vectorINS_18HpackHuffmanSymbolESaIS2_EE(ptr %0) {
entry:
%1 = load i8, ptr %0, align 1
br label %while.cond
while.cond: ; preds = %for.body125, %while.cond, %entry
%2 = load i8, ptr %0, align 1
%cmp97.not = icmp eq i8 %2, 0
%cmp101 = icmp uge i8 %2, %1
%or.cond.not1 = select i1 %cmp97.not, i1 true, i1 %cmp101
br i1 %or.cond.not1, label %while.cond, label %for.body125
for.body125: ; preds = %for.body125, %while.cond
%cmp124.not.old = icmp eq i8 %1, %2
call void @use(i1 %cmp124.not.old)
br i1 %cmp124.not.old, label %while.cond, label %for.body125
}
declare void @use(i1)
```
With this patch, we iterate over related dominating conditions of `%2` (`%or.cond.not1`) and fold `%cmp124.not.old` into false.
https://github.com/llvm/llvm-project/pull/127388
More information about the llvm-commits
mailing list