summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/OptimizeInstructions.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 1c549cab6..cf5ad982e 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -525,6 +525,12 @@ struct OptimizeInstructions : public WalkerPass<PostWalker<OptimizeInstructions,
}
}
}
+ } else if (auto* ext = getSignExt(binary)) {
+ // if sign extending the exact bit size we store, we can skip the extension
+ // if extending something bigger, then we just alter bits we don't save anyhow
+ if (getSignExtBits(binary) >= store->bytes * 8) {
+ store->value = ext;
+ }
}
} else if (auto* unary = store->value->dynCast<Unary>()) {
if (unary->op == WrapInt64) {