aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
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
commit13c373cf0d165afb422c10c0ad066639d41d84ae (patch)
treeddcbf09fda522261095a3b3e819967ec02bb6f8d /lib/VMCore
parentcc6e66ab427fd02a31b06ad6302098be72899516 (diff)
downloadexternal_llvm-13c373cf0d165afb422c10c0ad066639d41d84ae.zip
external_llvm-13c373cf0d165afb422c10c0ad066639d41d84ae.tar.gz
external_llvm-13c373cf0d165afb422c10c0ad066639d41d84ae.tar.bz2
Don't set the isexact flag if an sdiv operator has been folded into
something else. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Constants.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 70d4357..d71dc2c 100644
--- a/lib/VMCore/Constants.cpp
+++ b/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;
}