<div dir="auto">Range metadata can be set on load and call of integer types in IR. I can hit significantly better codegen if the IR has range annotations on variables.<div dir="auto"><br></div><div dir="auto">My first attempt used llvm.assume, but this doesn't appear to influence range metatdata or scalar evolution.</div><div dir="auto"><br></div><div dir="auto">The code I'm working with is written in C++, compiled via clang. I'd like the authors to annotate the range on variables. Intrinsics, existing or bespoke, would be fine. Ideally the method would work on variables, but failing that annotating loads would still help.</div><div dir="auto"><br></div><div dir="auto">I tried routing the count via alloca/store/load, with metadata on the load, but this is eliminated before reaching my pass. If I force matters, the trip via the stack thwarts scalar evolution anyway. Similarly a call that is eliminated later blocks scalar evolution.</div><div dir="auto"><br></div><div dir="auto">I'm reasonably confident that an intrinsic that lowers to a load instruction will work but haven't cut the code yet. It wouldn't be as general as an int (*)(int) intrinsic either.</div><div dir="auto"><br></div><div dir="auto">How should I approach this?</div><div dir="auto"><br></div><div dir="auto">Thanks!</div><div dir="auto"><br></div><div dir="auto">Jon</div><div dir="auto"><br></div><div dir="auto"><br></div></div>