Don't set the isexact flag if an sdiv operator has been folded into

something else.

llvm-svn: 78702
This commit is contained in:
Dan Gohman 2009-08-11 19:56:00 +00:00
parent 841850ed26
commit 221a2c711d
1 changed files with 4 additions and 1 deletions

View File

@ -607,7 +607,10 @@ Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) {
Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) {
Constant *C = getSDiv(C1, C2);
cast<SDivOperator>(C)->setIsExact(true);
// Set exact attribute, assuming constant folding didn't eliminate the
// SDiv.
if (SDivOperator *SDiv = dyn_cast<SDivOperator>(C))
SDiv->setIsExact(true);
return C;
}