[clang] [llvm] [clang] Generate nuw GEPs for struct member accesses (PR #99538)
Hari Limaye via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 07:11:17 PDT 2024
================
@@ -1902,16 +1902,18 @@ class IRBuilderBase {
}
Value *CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1,
- const Twine &Name = "") {
+ const Twine &Name = "",
+ GEPNoWrapFlags NWFlags = GEPNoWrapFlags::none()) {
Value *Idxs[] = {
ConstantInt::get(Type::getInt32Ty(Context), Idx0),
ConstantInt::get(Type::getInt32Ty(Context), Idx1)
};
- if (auto *V = Folder.FoldGEP(Ty, Ptr, Idxs, GEPNoWrapFlags::none()))
+ if (auto *V =
+ Folder.FoldGEP(Ty, Ptr, Idxs, /*IsInBounds=*/NWFlags.isInBounds()))
----------------
hazzlim wrote:
Yes, sorry about that - updated to pass the full `NWFlags` correctly (+ associated test updates).
https://github.com/llvm/llvm-project/pull/99538
More information about the llvm-commits
mailing list