[PATCH] D110245: [ConstantFolding] Fold ptrtoint(gep i8 null, x) -> x
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 23 02:33:07 PDT 2021
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
LG
================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:1371-1373
+ // for the invalid inbounds case. Using the integer value is safer
+ // than unconditionally returning zero for inbounds since e.g. Clang
+ // will emit an inbounds GEP on null for hand-written offsetof().
----------------
I don't think matters what is "safer", that mentioned code is UB, and UBSan will catch it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110245/new/
https://reviews.llvm.org/D110245
More information about the llvm-commits
mailing list