diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-05 14:16:17 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:46:11 +0000 |
commit | d781ede639f2289ccf0889dd138169e1194b656b (patch) | |
tree | fb34a940b224dca9f5e7bdb8eb503e6acbd22b0f /contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp | |
parent | d56accc7c3dcc897489b6a07834763a03b9f3d68 (diff) | |
parent | 1ff3a73c1ece7a0a4b7a8457eb4d5c47334b1526 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp b/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp index 7cf69f613c66..f6b955162fa5 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp @@ -589,14 +589,17 @@ Constant *FoldReinterpretLoadFromConst(Constant *C, Type *LoadTy, if (BytesLoaded > 32 || BytesLoaded == 0) return nullptr; - int64_t InitializerSize = DL.getTypeAllocSize(C->getType()).getFixedSize(); - // If we're not accessing anything in this constant, the result is undefined. if (Offset <= -1 * static_cast<int64_t>(BytesLoaded)) return UndefValue::get(IntType); + // TODO: We should be able to support scalable types. + TypeSize InitializerSize = DL.getTypeAllocSize(C->getType()); + if (InitializerSize.isScalable()) + return nullptr; + // If we're not accessing anything in this constant, the result is undefined. - if (Offset >= InitializerSize) + if (Offset >= (int64_t)InitializerSize.getFixedValue()) return UndefValue::get(IntType); unsigned char RawBytes[32] = {0}; |