[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Sheng Zhou
zhousheng00 at gmail.com
Wed Jun 27 19:00:41 PDT 2007
Chris,
Attached is the testcase, which will get:
opt:
/developer/home2/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/VMCore/Constants.cpp:1559:
static llvm::Constant* llvm::ConstantExpr::getZExt(llvm::Constant*,
const llvm::Type*): Assertion `C->getType()->getPrimitiveSizeInBits() <
Ty->getPrimitiveSizeInBits()&& "SrcTy must be smaller than DestTy for
ZExt!"' failed.
The condition "IterationCount->getType() != LargestType" doesn't mean
the IterationCount->getType's bitwidth < LargestType's
so, sometimes, (like in this testcase), it need a trunc not ext. This
patch is to fix it.
Sheng
DOUT << "INDVARS: New CanIV: " << *IndVar;
>
> if (!isa<SCEVCouldNotCompute>(IterationCount)) {
> - if (IterationCount->getType() != LargestType)
> + if (IterationCount->getType()->getPrimitiveSizeInBits() <
> + LargestType->getPrimitiveSizeInBits())
> IterationCount = SCEVZeroExtendExpr::get(IterationCount,
> LargestType);
> + else if (IterationCount->getType() != LargestType)
> + IterationCount = SCEVTruncateExpr::get(IterationCount,
> LargestType);
> if (Instruction *DI = LinearFunctionTestReplace(L,
> IterationCount,Rewriter))
> DeadInsts.insert(DI);
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.bc
Type: application/octet-stream
Size: 524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070628/82cf95ed/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testcase.ll
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070628/82cf95ed/attachment.ksh>
More information about the llvm-commits
mailing list