diff --git a/gnu/llvm/llvm/lib/CodeGen/SafeStack.cpp b/gnu/llvm/llvm/lib/CodeGen/SafeStack.cpp index 1c109a1f9fe..33ffd94e4f8 100644 --- a/gnu/llvm/llvm/lib/CodeGen/SafeStack.cpp +++ b/gnu/llvm/llvm/lib/CodeGen/SafeStack.cpp @@ -176,6 +176,8 @@ class SafeStack { bool IsMemIntrinsicSafe(const MemIntrinsic *MI, const Use &U, const Value *AllocaPtr, uint64_t AllocaSize); + bool IsAccessSafe(Value *Addr, TypeSize Size, const Value *AllocaPtr, + uint64_t AllocaSize); bool IsAccessSafe(Value *Addr, uint64_t Size, const Value *AllocaPtr, uint64_t AllocaSize); @@ -206,6 +208,16 @@ uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) { return Size; } +bool SafeStack::IsAccessSafe(Value *Addr, TypeSize AccessSize, + const Value *AllocaPtr, uint64_t AllocaSize) { + if (AccessSize.isScalable()) { + // In case we don't know the size at compile time we cannot verify if the + // access is safe. + return false; + } + return IsAccessSafe(Addr, AccessSize.getFixedValue(), AllocaPtr, AllocaSize); +} + bool SafeStack::IsAccessSafe(Value *Addr, uint64_t AccessSize, const Value *AllocaPtr, uint64_t AllocaSize) { const SCEV *AddrExpr = SE.getSCEV(Addr);