diff options
| author | Dan Gohman <gohman@apple.com> | 2009-01-06 22:53:52 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-01-06 22:53:52 +0000 | 
| commit | c7847cdb8d110ba9f099694412d0b629f8c6ae6c (patch) | |
| tree | e5b4e6d1d689ff97e600da1169ec2274c0bddfd9 /llvm/lib/CodeGen/SelectionDAG | |
| parent | 763ea559acf408d6a6505aa17f80e972d2ef701b (diff) | |
| download | bcm5719-llvm-c7847cdb8d110ba9f099694412d0b629f8c6ae6c.tar.gz bcm5719-llvm-c7847cdb8d110ba9f099694412d0b629f8c6ae6c.zip | |
Fix a bug in ComputeLinearIndex computation handling multi-level
aggregate types. Don't increment the current index after reaching
the end of a struct, as it will already be pointing at
one-past-the end. This fixes PR3288.
llvm-svn: 61828
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 4f17164ce6a..c8985b47f0a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -63,7 +63,7 @@ LimitFPPrecision("limit-float-precision",                   cl::init(0));  /// ComputeLinearIndex - Given an LLVM IR aggregate type and a sequence -/// insertvalue or extractvalue indices that identify a member, return +/// of insertvalue or extractvalue indices that identify a member, return  /// the linearized index of the start of the member.  ///  static unsigned ComputeLinearIndex(const TargetLowering &TLI, const Type *Ty, @@ -84,6 +84,7 @@ static unsigned ComputeLinearIndex(const TargetLowering &TLI, const Type *Ty,          return ComputeLinearIndex(TLI, *EI, Indices+1, IndicesEnd, CurIndex);        CurIndex = ComputeLinearIndex(TLI, *EI, 0, 0, CurIndex);      } +    return CurIndex;    }    // Given an array type, recursively traverse the elements.    else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) { @@ -93,6 +94,7 @@ static unsigned ComputeLinearIndex(const TargetLowering &TLI, const Type *Ty,          return ComputeLinearIndex(TLI, EltTy, Indices+1, IndicesEnd, CurIndex);        CurIndex = ComputeLinearIndex(TLI, EltTy, 0, 0, CurIndex);      } +    return CurIndex;    }    // We haven't found the type we're looking for, so keep searching.    return CurIndex + 1; | 

