aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/JSBackend/ExpandI64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/JSBackend/ExpandI64.cpp')
-rw-r--r--lib/Target/JSBackend/ExpandI64.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Target/JSBackend/ExpandI64.cpp b/lib/Target/JSBackend/ExpandI64.cpp
index 1fbf0ddebd..5a5a39ade2 100644
--- a/lib/Target/JSBackend/ExpandI64.cpp
+++ b/lib/Target/JSBackend/ExpandI64.cpp
@@ -646,6 +646,15 @@ bool ExpandI64::splitInst(Instruction *I) {
case ICmpInst::ICMP_SLE:
case ICmpInst::ICMP_UGE:
case ICmpInst::ICMP_SGE: {
+ if (ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1))) {
+ if (CI->getZExtValue() == 0 && Pred == ICmpInst::ICMP_SLT) {
+ // strict < 0 is easy to do, even on non-i64, just the sign bit matters
+ Instruction *NewInst = new ICmpInst(I, ICmpInst::ICMP_SLT, LeftChunks[LeftChunks.size()-1], Zero);
+ CopyDebug(NewInst, I);
+ I->replaceAllUsesWith(NewInst);
+ return true;
+ }
+ }
assert(I->getOperand(0)->getType() == i64);
Instruction *A, *B, *C, *D, *Final;
ICmpInst::Predicate StrictPred = Pred;