[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jan 22 18:56:01 PST 2004


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.71 -> 1.72

---
Log message:

Fix a problem brian ran into with the bytecode reader asserting.  It turns 
out that the problem was actually the writer writing out a 'null' value 
because it didn't normalize it.  This fixes:
test/Regression/Assembler/2004-01-22-FloatNormalization.ll



---
Diffs of the changes:  (+5 -0)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.71 llvm/lib/VMCore/Constants.cpp:1.72
--- llvm/lib/VMCore/Constants.cpp:1.71	Wed Jan 14 11:51:53 2004
+++ llvm/lib/VMCore/Constants.cpp	Thu Jan 22 18:55:21 2004
@@ -701,6 +701,11 @@
 static ValueMap<double, Type, ConstantFP> FPConstants;
 
 ConstantFP *ConstantFP::get(const Type *Ty, double V) {
+  if (Ty == Type::FloatTy) {
+    // Force the value through memory to normalize it.
+    volatile float Tmp = V;
+    V = Tmp;
+  }
   return FPConstants.getOrCreate(Ty, V);
 }
 





More information about the llvm-commits mailing list