[llvm] ef7a847 - [LoopUnswitch] Remove redundant condition. (NFC) (#107893)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 12 07:40:20 PDT 2024
Author: Amr Hesham
Date: 2024-09-12T16:40:16+02:00
New Revision: ef7a847be2db0325fe8bbad7febac9e42c96d232
URL: https://github.com/llvm/llvm-project/commit/ef7a847be2db0325fe8bbad7febac9e42c96d232
DIFF: https://github.com/llvm/llvm-project/commit/ef7a847be2db0325fe8bbad7febac9e42c96d232.diff
LOG: [LoopUnswitch] Remove redundant condition. (NFC) (#107893)
Remove redundant condition from '!A || (A && B)' to '!A || B'
Fixes: #99799
Added:
Modified:
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index c235d2fb2a5bd4..f3f5ffb6b61b47 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -770,8 +770,7 @@ static bool unswitchTrivialSwitch(Loop &L, SwitchInst &SI, DominatorTree &DT,
// instruction in the block.
auto *TI = BBToCheck.getTerminator();
bool isUnreachable = isa<UnreachableInst>(TI);
- return !isUnreachable ||
- (isUnreachable && (BBToCheck.getFirstNonPHIOrDbg() != TI));
+ return !isUnreachable || BBToCheck.getFirstNonPHIOrDbg() != TI;
};
SmallVector<int, 4> ExitCaseIndices;
More information about the llvm-commits
mailing list