summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-11 19:56:00 +0000
committerDan Gohman <gohman@apple.com>2009-08-11 19:56:00 +0000
commit221a2c711d6c2487647ce43a2abb5f3b2510d3fd (patch)
tree252f7532dfde1bf0c50ef51b986cc9c5b4e46324
parent841850ed262730f6683edd95af5b07cd4c4527d3 (diff)
downloadbcm5719-llvm-221a2c711d6c2487647ce43a2abb5f3b2510d3fd.tar.gz
bcm5719-llvm-221a2c711d6c2487647ce43a2abb5f3b2510d3fd.zip
Don't set the isexact flag if an sdiv operator has been folded into
something else. llvm-svn: 78702
-rw-r--r--llvm/lib/VMCore/Constants.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index 70d43576a73..d71dc2cf710 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -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;
}
OpenPOWER on IntegriCloud