summaryrefslogtreecommitdiff
path: root/src/passes/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/LoopInvariantCodeMotion.cpp')
-rw-r--r--src/passes/LoopInvariantCodeMotion.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/LoopInvariantCodeMotion.cpp b/src/passes/LoopInvariantCodeMotion.cpp
index e9f376bd3..b8e00ffce 100644
--- a/src/passes/LoopInvariantCodeMotion.cpp
+++ b/src/passes/LoopInvariantCodeMotion.cpp
@@ -208,8 +208,9 @@ struct LoopInvariantCodeMotion
if (auto* set = curr->dynCast<SetLocal>()) {
while (1) {
auto* next = set->value->dynCast<SetLocal>();
- if (!next)
+ if (!next) {
break;
+ }
set = next;
}
if (set->value->is<GetLocal>() || set->value->is<Const>()) {
@@ -226,8 +227,9 @@ struct LoopInvariantCodeMotion
for (auto* set : sets) {
// nullptr means a parameter or zero-init value;
// no danger to us.
- if (!set)
+ if (!set) {
continue;
+ }
// Check if the set is in the loop. If not, it's either before,
// which is fine, or after, which is also fine - moving curr
// to just outside the loop will preserve those relationships.