[llvm] 17d27d9 - [IR] Simplify code. NFCI.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 07:08:12 PDT 2022
Author: Benjamin Kramer
Date: 2022-05-05T16:06:59+02:00
New Revision: 17d27d926be34c2641411c87642f5a68c4b3e8a0
URL: https://github.com/llvm/llvm-project/commit/17d27d926be34c2641411c87642f5a68c4b3e8a0
DIFF: https://github.com/llvm/llvm-project/commit/17d27d926be34c2641411c87642f5a68c4b3e8a0.diff
LOG: [IR] Simplify code. NFCI.
Added:
Modified:
llvm/lib/IR/Constants.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index c182513fc1d14..b62d6ec3b1ab6 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -352,26 +352,14 @@ Constant *Constant::getNullValue(Type *Ty) {
case Type::IntegerTyID:
return ConstantInt::get(Ty, 0);
case Type::HalfTyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEhalf()));
case Type::BFloatTyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::BFloat()));
case Type::FloatTyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEsingle()));
case Type::DoubleTyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEdouble()));
case Type::X86_FP80TyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::x87DoubleExtended()));
case Type::FP128TyID:
- return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEquad()));
case Type::PPC_FP128TyID:
- return ConstantFP::get(Ty->getContext(), APFloat(APFloat::PPCDoubleDouble(),
- APInt::getZero(128)));
+ return ConstantFP::get(Ty->getContext(),
+ APFloat::getZero(Ty->getFltSemantics()));
case Type::PointerTyID:
return ConstantPointerNull::get(cast<PointerType>(Ty));
case Type::StructTyID:
More information about the llvm-commits
mailing list