Do pointer cast simplifications on addrspacecast

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199254 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2014-01-14 20:00:45 +00:00
parent e16fa983bf
commit 0445dc203b
2 changed files with 10 additions and 1 deletions

View File

@ -1909,5 +1909,5 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
}
Instruction *InstCombiner::visitAddrSpaceCast(AddrSpaceCastInst &CI) {
return commonCastTransforms(CI);
return commonPointerCastTransforms(CI);
}

View File

@ -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 }