llvm-project
34a61e35 - [IRBuilder] Use ptrtoaddr in CreatePtrDiff() (#181855)

Commit
63 days ago
[IRBuilder] Use ptrtoaddr in CreatePtrDiff() (#181855) Make CreatePtrDiff() emit the pattern `ptrtoaddr(p1)-ptrtoaddr(p2)`. This makes a few changes: * The return type is now the address type instead of hardcoded to i64. I've adjusted callers to deal with this where they didn't already. * Don't use `ConstantExpr::getSizeOf()` and instead get the actual size from DataLayout. These sizeof expressions will be removed as part of the ptradd migration. * Add a convenience overload without the element type, for the case where you want a pure pointer difference. I also adjusted some OpenMP code to consistently use zext for sizes, as I had issues updating the test coverage otherwise (as we ended up randomly picking zext or sext depending on the exact code path).
Author
Parents
Loading