Skip to content

Commit 14886e1

Browse files
committed
[LLVM 21] llvm::LocationSize for AliasAnalysis
1 parent 62913f1 commit 14886e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gen/passes/SimplifyDRuntimeCalls.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,16 @@ Value *ArraySliceCopyOpt::CallOptimizer(Function *Callee, CallInst *CI,
209209
Sz = (Int->getValue() * ElemSz->getValue()).getZExtValue();
210210
}
211211

212+
#if LDC_LLVM_VER >= 2100
213+
llvm::LocationSize Sz2 =
214+
(Sz == llvm::MemoryLocation::UnknownSize)
215+
? llvm::LocationSize::beforeOrAfterPointer()
216+
: llvm::LocationSize::precise(Sz);
217+
#else
218+
std::uint64_t Sz2 = Sz;
219+
#endif
212220
// Check if the pointers may alias
213-
if (AA->alias(CI->getOperand(0), Sz, CI->getOperand(2), Sz)) {
221+
if (AA->alias(CI->getOperand(0), Sz2, CI->getOperand(2), Sz2)) {
214222
return nullptr;
215223
}
216224

0 commit comments

Comments
 (0)