[llvm] r199254 - Do pointer cast simplifications on addrspacecast
Matt Arsenault
Matthew.Arsenault at amd.com
Tue Jan 14 12:00:46 PST 2014
Author: arsenm
Date: Tue Jan 14 14:00:45 2014
New Revision: 199254
URL: http://llvm.org/viewvc/llvm-project?rev=199254&view=rev
Log:
Do pointer cast simplifications on addrspacecast
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/trunk/test/Transforms/InstCombine/getelementptr.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=199254&r1=199253&r2=199254&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Tue Jan 14 14:00:45 2014
@@ -1909,5 +1909,5 @@ Instruction *InstCombiner::visitBitCast(
}
Instruction *InstCombiner::visitAddrSpaceCast(AddrSpaceCastInst &CI) {
- return commonCastTransforms(CI);
+ return commonPointerCastTransforms(CI);
}
Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=199254&r1=199253&r2=199254&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Tue Jan 14 14:00:45 2014
@@ -789,4 +789,13 @@ define i16 @test41([3 x i32] addrspace(1
; 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 }
More information about the llvm-commits
mailing list