[llvm] [LoopUnswitch] Allow i1 truncs in loop unswitch (PR #89738)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 04:46:43 PDT 2024


================
@@ -1930,7 +1930,15 @@ llvm::hasPartialIVCondition(const Loop &L, unsigned MSSAThreshold,
   if (!TI || !TI->isConditional())
     return {};
 
-  auto *CondI = dyn_cast<CmpInst>(TI->getCondition());
+  Instruction *CondI = nullptr;
+  CondI = dyn_cast<CmpInst>(TI->getCondition());
+
+  if (!CondI) {
+    CondI = dyn_cast<TruncInst>(TI->getCondition());
+    if (CondI && CondI->getType() != Type::getInt1Ty(TI->getContext())) {
----------------
david-arm wrote:

You can remove the {} braces around the if block here.

https://github.com/llvm/llvm-project/pull/89738


More information about the llvm-commits mailing list