diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-05-17 18:38:55 +0000 | 
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-05-17 18:38:55 +0000 | 
| commit | 86564cad068ed1bb49959b111c032153dc9c271e (patch) | |
| tree | 2006dcea57cc095494e73a8428574eb804c9fa35 /llvm/lib/Transforms/InstCombine | |
| parent | a7445f1b5ec28666d5a5b51210e97572c73f32c3 (diff) | |
| download | bcm5719-llvm-86564cad068ed1bb49959b111c032153dc9c271e.tar.gz bcm5719-llvm-86564cad068ed1bb49959b111c032153dc9c271e.zip | |
[InstCombine] fix constant to be signed for signed comparisons
This bug was introduced in r269728 and is the likely cause of many stage 2 ubsan bot failures.
I'll add a test in a follow-up commit assuming this fixes things properly.
llvm-svn: 269797
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 447c43763f3..f51cf7321f2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3150,7 +3150,7 @@ static ICmpInst *canonicalizeCmpWithConstant(ICmpInst &I) {    // Increment or decrement the constant and set the new comparison predicate:    // ULE -> ULT ; UGE -> UGT ; SLE -> SLT ; SGE -> SGT -  Constant *OneOrNegOne = ConstantInt::get(Op1Type, IsLE ? 1 : -1); +  Constant *OneOrNegOne = ConstantInt::get(Op1Type, IsLE ? 1 : -1, IsSigned);    CmpInst::Predicate NewPred = IsLE ? ICmpInst::ICMP_ULT: ICmpInst::ICMP_UGT;    NewPred = IsSigned ? ICmpInst::getSignedPredicate(NewPred) : NewPred;    return new ICmpInst(NewPred, Op0, ConstantExpr::getAdd(Op1C, OneOrNegOne)); | 

