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

Chris Lattner sabre at nondot.org
Wed Apr 11 08:45:43 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.83 -> 1.84
---
Log message:

Fix Transforms/ScalarRepl/union-pointer.ll


---
Diffs of the changes:  (+7 -6)

 ScalarReplAggregates.cpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.83 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.84
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.83	Tue Apr 10 22:27:24 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Wed Apr 11 10:45:25 2007
@@ -1002,6 +1002,11 @@
                                      ConstantInt::get(Type::Int32Ty, Elt),
                                      "tmp", SI);
         }
+      } else if (isa<PointerType>(AllocaType)) {
+        // If the alloca type is a pointer, then all the elements must be
+        // pointers.
+        if (SV->getType() != AllocaType)
+          SV = new BitCastInst(SV, AllocaType, SV->getName(), SI);
       } else {
         Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI);
 
@@ -1013,12 +1018,8 @@
         if (SV->getType()->isFloatingPoint())
           SV = new BitCastInst(SV, IntegerType::get(SrcWidth),
                                SV->getName(), SI);
-        else if (isa<PointerType>(SV->getType())) {
-          if (isa<PointerType>(AllocaType))
-            SV = new BitCastInst(SV, AllocaType, SV->getName(), SI);
-          else
-            SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI);
-        }
+        else if (isa<PointerType>(SV->getType()))
+          SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI);
                  
         // Always zero extend the value if needed.
         if (SV->getType() != AllocaType)






More information about the llvm-commits mailing list