[llvm-commits] [llvm] r63544 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Chris Lattner
sabre at nondot.org
Mon Feb 2 12:44:46 PST 2009
Author: lattner
Date: Mon Feb 2 14:44:45 2009
New Revision: 63544
URL: http://llvm.org/viewvc/llvm-project?rev=63544&view=rev
Log:
inline SROA::ConvertToScalar, no functionality change.
Modified:
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=63544&r1=63543&r2=63544&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Feb 2 14:44:45 2009
@@ -127,7 +127,6 @@
bool CanConvertToScalar(Value *V, bool &IsNotTrivial, const Type *&ResTy,
uint64_t Offset);
- void ConvertToScalar(AllocationInst *AI, const Type *Ty);
void ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, uint64_t Offset);
Value *ConvertUsesOfLoadToScalar(LoadInst *LI, AllocaInst *NewAI,
uint64_t Offset);
@@ -269,6 +268,8 @@
Changed = true;
continue;
}
+
+
// If we can turn this aggregate value (potentially with casts) into a
// simple scalar value that can be mem2reg'd into a register value.
@@ -277,11 +278,18 @@
// that we can't just check based on the type: the alloca may be of an i32
// but that has pointer arithmetic to set byte 3 of it or something.
bool IsNotTrivial = false;
- const Type *ActualType = 0;
- if (CanConvertToScalar(AI, IsNotTrivial, ActualType, 0))
- if (IsNotTrivial && ActualType &&
- TD->getTypeSizeInBits(ActualType) < SRThreshold*8) {
- ConvertToScalar(AI, ActualType);
+ const Type *ActualTy = 0;
+ if (CanConvertToScalar(AI, IsNotTrivial, ActualTy, 0))
+ if (IsNotTrivial && ActualTy &&
+ TD->getTypeSizeInBits(ActualTy) < SRThreshold*8) {
+ DOUT << "CONVERT TO SCALAR: " << *AI << " TYPE = " << *ActualTy <<"\n";
+ ++NumConverted;
+
+ // Create and insert the alloca.
+ AllocaInst *NewAI = new AllocaInst(ActualTy, 0, AI->getName(),
+ AI->getParent()->begin());
+ ConvertUsesToScalar(AI, NewAI, 0);
+ AI->eraseFromParent();
Changed = true;
continue;
}
@@ -1263,20 +1271,6 @@
return true;
}
-/// ConvertToScalar - The specified alloca passes the CanConvertToScalar
-/// predicate and is non-trivial. Convert it to something that can be trivially
-/// promoted into a register by mem2reg.
-void SROA::ConvertToScalar(AllocationInst *AI, const Type *ActualTy) {
- DOUT << "CONVERT TO SCALAR: " << *AI << " TYPE = " << *ActualTy << "\n";
- ++NumConverted;
-
- // Create and insert the alloca.
- AllocaInst *NewAI = new AllocaInst(ActualTy, 0, AI->getName(),
- AI->getParent()->begin());
- ConvertUsesToScalar(AI, NewAI, 0);
- AI->eraseFromParent();
-}
-
/// ConvertUsesToScalar - Convert all of the users of Ptr to use the new alloca
/// directly. This happens when we are converting an "integer union" to a
More information about the llvm-commits
mailing list