diff options
author | Florian Hahn <flo@fhahn.com> | 2023-12-31 13:42:46 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2023-12-31 13:42:47 +0000 |
commit | b46638dc76d35681fbbddc2fd17ef4cde6b057e3 (patch) | |
tree | ea0f2019dc92172be8afa61e139088bb2d8ed970 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 1228becf7df28c68579f2b9b390b74aa41149a0a (diff) | |
download | llvm-b46638dc76d35681fbbddc2fd17ef4cde6b057e3.zip llvm-b46638dc76d35681fbbddc2fd17ef4cde6b057e3.tar.gz llvm-b46638dc76d35681fbbddc2fd17ef4cde6b057e3.tar.bz2 |
[Local] Handle undef FP constant in getExpressionForConstant.
Check for FP constant instead of checking for floating point types, as
Undef/Poison values can have floating point types while not being
FPConstants.
This fixes a crash introduced by #66745 (f3b20cb).
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index a758fb3..e08c5f0 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -3593,8 +3593,8 @@ 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(); + if (auto *FP = dyn_cast<ConstantFP>(&C)) { + const APFloat &APF = FP->getValueAPF(); return DIB.createConstantValueExpression( APF.bitcastToAPInt().getZExtValue()); } |