diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2024-01-03 18:04:11 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-19 21:24:24 +0000 |
| commit | 0c85e2760f6b5016c16d29f8c2f63f3ba2cf5298 (patch) | |
| tree | d6c9033fa7ca2f632ddc81d371ef3faf921652db /contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp | |
| parent | 92d4d6f1f60e5d9cb2c7e0dd5d632987e54741e8 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp index a758fb306982..c76cc9db16d7 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/Local.cpp @@ -3593,8 +3593,9 @@ DIExpression *llvm::getExpressionForConstant(DIBuilder &DIB, const Constant &C, if (isa<ConstantInt>(C)) return createIntegerExpression(C); - if (Ty.isFloatTy() || Ty.isDoubleTy()) { - const APFloat &APF = cast<ConstantFP>(&C)->getValueAPF(); + auto *FP = dyn_cast<ConstantFP>(&C); + if (FP && (Ty.isFloatTy() || Ty.isDoubleTy())) { + const APFloat &APF = FP->getValueAPF(); return DIB.createConstantValueExpression( APF.bitcastToAPInt().getZExtValue()); } |
