diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2012-12-15 09:26:06 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2012-12-15 09:26:06 +0000 |
| commit | 067edd342f2dbf10d7d8c36a543daa3411ef3679 (patch) | |
| tree | 79af8c2ca376584a458b97fbf0fa89aaff07a6e6 | |
| parent | 7a28f95419a04eb9bc2ab07584485fd979d4eb4d (diff) | |
| download | bcm5719-llvm-067edd342f2dbf10d7d8c36a543daa3411ef3679.tar.gz bcm5719-llvm-067edd342f2dbf10d7d8c36a543daa3411ef3679.zip | |
Relax an overly aggressive assert to fix PR14572.
The alloca width is based on the alloc size, not the type size.
llvm-svn: 170270
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/SROA/basictest.ll | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 1c220ca0f6e..c65ac5a647a 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -2607,7 +2607,7 @@ private: TD.getTypeStoreSizeInBits(V->getType()) && "Non-byte-multiple bit width"); assert(V->getType()->getIntegerBitWidth() == - TD.getTypeSizeInBits(OldAI.getAllocatedType()) && + TD.getTypeAllocSizeInBits(OldAI.getAllocatedType()) && "Only alloca-wide stores can be split and recomposed"); IntegerType *NarrowTy = Type::getIntNTy(SI.getContext(), Size * 8); V = extractInteger(TD, IRB, V, NarrowTy, BeginOffset, diff --git a/llvm/test/Transforms/SROA/basictest.ll b/llvm/test/Transforms/SROA/basictest.ll index d8b6b41a579..ba93e04a51d 100644 --- a/llvm/test/Transforms/SROA/basictest.ll +++ b/llvm/test/Transforms/SROA/basictest.ll @@ -1176,3 +1176,19 @@ entry: %baz = load i1* %a.i1, align 1 ret void } + +define <3 x i8> @PR14572(i32 %x) { +; Ensure that a split integer store which is wider than the type size of the +; alloca (relying on the alloc size padding) doesn't trigger an assert. +; CHECK: @PR14572 + +entry: + %a = alloca <3 x i8>, align 4 +; CHECK-NOT: alloca + + %cast = bitcast <3 x i8>* %a to i32* + store i32 %x, i32* %cast, align 1 + %y = load <3 x i8>* %a, align 4 + ret <3 x i8> %y +; CHECK: ret <3 x i8> +} |

