Hello,
I have been looking at using LazyValueInfo to improve BasicAA for some cases but have noted some issues with LVI
-
The interface (e.g. getConstantRange) seem to expect pointer-to-non-const objects which is a bit troublesome if you want to use the analysis from a place where you have pointer-to-const. Resorting to const_cast is obviously undesirable.
-
Assumption patterns of the form ‘icmp (add Val, Offset)’ (https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis/LazyValueInfo.cpp#L1097) will not make it through the assumption cache after commit https://github.com/llvm-mirror/llvm/commit/a6e44bd6350ff4aaa40b104abff1e28a9918ef87
Is this something worth fixing or does this mean that LVI is not very much used and there might even be plans to remove/replace it in the future?
-Markus
Hello,
I have been looking at using LazyValueInfo to improve BasicAA for some cases but have noted some issues with LVI
1. The interface (e.g. getConstantRange) seem to expect pointer-to-non-const objects which is a bit troublesome if you want to use the analysis from a place where you have pointer-to-const. Resorting to const_cast is obviously undesirable.
There are a number of interfaces that, for historical reasons, don't take const-qualified pointers (although they probably should). For some of these we've created wrappers to hide the const_casts (e.g., in ValueTracking).
2. Assumption patterns of the form ‘icmp <pred> (add Val, Offset)’ (https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis/LazyValueInfo.cpp#L1097) will not make it through the assumption cache after commit https://github.com/llvm-mirror/llvm/commit/a6e44bd6350ff4aaa40b104abff1e28a9918ef87
Seems like an oversight (and a lack of sufficient regressions tests). Please feel free to submit a patch to fix this.
Is this something worth fixing or does this mean that LVI is not very much used and there might even be plans to remove/replace it in the future?
LVI is still very much in use (at least in JumpThreading and CorrelatedValuePropagation). I know that some people have discussed possible rewrites over the years, but I don't know of any immediate plans.
-Hal
-Markus