[llvm] r188529 - Add missing test for GEP + bitcast transformation
Matt Arsenault
Matthew.Arsenault at amd.com
Thu Aug 15 19:59:18 PDT 2013
Author: arsenm
Date: Thu Aug 15 21:59:17 2013
New Revision: 188529
URL: http://llvm.org/viewvc/llvm-project?rev=188529&view=rev
Log:
Add missing test for GEP + bitcast transformation
Modified:
llvm/trunk/test/Transforms/InstCombine/getelementptr.ll
Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=188529&r1=188528&r2=188529&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Thu Aug 15 21:59:17 2013
@@ -573,4 +573,28 @@ define i1 @pr16483([1 x i8]* %a, [1 x i8
; CHECK-NEXT: icmp ult [1 x i8]* %a, %b
}
+; The element size of the array matches the element size of the pointer
+define i64 @test_gep_bitcast_array_same_size_element([100 x double]* %arr, i64 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_same_size_element(
+; CHECK: getelementptr [100 x double]* %arr, i64 0, i64 %V
+; CHECK: bitcast
+ %cast = bitcast [100 x double]* %arr to i64*
+ %V = mul i64 %N, 8
+ %t = getelementptr i64* %cast, i64 %V
+ %x = load i64* %t
+ ret i64 %x
+}
+
+; The element size of the array is different the element size of the pointer
+define i8 @test_gep_bitcast_array_different_size_element([100 x double]* %arr, i64 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_different_size_element(
+; CHECK: getelementptr [100 x double]* %arr, i64 0, i64 %N
+; CHECK: bitcast
+ %cast = bitcast [100 x double]* %arr to i8*
+ %V = mul i64 %N, 8
+ %t = getelementptr i8* %cast, i64 %V
+ %x = load i8* %t
+ ret i8 %x
+}
+
; CHECK: attributes [[NUW]] = { nounwind }
More information about the llvm-commits
mailing list