[PATCH] D140933: [LVI] Look through negations when evaluating conditions
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 01:40:20 PST 2023
nikic requested changes to this revision.
nikic added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1207
+ return inverse(NV->second);
+ }
+
----------------
Hm, I don't think this is correct if N is and and/or, or generally in any case where the returned lattice value does not represent the condition exactly, but is a superset. Inversion would exclude that difference between the exact set and superset. I'd suggest adding a test case for some case where getValueFromCondition() performs an approximation.
Could we instead flip isTrueDest, i.e. do something like this at the top?
```
Value *N;
if (match(Cond, m_Not(m_Value(N)))) {
isTrueDest = !isTrueDest;
Cond = N;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140933/new/
https://reviews.llvm.org/D140933
More information about the llvm-commits
mailing list