diff options
| author | Devang Patel <dpatel@apple.com> | 2007-07-09 21:19:23 +0000 | 
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2007-07-09 21:19:23 +0000 | 
| commit | e8ec7661eacb8c6cc6607b49f284ef0344af8c0d (patch) | |
| tree | 74bbfdd57d5956bc84356795c108b1bde1c23bf8 /llvm/lib | |
| parent | f8f531bf69f039bc24f7f804932fd0ca01f084fb (diff) | |
| download | bcm5719-llvm-e8ec7661eacb8c6cc6607b49f284ef0344af8c0d.tar.gz bcm5719-llvm-e8ec7661eacb8c6cc6607b49f284ef0344af8c0d.zip  | |
Expose struct size threhold to allow users to tweak their own setting.
llvm-svn: 38472
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index e31fdd16e1b..5e7dbc2ff8f 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -48,7 +48,12 @@ STATISTIC(NumGlobals,   "Number of allocas copied from constant global");  namespace {    struct VISIBILITY_HIDDEN SROA : public FunctionPass {      static char ID; // Pass identification, replacement for typeid -    SROA() : FunctionPass((intptr_t)&ID) {} +    SROA(signed T = -1) : FunctionPass((intptr_t)&ID) { +      if (T == -1) +        SRThreshold = 128; +      else +        SRThreshold = T; +    }      bool runOnFunction(Function &F); @@ -87,6 +92,8 @@ namespace {            isMemCpySrc(false), isMemCpyDst(false) {}      }; +    unsigned SRThreshold; +      void MarkUnsafe(AllocaInfo &I) { I.isUnsafe = true; }      int isSafeAllocaToScalarRepl(AllocationInst *AI); @@ -119,7 +126,9 @@ namespace {  }  // Public interface to the ScalarReplAggregates pass -FunctionPass *llvm::createScalarReplAggregatesPass() { return new SROA(); } +FunctionPass *llvm::createScalarReplAggregatesPass(signed int Threshold) {  +  return new SROA(Threshold); +}  bool SROA::runOnFunction(Function &F) { @@ -211,7 +220,7 @@ bool SROA::performScalarRepl(Function &F) {          (isa<StructType>(AI->getAllocatedType()) ||           isa<ArrayType>(AI->getAllocatedType())) &&          AI->getAllocatedType()->isSized() && -        TD.getTypeSize(AI->getAllocatedType()) < 128) { +        TD.getTypeSize(AI->getAllocatedType()) < SRThreshold) {        // Check that all of the users of the allocation are capable of being        // transformed.        switch (isSafeAllocaToScalarRepl(AI)) {  | 

