[llvm] [C API] Add accessors for new no-wrap flags on GEP instructions (PR #97970)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 02:03:51 PDT 2024
================
@@ -767,11 +767,9 @@ struct FunCloner {
int NumIdx = LLVMGetNumIndices(Src);
for (int i = 1; i <= NumIdx; i++)
Idx.push_back(CloneValue(LLVMGetOperand(Src, i)));
- if (LLVMIsInBounds(Src))
- Dst = LLVMBuildInBoundsGEP2(Builder, ElemTy, Ptr, Idx.data(), NumIdx,
- Name);
- else
- Dst = LLVMBuildGEP2(Builder, ElemTy, Ptr, Idx.data(), NumIdx, Name);
+
+ Dst = LLVMBuildGEP2(Builder, ElemTy, Ptr, Idx.data(), NumIdx, Name);
----------------
nikic wrote:
We should add `LLVMBuildGEPWithFlags` or something instead. This build+set pattern is unsafe if the expression is constant folded.
https://github.com/llvm/llvm-project/pull/97970
More information about the llvm-commits
mailing list