Reland [DataLayout] Fix occurrences that size and range of pointers are assumed to be the same.
GEP index size can be specified in the DataLayout, introduced in D42123. However, there were still places
in which getIndexSizeInBits was used interchangeably with getPointerSizeInBits. This notably caused issues
with Instcombine's visitPtrToInt; but the unit tests was incorrect, so this remained undiscovered.
This fixes the buildbot failures.
Differential Revision: https://reviews.llvm.org/D68328
Patch by Joseph Faulls!
diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
index 083cfe1..dc07eb2 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
@@ -33,10 +33,10 @@
define void @test1_ptr(i32* %V) {
; CHECK-LABEL: @test1_ptr(
-; CHECK-NEXT: [[MAGICPTR:%.*]] = ptrtoint i32* [[V:%.*]] to i32
-; CHECK-NEXT: switch i32 [[MAGICPTR]], label [[F:%.*]] [
-; CHECK-NEXT: i32 17, label [[T:%.*]]
-; CHECK-NEXT: i32 4, label [[T]]
+; CHECK-NEXT: [[MAGICPTR:%.*]] = ptrtoint i32* [[V:%.*]] to i40
+; CHECK-NEXT: switch i40 [[MAGICPTR]], label [[F:%.*]] [
+; CHECK-NEXT: i40 17, label [[T:%.*]]
+; CHECK-NEXT: i40 4, label [[T]]
; CHECK-NEXT: ]
; CHECK: T:
; CHECK-NEXT: call void @foo1()
@@ -59,10 +59,10 @@
define void @test1_ptr_as1(i32 addrspace(1)* %V) {
; CHECK-LABEL: @test1_ptr_as1(
-; CHECK-NEXT: [[MAGICPTR:%.*]] = ptrtoint i32 addrspace(1)* [[V:%.*]] to i32
-; CHECK-NEXT: switch i32 [[MAGICPTR]], label [[F:%.*]] [
-; CHECK-NEXT: i32 17, label [[T:%.*]]
-; CHECK-NEXT: i32 4, label [[T]]
+; CHECK-NEXT: [[MAGICPTR:%.*]] = ptrtoint i32 addrspace(1)* [[V:%.*]] to i40
+; CHECK-NEXT: switch i40 [[MAGICPTR]], label [[F:%.*]] [
+; CHECK-NEXT: i40 17, label [[T:%.*]]
+; CHECK-NEXT: i40 4, label [[T]]
; CHECK-NEXT: ]
; CHECK: T:
; CHECK-NEXT: call void @foo1()