[llvm] d0a1bf8 - [TypePromotion] Remove an unreachable 'return false'. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 12:51:04 PST 2024
Author: Craig Topper
Date: 2024-02-13T12:50:52-08:00
New Revision: d0a1bf8b306afa565951c65b662713882a0d2481
URL: https://github.com/llvm/llvm-project/commit/d0a1bf8b306afa565951c65b662713882a0d2481
DIFF: https://github.com/llvm/llvm-project/commit/d0a1bf8b306afa565951c65b662713882a0d2481.diff
LOG: [TypePromotion] Remove an unreachable 'return false'. NFC
The if and the else above this both return so this is unreachable.
Delete it and remove the else after return.
Added:
Modified:
llvm/lib/CodeGen/TypePromotion.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp
index 7a3bc6c2043f4c..48ad8de778010e 100644
--- a/llvm/lib/CodeGen/TypePromotion.cpp
+++ b/llvm/lib/CodeGen/TypePromotion.cpp
@@ -359,22 +359,21 @@ bool TypePromotionImpl::isSafeWrap(Instruction *I) {
if (!OverflowConst.isNonPositive())
return false;
+ SafeWrap.insert(I);
+
// Using C1 = OverflowConst and C2 = ICmpConst, we can either prove that:
// zext(x) + sext(C1) <u zext(C2) if C1 < 0 and C1 >s C2
// zext(x) + sext(C1) <u sext(C2) if C1 < 0 and C1 <=s C2
if (OverflowConst.sgt(ICmpConst)) {
LLVM_DEBUG(dbgs() << "IR Promotion: Allowing safe overflow for sext "
<< "const of " << *I << "\n");
- SafeWrap.insert(I);
- return true;
- } else {
- LLVM_DEBUG(dbgs() << "IR Promotion: Allowing safe overflow for sext "
- << "const of " << *I << " and " << *CI << "\n");
- SafeWrap.insert(I);
- SafeWrap.insert(CI);
return true;
}
- return false;
+
+ LLVM_DEBUG(dbgs() << "IR Promotion: Allowing safe overflow for sext "
+ << "const of " << *I << " and " << *CI << "\n");
+ SafeWrap.insert(CI);
+ return true;
}
bool TypePromotionImpl::shouldPromote(Value *V) {
More information about the llvm-commits
mailing list