[llvm-commits] [llvm] r78702 - /llvm/trunk/lib/VMCore/Constants.cpp

Dan Gohman gohman at apple.com
Tue Aug 11 12:56:00 PDT 2009


Author: djg
Date: Tue Aug 11 14:56:00 2009
New Revision: 78702

URL: http://llvm.org/viewvc/llvm-project?rev=78702&view=rev
Log:
Don't set the isexact flag if an sdiv operator has been folded into
something else.

Modified:
    llvm/trunk/lib/VMCore/Constants.cpp

Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=78702&r1=78701&r2=78702&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Tue Aug 11 14:56:00 2009
@@ -607,7 +607,10 @@
 
 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;
 }
 





More information about the llvm-commits mailing list