Make makeLoopInvariant report whether it made any changes or not,
and use this to simplify more code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75722 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index f5061b5..daf1841 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -168,13 +168,10 @@
if (isa<Constant>(Cond)) return 0;
// TODO: Handle: br (VARIANT|INVARIANT).
- if (L->isLoopInvariant(Cond)) return Cond;
// Hoist simple values out.
- if (L->makeLoopInvariant(Cond)) {
- Changed = true;
+ if (L->makeLoopInvariant(Cond, Changed))
return Cond;
- }
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond))
if (BO->getOpcode() == Instruction::And ||