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 | d3c0e05f51d7db1fc3d3af89c2c7ce10c5957354 (patch) | |
tree | ea50bae49d4f0e302a59557fb63703276c7f676f /llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | |
parent | 860a84d65a556dfce7e2ce9b35dc1f8dd125bbad (diff) | |
download | bcm5719-llvm-d3c0e05f51d7db1fc3d3af89c2c7ce10c5957354.tar.gz bcm5719-llvm-d3c0e05f51d7db1fc3d3af89c2c7ce10c5957354.zip |
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.
llvm-svn: 125409
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp index b04a05b3b35..4ff005e26c2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/llvm/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; } |