[llvm] [Transform] Remove redundant condition (PR #107893)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 10:27:54 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Amr Hesham (AmrDeveloper)
<details>
<summary>Changes</summary>
Remove redundant condition from '!A || (A && B)' to '!A || B'
Fixes: #<!-- -->99799
---
Full diff: https://github.com/llvm/llvm-project/pull/107893.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp (+1-2)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index c235d2fb2a5bd4..7d87df1805d1ea 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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/107893
More information about the llvm-commits
mailing list