[llvm-branch-commits] [llvm-branch] r71229 - in /llvm/branches/Apple/Dib: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll

Bill Wendling isanbard at gmail.com
Fri May 8 10:46:42 PDT 2009


Author: void
Date: Fri May  8 12:46:42 2009
New Revision: 71229

URL: http://llvm.org/viewvc/llvm-project?rev=71229&view=rev
Log:
--- Merging r71224 into '.':
A    test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll
U    lib/Transforms/Scalar/ScalarReplAggregates.cpp

fix RewriteStoreUserOfWholeAlloca to use the correct type size
method, fixing a crash on PR4146.  While the store will
ultimately overwrite the "padded size" number of bits in memory,
the stored value may be a subset of this size.  This function
only wants to handle the case where all bits are stored.

Added:
    llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll
      - copied unchanged from r71224, llvm/trunk/test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll
Modified:
    llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=71229&r1=71228&r2=71229&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp Fri May  8 12:46:42 2009
@@ -903,9 +903,10 @@
   
   // If this isn't a store of an integer to the whole alloca, it may be a store
   // to the first element.  Just ignore the store in this case and normal SROA
-  // will handle it.
+  // will handle it.  We don't handle types here that have tail padding, like
+  // an alloca of type {i1}.
   if (!isa<IntegerType>(SrcVal->getType()) ||
-      TD->getTypePaddedSizeInBits(SrcVal->getType()) != AllocaSizeBits)
+      TD->getTypeSizeInBits(SrcVal->getType()) != AllocaSizeBits)
     return;
 
   DOUT << "PROMOTING STORE TO WHOLE ALLOCA: " << *AI << *SI;
@@ -1015,9 +1016,10 @@
   
   // If this isn't a load of the whole alloca to an integer, it may be a load
   // of the first element.  Just ignore the load in this case and normal SROA
-  // will handle it.
+  // will handle it.  We don't handle types here that have tail padding, like
+  // an alloca of type {i1}.
   if (!isa<IntegerType>(LI->getType()) ||
-      TD->getTypePaddedSizeInBits(LI->getType()) != AllocaSizeBits)
+      TD->getTypeSizeInBits(LI->getType()) != AllocaSizeBits)
     return;
   
   DOUT << "PROMOTING LOAD OF WHOLE ALLOCA: " << *AI << *LI;





More information about the llvm-branch-commits mailing list