diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-11 21:37:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-11 21:37:43 +0000 |
commit | 6aa68a76474525255943bee914e37b68a3ba75c8 (patch) | |
tree | e09a619ee14837d43c43408ea05c0685009ae5b8 /lib/Transforms/InstCombine/InstCombineAddSub.cpp | |
parent | 84cb033bf30b6f93ae2fbea71513970147e08dc2 (diff) |
When lowering an inbounds gep, the intermediate adds can have
unsigned overflow (e.g. due to a negative array index), but
the scales on array size multiplications are known to not
sign wrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAddSub.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/lib/Transforms/InstCombine/InstCombineAddSub.cpp index b04a05b3b3..4ff005e26c 100644 --- a/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -420,8 +420,7 @@ Value *InstCombiner::EmitGEPOffset(User *GEP) { if (Size) Result = Builder->CreateAdd(Result, ConstantInt::get(IntPtrTy, Size), - GEP->getName()+".offs", - isInBounds /*NUW*/); + GEP->getName()+".offs"); continue; } @@ -430,8 +429,7 @@ Value *InstCombiner::EmitGEPOffset(User *GEP) { ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/); Scale = ConstantExpr::getMul(OC, Scale, isInBounds/*NUW*/); // Emit an add instruction. - Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs", - isInBounds /*NUW*/); + Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs"); continue; } // Convert to correct type. @@ -444,8 +442,7 @@ Value *InstCombiner::EmitGEPOffset(User *GEP) { } // Emit an add instruction. - Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs", - isInBounds /*NUW*/); + Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs"); } return Result; } |