mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
use the very-handy getTruncateOrZeroExtend helper function, and
stop setting NSW: signed overflow is possible. Thanks to Dan for pointing these out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122790 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c502f915f
commit
7c90b90f4e
@ -349,17 +349,13 @@ processLoopStoreOfSplatValue(StoreInst *SI, unsigned StoreSize,
|
|||||||
// The # stored bytes is (BECount+1)*Size. Expand the trip count out to
|
// The # stored bytes is (BECount+1)*Size. Expand the trip count out to
|
||||||
// pointer size if it isn't already.
|
// pointer size if it isn't already.
|
||||||
const Type *IntPtr = TD->getIntPtrType(SI->getContext());
|
const Type *IntPtr = TD->getIntPtrType(SI->getContext());
|
||||||
unsigned BESize = SE->getTypeSizeInBits(BECount->getType());
|
BECount = SE->getTruncateOrZeroExtend(BECount, IntPtr);
|
||||||
if (BESize < TD->getPointerSizeInBits())
|
|
||||||
BECount = SE->getZeroExtendExpr(BECount, IntPtr);
|
|
||||||
else if (BESize > TD->getPointerSizeInBits())
|
|
||||||
BECount = SE->getTruncateExpr(BECount, IntPtr);
|
|
||||||
|
|
||||||
const SCEV *NumBytesS = SE->getAddExpr(BECount, SE->getConstant(IntPtr, 1),
|
const SCEV *NumBytesS = SE->getAddExpr(BECount, SE->getConstant(IntPtr, 1),
|
||||||
true, true /*nooverflow*/);
|
true /*no unsigned overflow*/);
|
||||||
if (StoreSize != 1)
|
if (StoreSize != 1)
|
||||||
NumBytesS = SE->getMulExpr(NumBytesS, SE->getConstant(IntPtr, StoreSize),
|
NumBytesS = SE->getMulExpr(NumBytesS, SE->getConstant(IntPtr, StoreSize),
|
||||||
true, true /*nooverflow*/);
|
true /*no unsigned overflow*/);
|
||||||
|
|
||||||
Value *NumBytes =
|
Value *NumBytes =
|
||||||
Expander.expandCodeFor(NumBytesS, IntPtr, Preheader->getTerminator());
|
Expander.expandCodeFor(NumBytesS, IntPtr, Preheader->getTerminator());
|
||||||
@ -426,17 +422,13 @@ processLoopStoreOfLoopLoad(StoreInst *SI, unsigned StoreSize,
|
|||||||
// The # stored bytes is (BECount+1)*Size. Expand the trip count out to
|
// The # stored bytes is (BECount+1)*Size. Expand the trip count out to
|
||||||
// pointer size if it isn't already.
|
// pointer size if it isn't already.
|
||||||
const Type *IntPtr = TD->getIntPtrType(SI->getContext());
|
const Type *IntPtr = TD->getIntPtrType(SI->getContext());
|
||||||
unsigned BESize = SE->getTypeSizeInBits(BECount->getType());
|
BECount = SE->getTruncateOrZeroExtend(BECount, IntPtr);
|
||||||
if (BESize < TD->getPointerSizeInBits())
|
|
||||||
BECount = SE->getZeroExtendExpr(BECount, IntPtr);
|
|
||||||
else if (BESize > TD->getPointerSizeInBits())
|
|
||||||
BECount = SE->getTruncateExpr(BECount, IntPtr);
|
|
||||||
|
|
||||||
const SCEV *NumBytesS = SE->getAddExpr(BECount, SE->getConstant(IntPtr, 1),
|
const SCEV *NumBytesS = SE->getAddExpr(BECount, SE->getConstant(IntPtr, 1),
|
||||||
true, true /*nooverflow*/);
|
true /*no unsigned overflow*/);
|
||||||
if (StoreSize != 1)
|
if (StoreSize != 1)
|
||||||
NumBytesS = SE->getMulExpr(NumBytesS, SE->getConstant(IntPtr, StoreSize),
|
NumBytesS = SE->getMulExpr(NumBytesS, SE->getConstant(IntPtr, StoreSize),
|
||||||
true, true /*nooverflow*/);
|
true /*no unsigned overflow*/);
|
||||||
|
|
||||||
Value *NumBytes =
|
Value *NumBytes =
|
||||||
Expander.expandCodeFor(NumBytesS, IntPtr, Preheader->getTerminator());
|
Expander.expandCodeFor(NumBytesS, IntPtr, Preheader->getTerminator());
|
||||||
|
Loading…
Reference in New Issue
Block a user