[llvm-commits] [llvm] r168280 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp test/Transforms/InstCombine/alloca.ll

Nick Lewycky nlewycky at google.com
Sat Nov 17 21:42:58 PST 2012


This one-line fix is safe, and is a regression from 3.1. Please integrate
this into the 3.2 branch.

On 17 November 2012 21:39, Nick Lewycky <nicholas at mxc.ca> wrote:

> Author: nicholas
> Date: Sat Nov 17 23:39:39 2012
> New Revision: 168280
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168280&view=rev
> Log:
> Don't try to calculate the alignment of an unsigned type. Fixes PR14371!
>
> Modified:
>     llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
>     llvm/trunk/test/Transforms/InstCombine/alloca.ll
>
> Modified:
> llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=168280&r1=168279&r2=168280&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
> Sat Nov 17 23:39:39 2012
> @@ -164,7 +164,8 @@
>        return TD.getPreferredAlignment(GV);
>
>    if (PointerType *PT = dyn_cast<PointerType>(V->getType()))
> -    return TD.getABITypeAlignment(PT->getElementType());
> +    if (PT->getElementType()->isSized())
> +      return TD.getABITypeAlignment(PT->getElementType());
>
>    return 0;
>  }
>
> Modified: llvm/trunk/test/Transforms/InstCombine/alloca.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/alloca.ll?rev=168280&r1=168279&r2=168280&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/alloca.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/alloca.ll Sat Nov 17 23:39:39
> 2012
> @@ -94,3 +94,19 @@
>    tail call void @f(i32* %b)
>    ret void
>  }
> +
> +; PR14371
> +%opaque_type = type opaque
> +%real_type = type { { i32, i32* } }
> +
> + at opaque_global = external constant %opaque_type, align 4
> +
> +define void @test7() {
> +entry:
> +  %0 = alloca %real_type, align 4
> +  %1 = bitcast %real_type* %0 to i8*
> +  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* bitcast (%opaque_type*
> @opaque_global to i8*), i32 8, i32 1, i1 false)
> +  ret void
> +}
> +
> +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture,
> i32, i32, i1) nounwind
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121117/66f6e512/attachment.html>


More information about the llvm-commits mailing list