Basic wrapping arithmetic on pointers is pessimized compared to integers #135798
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider these two very simple functions:
I would expect these to generate identical codegen. Here we are treating a pointer as an ordinary number, with
wrapping_sub
. But we actually see a pessimization in the codegen for the pointer version:I think this has something to do with provenance. Consider the following two modified examples:
foo_expose_ptr
is efficient likefoo_int
, butfoo_map_addr_ptr
is pessimized likefoo_ptr
. I think this is a bug, provenance should not pessimize basic wrapping integer arithmetic, even if it occurs on pointers.The text was updated successfully, but these errors were encountered: