From: Craig Topper Date: Sun, 4 Jun 2017 08:21:53 +0000 (+0000) Subject: [ConstantFolding] Combine an if statement into an earlier one that checked the same... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbcb0b4f72223c48b4cc5a5bf990e26b21de3e50;p=llvm [ConstantFolding] Combine an if statement into an earlier one that checked the same condition. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304681 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 4267ed24e9f..8170c38afb7 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -1584,6 +1584,9 @@ Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, Type *Ty, // cosine(arg) is between -1 and 1. cosine(invalid arg) is NaN if (IntrinsicID == Intrinsic::cos) return Constant::getNullValue(Ty); + if (IntrinsicID == Intrinsic::bswap || + IntrinsicID == Intrinsic::bitreverse) + return Operands[0]; } if (auto *Op = dyn_cast(Operands[0])) { if (IntrinsicID == Intrinsic::convert_to_fp16) { @@ -1828,13 +1831,6 @@ Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, Type *Ty, } } - if (isa(Operands[0])) { - if (IntrinsicID == Intrinsic::bswap || - IntrinsicID == Intrinsic::bitreverse) - return Operands[0]; - return nullptr; - } - return nullptr; }