diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-18 16:37:28 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-18 16:37:28 -0800 |
commit | 7678d864a138c31d13edf2e3edd74e0bdb6cda70 (patch) | |
tree | d94c32c582d75b653d7881c1d7126f76bd9fbd65 /lib | |
parent | 4bb0e486d03d660045df96358fb36ad8034a911e (diff) |
fix i64 signed icmp
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index 108e3055a2..c473366c39 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -347,29 +347,25 @@ void ExpandI64::splitInst(Instruction *I, DataLayout& DL) { case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_SGT: { - A = CopyDebug(new ICmpInst(I, Pred, Zero, Zero), I); - B = CopyDebug(new ICmpInst(I, ICmpInst::ICMP_EQ, Zero, Zero), I); - C = CopyDebug(new ICmpInst(I, Pred, Zero, Zero), I); - D = CopyDebug(BinaryOperator::Create(Instruction::And, B, C, "", I), I); - Final = CopyDebug(BinaryOperator::Create(Instruction::Or, A, D, "", I), I); - break; - } + case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_UGE: case ICmpInst::ICMP_SGE: { - ICmpInst::Predicate StrictPred; + ICmpInst::Predicate StrictPred = Pred; + ICmpInst::Predicate UnsignedPred = Pred; switch (Pred) { case ICmpInst::ICMP_ULE: StrictPred = ICmpInst::ICMP_ULT; break; case ICmpInst::ICMP_UGE: StrictPred = ICmpInst::ICMP_UGT; break; - case ICmpInst::ICMP_SLE: StrictPred = ICmpInst::ICMP_SLT; break; - case ICmpInst::ICMP_SGE: StrictPred = ICmpInst::ICMP_SGT; break; + case ICmpInst::ICMP_SLE: StrictPred = ICmpInst::ICMP_SLT; UnsignedPred = ICmpInst::ICMP_ULE; break; + case ICmpInst::ICMP_SGE: StrictPred = ICmpInst::ICMP_SGT; UnsignedPred = ICmpInst::ICMP_UGE; break; + case ICmpInst::ICMP_SLT: UnsignedPred = ICmpInst::ICMP_ULT; break; + case ICmpInst::ICMP_SGT: UnsignedPred = ICmpInst::ICMP_UGT; break; default: assert(0); } A = CopyDebug(new ICmpInst(I, StrictPred, Zero, Zero), I); B = CopyDebug(new ICmpInst(I, ICmpInst::ICMP_EQ, Zero, Zero), I); - C = CopyDebug(new ICmpInst(I, Pred, Zero, Zero), I); + C = CopyDebug(new ICmpInst(I, UnsignedPred, Zero, Zero), I); D = CopyDebug(BinaryOperator::Create(Instruction::And, B, C, "", I), I); Final = CopyDebug(BinaryOperator::Create(Instruction::Or, A, D, "", I), I); break; |