This is enough to make existing tests pass, some with improved behaviour.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
There were few issues in SCCP tests.
- apint-load -- the result of the division operation of the original operands depends on rounding mode. it's represented as a range rather than a constant.
- apint-ipsccp4 -- we can now deduce the starting range of v1 in ssa_copy intrinsic as [-Inf, 2.999] which then gets merged with more accurate information from the function call. The original behaviour started with unknown which then gets combined with more accurate information. Thus having less information at the beginning gives a better result. changing the comparison condition check to only allow Icmp works around the issue and keeps the old behaviour.
- float-nan-simplification -- NaNs with different payloads/sign are not tracked separately, so one case returns +NaN while the other one returns -NaN. I've adjusted the comment in the test to explain the situation.
let me know what other tests you'd like me to add.
Very interesting! On a high-level, it would probably be good to split those changes into 3 (ValueLattice, LVI & SCCP); not sure how tricky that's going to be given adding automatic support in markConstant & co. If it's too tricky splitting LVI & SCCP would be great.
Also, the existing tests cover very little floating point stuff, at least for SCCP (and probably LVI too), It would be good to add FP versions of llvm/tests/Transforms/{ip-ranges-binaryops.ll, ip-ranges-casts.ll, ip-ranges-select.ll ip-constant-ranges.ll, conditions-ranges.ll, conditions-ranges-with-undef.ll} for example.
the original implementation for llvm-10 split the changes in 3 patches. I wasn't able to cleanly do this in llvm 11, since changing value lattice to represent floats as ranges breaks sccp's assumptions that range is only used for int types.
splitting it would still mean changes in the other places to avoid crashes, and include test regressions. I can take another try.
Also, the existing tests cover very little floating point stuff, at least for SCCP (and probably LVI too), It would be good to add FP versions of llvm/tests/Transforms/{ip-ranges-binaryops.ll, ip-ranges-casts.ll, ip-ranges-select.ll ip-constant-ranges.ll, conditions-ranges.ll, conditions-ranges-with-undef.ll} for example.
thanks. I'll add those and update.
I think there are outstanding comments and/or a rebase is needed. Marking as changes requested to clear up review queue.