aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2023-12-31 13:50:25 +0000
committerFlorian Hahn <flo@fhahn.com>2023-12-31 13:50:25 +0000
commitf248d5eed1ef49947c882c3c30d49ef061c12936 (patch)
treef6142ba5f204840e2a631b7b831ff61827285158 /llvm/lib/Transforms/Utils/Local.cpp
parentb46638dc76d35681fbbddc2fd17ef4cde6b057e3 (diff)
downloadllvm-f248d5eed1ef49947c882c3c30d49ef061c12936.zip
llvm-f248d5eed1ef49947c882c3c30d49ef061c12936.tar.gz
llvm-f248d5eed1ef49947c882c3c30d49ef061c12936.tar.bz2
[Local] Bring back check for FP types in getExpressionForConstant.
The check makes sure that the result for getZExtValue is guaranteed to fit into 64 bit.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index e08c5f0..c76cc9d 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -3593,7 +3593,8 @@ DIExpression *llvm::getExpressionForConstant(DIBuilder &DIB, const Constant &C,
if (isa<ConstantInt>(C))
return createIntegerExpression(C);
- if (auto *FP = dyn_cast<ConstantFP>(&C)) {
+ auto *FP = dyn_cast<ConstantFP>(&C);
+ if (FP && (Ty.isFloatTy() || Ty.isDoubleTy())) {
const APFloat &APF = FP->getValueAPF();
return DIB.createConstantValueExpression(
APF.bitcastToAPInt().getZExtValue());