Switch to the LLVMBuildGEPWithNoWrapFlags API
This API allows us to set the nuw flag as well.
This commit is contained in:
parent
3b022d8cee
commit
5e9d8a7d55
3 changed files with 36 additions and 12 deletions
|
@ -1767,6 +1767,24 @@ extern "C" LLVMValueRef LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS,
|
|||
return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS), unwrap(RHS)));
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_LT(19, 0)
|
||||
enum {
|
||||
LLVMGEPFlagInBounds = (1 << 0),
|
||||
LLVMGEPFlagNUSW = (1 << 1),
|
||||
LLVMGEPFlagNUW = (1 << 2),
|
||||
};
|
||||
extern "C" LLVMValueRef
|
||||
LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef Pointer, LLVMValueRef *Indices,
|
||||
unsigned NumIndices, const char *Name,
|
||||
unsigned NoWrapFlags) {
|
||||
if (NoWrapFlags & LLVMGEPFlagInBounds)
|
||||
return LLVMBuildInBoundsGEP2(B, Ty, Pointer, Indices, NumIndices, Name);
|
||||
else
|
||||
return LLVMBuildGEP2(B, Ty, Pointer, Indices, NumIndices, Name);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Transfers ownership of DiagnosticHandler unique_ptr to the caller.
|
||||
extern "C" DiagnosticHandler *
|
||||
LLVMRustContextGetDiagnosticHandler(LLVMContextRef C) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue