[llvm] r304681 - [ConstantFolding] Combine an if statement into an earlier one that checked the same condition. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 4 01:21:53 PDT 2017
Author: ctopper
Date: Sun Jun 4 03:21:53 2017
New Revision: 304681
URL: http://llvm.org/viewvc/llvm-project?rev=304681&view=rev
Log:
[ConstantFolding] Combine an if statement into an earlier one that checked the same condition. NFC
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=304681&r1=304680&r2=304681&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sun Jun 4 03:21:53 2017
@@ -1584,6 +1584,9 @@ Constant *ConstantFoldScalarCall(StringR
// 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<ConstantFP>(Operands[0])) {
if (IntrinsicID == Intrinsic::convert_to_fp16) {
@@ -1828,13 +1831,6 @@ Constant *ConstantFoldScalarCall(StringR
}
}
- if (isa<UndefValue>(Operands[0])) {
- if (IntrinsicID == Intrinsic::bswap ||
- IntrinsicID == Intrinsic::bitreverse)
- return Operands[0];
- return nullptr;
- }
-
return nullptr;
}
More information about the llvm-commits
mailing list