File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2924,6 +2924,19 @@ struct OptimizeInstructions
2924
2924
return binary;
2925
2925
}
2926
2926
}
2927
+ } else if (binary->op == LtUInt32) {
2928
+ auto value = Properties::getFallthrough (
2929
+ binary->right , getPassOptions (), *getModule ());
2930
+ if (Properties::isConstantExpression (value)) {
2931
+ if (Properties::getLiteral (value).isZero ()) {
2932
+ // Hoist potential zero to be good for constant propagation
2933
+ // in case of being blocked by side effect.
2934
+ // (unsigned)x < 0 ==> i32(0)
2935
+ Builder builder (*getModule ());
2936
+ return getDroppedChildrenAndAppend (
2937
+ binary, LiteralUtils::makeZero (Type::i32 , *getModule ()));
2938
+ }
2939
+ }
2927
2940
}
2928
2941
if (auto * ext = Properties::getSignExtValue (binary)) {
2929
2942
// use a cheaper zero-extent, we just care about the boolean value
You can’t perform that action at this time.
0 commit comments