From: Matt Arsenault Date: Tue, 14 Jan 2014 20:00:45 +0000 (+0000) Subject: Do pointer cast simplifications on addrspacecast X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0445dc203b0e4001a153d9af4bd75f5242401d06;p=oota-llvm.git Do pointer cast simplifications on addrspacecast git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199254 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp index 2e7ec11391f..71990a27ac0 100644 --- a/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -1909,5 +1909,5 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { } Instruction *InstCombiner::visitAddrSpaceCast(AddrSpaceCastInst &CI) { - return commonCastTransforms(CI); + return commonPointerCastTransforms(CI); } diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index c29a7dccb8e..394cfa74c78 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -789,4 +789,13 @@ define i16 @test41([3 x i32] addrspace(1)* %array) { ; CHECK-NEXT: ret i16 8 } +define i32 addrspace(1)* @ascast_0_gep([128 x i32]* %p) nounwind { +; CHECK-LABEL: @ascast_0_gep( +; CHECK-NOT: getelementptr +; CHECK: ret + %gep = getelementptr [128 x i32]* %p, i32 0, i32 0 + %x = addrspacecast i32* %gep to i32 addrspace(1)* + ret i32 addrspace(1)* %x +} + ; CHECK: attributes [[NUW]] = { nounwind }