[all-commits] [llvm/llvm-project] a87fbe: [ValueTracking] Don't use CondContext in dataflow ...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed Jul 24 07:33:27 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a87fbeb3a77a53ded341277c5b326f7696d47594
      https://github.com/llvm/llvm-project/commit/a87fbeb3a77a53ded341277c5b326f7696d47594
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2024-07-24 (Wed, 24 Jul 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/SimplifyQuery.h
    M llvm/lib/Analysis/ValueTracking.cpp
    A llvm/test/Transforms/InstCombine/pr100298.ll

  Log Message:
  -----------
  [ValueTracking] Don't use CondContext in dataflow analysis of phi nodes (#100316)

See the following case:
```
define i16 @pr100298() {
entry:
  br label %for.inc

for.inc:
  %indvar = phi i32 [ -15, %entry ], [ %mask, %for.inc ]
  %add = add nsw i32 %indvar, 9
  %mask = and i32 %add, 65535
  %cmp1 = icmp ugt i32 %mask, 5
  br i1 %cmp1, label %for.inc, label %for.end

for.end:
  %conv = trunc i32 %add to i16
  %cmp2 = icmp ugt i32 %mask, 3
  %shl = shl nuw i16 %conv, 14
  %res = select i1 %cmp2, i16 %conv, i16 %shl
  ret i16 %res
}
```

When computing knownbits of `%shl` with `%cmp2=false`, we cannot use
this condition in the analysis of `%mask (%for.inc -> %for.inc)`.

Fixes https://github.com/llvm/llvm-project/issues/100298.

(cherry picked from commit 59eae919c938f890e9b9b4be8a3fa3cb1b11ed89)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list