[llvm] [Transform] Remove redundant condition (PR #107893)

Amr Hesham via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 10:36:50 PDT 2024


https://github.com/AmrDeveloper updated https://github.com/llvm/llvm-project/pull/107893

>From 7898cd15d91eb55d8f06b8cdfd725df4972bd000 Mon Sep 17 00:00:00 2001
From: AmrDeveloper <amr96 at programmer.net>
Date: Mon, 9 Sep 2024 19:26:00 +0200
Subject: [PATCH] [LoopUnswitch] Remove redundant condition. (NFC)

---
 llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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