[PATCH] Teach ScalarEvolution to use !range metadata.
hfinkel at anl.gov
hfinkel at anl.gov
Thu Oct 9 17:03:32 PDT 2014
Also, looking at this patch made me think: We don't handle range metadata in LazyValueInfo, do we? And we don't seem to, and I think your GetRangeFromMetadata will be useful for both cases. You might consider making it a general utility function somewhere.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:3561
@@ +3560,3 @@
+ Optional<ConstantRange> MDRange = GetRangeFromMetadata(U->getValue());
+ if (MDRange.hasValue()) {
+ return setUnsignedRange(S, MDRange.getValue());
----------------
You don't need {} here.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:3562
@@ +3561,3 @@
+ if (MDRange.hasValue()) {
+ return setUnsignedRange(S, MDRange.getValue());
+ }
----------------
More importantly, don't return here. ValueTracking might be able to refine the range even more, and we want the range information to be additive.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:3718
@@ +3717,3 @@
+ Optional<ConstantRange> MDRange = GetRangeFromMetadata(U->getValue());
+ if (MDRange.hasValue()) {
+ return setSignedRange(S, MDRange.getValue());
----------------
Same comments apply here.
http://reviews.llvm.org/D5638
More information about the llvm-commits
mailing list