[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Aug 7 18:30:20 PDT 2004



Changes in directory llvm/lib/Transforms:

ExprTypeConvert.cpp updated: 1.96 -> 1.97
---
Log message:

Two fixes:
1. Fix a REALLY nasty cyclic replacement issue that Anshu discovered, causing
   nondeterminstic crashes and memory corruption.
2. For performance, don't go inserting constantexpr casts of GV pointers.

This should definitely go into 1.3



---
Diffs of the changes:  (+2 -3)

Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.96 llvm/lib/Transforms/ExprTypeConvert.cpp:1.97
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.96	Thu Jul 29 07:17:34 2004
+++ llvm/lib/Transforms/ExprTypeConvert.cpp	Sat Aug  7 20:30:07 2004
@@ -151,7 +151,7 @@
   // If it's a constant... all constants can be converted to a different
   // type.
   //
-  if (Constant *CPV = dyn_cast<Constant>(V))
+  if (isa<Constant>(V) && !isa<GlobalValue>(V))
     return true;
   
   CTMap[V] = Ty;
@@ -984,10 +984,9 @@
 
     unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0;
     Value *OtherOp    = I->getOperand(OtherIdx);
+    Res->setOperand(!OtherIdx, NewVal);
     Value *NewOther   = ConvertExpressionToType(OtherOp, NewTy, VMC, TD);
-
     Res->setOperand(OtherIdx, NewOther);
-    Res->setOperand(!OtherIdx, NewVal);
     break;
   }
   case Instruction::Shl:






More information about the llvm-commits mailing list