[opaque pointer type] Add textual IR support for explicit type parameter to load instruction

Essentially the same as the GEP change in r230786.

A similar migration script can be used to update test cases, though a few more
test case improvements/changes were required this time around: (r229269-r229278)

import fileinput
import sys
import re

pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)")

for line in sys.stdin:
  sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line))

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7649

llvm-svn: 230794
diff --git a/llvm/test/Transforms/JumpThreading/2010-08-26-and.ll b/llvm/test/Transforms/JumpThreading/2010-08-26-and.ll
index 694bc8f..b6e19cb 100644
--- a/llvm/test/Transforms/JumpThreading/2010-08-26-and.ll
+++ b/llvm/test/Transforms/JumpThreading/2010-08-26-and.ll
@@ -30,7 +30,7 @@
   %indvar = phi i64 [ 0, %bb.nph ], [ %tmp146, %_ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit134 ] ; <i64> [#uses=1]
   %tmp146 = add i64 %indvar, 1                    ; <i64> [#uses=3]
   %arrayidx = getelementptr i8*, i8** %argv, i64 %tmp146 ; <i8**> [#uses=1]
-  %tmp6 = load i8** %arrayidx, align 8            ; <i8*> [#uses=8]
+  %tmp6 = load i8*, i8** %arrayidx, align 8            ; <i8*> [#uses=8]
   %call.i.i = call i64 @strlen(i8* %tmp6) nounwind ; <i64> [#uses=1]
   %conv.i.i = trunc i64 %call.i.i to i32          ; <i32> [#uses=6]\
 ; CHECK: switch i32 %conv.i.i
diff --git a/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll b/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
index 86a1321..ea9cc7f 100644
--- a/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
+++ b/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
@@ -15,7 +15,7 @@
   br i1 %cmp1179, label %for.cond1177, label %land.rhs1320
 
 land.rhs1320:
-  %tmp1324 = load volatile i64* getelementptr inbounds (%0* @g_338, i64 0, i32 2), align 1
+  %tmp1324 = load volatile i64, i64* getelementptr inbounds (%0* @g_338, i64 0, i32 2), align 1
   br label %if.end.i
 
 if.end.i:
diff --git a/llvm/test/Transforms/JumpThreading/crash.ll b/llvm/test/Transforms/JumpThreading/crash.ll
index 2fe8746..900a773 100644
--- a/llvm/test/Transforms/JumpThreading/crash.ll
+++ b/llvm/test/Transforms/JumpThreading/crash.ll
@@ -356,7 +356,7 @@
   br label %BrBlock
 
 BrBlock:
-  %L = load i32* %P
+  %L = load i32, i32* %P
   %C = icmp eq i32 %L, 42
   br i1 %C, label %T, label %F
   
diff --git a/llvm/test/Transforms/JumpThreading/landing-pad.ll b/llvm/test/Transforms/JumpThreading/landing-pad.ll
index 0237e74..b25f5fd 100644
--- a/llvm/test/Transforms/JumpThreading/landing-pad.ll
+++ b/llvm/test/Transforms/JumpThreading/landing-pad.ll
@@ -13,8 +13,8 @@
 define void @_ZN15EditCommandImpl5applyEv(%class.E* %this) uwtable align 2 {
 entry:
   %0 = bitcast %class.E* %this to void (%class.E*)***
-  %vtable = load void (%class.E*)*** %0, align 8
-  %1 = load void (%class.E*)** %vtable, align 8
+  %vtable = load void (%class.E*)**, void (%class.E*)*** %0, align 8
+  %1 = load void (%class.E*)*, void (%class.E*)** %vtable, align 8
   call void %1(%class.E* %this)
   ret void
 }
@@ -53,7 +53,7 @@
   store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
   %_ref.i.i.i = getelementptr inbounds i8, i8* %call, i64 8
   %1 = bitcast i8* %_ref.i.i.i to i32*
-  %2 = load i32* %1, align 4
+  %2 = load i32, i32* %1, align 4
   %inc.i.i.i = add nsw i32 %2, 1
   store i32 %inc.i.i.i, i32* %1, align 4
   %3 = bitcast i8* %call to %class.D*
@@ -76,7 +76,7 @@
 lpad1:                                            ; preds = %_ZN1DC1Ev.exit, %_ZN15EditCommandImpl5applyEv.exit
   %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
           cleanup
-  %6 = load i32* %1, align 4
+  %6 = load i32, i32* %1, align 4
   %tobool.i.i.i = icmp eq i32 %6, 0
   br i1 %tobool.i.i.i, label %_ZN1BI1DED1Ev.exit, label %if.then.i.i.i
 
@@ -101,7 +101,7 @@
   %m_ptr.i = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0
   store %class.D* %p1, %class.D** %m_ptr.i, align 8
   %_ref.i.i = getelementptr inbounds %class.D, %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
-  %0 = load i32* %_ref.i.i, align 4
+  %0 = load i32, i32* %_ref.i.i, align 4
   %inc.i.i = add nsw i32 %0, 1
   store i32 %inc.i.i, i32* %_ref.i.i, align 4
   ret void
@@ -116,7 +116,7 @@
 define %class.D* @_ZN1BI1DEptEv(%class.B* nocapture readonly %this) nounwind readonly uwtable align 2 {
 entry:
   %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0
-  %0 = load %class.D** %m_ptr, align 8
+  %0 = load %class.D*, %class.D** %m_ptr, align 8
   ret %class.D* %0
 }
 
@@ -125,9 +125,9 @@
 define void @_ZN1BI1DED1Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 {
 entry:
   %m_ptr.i = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0
-  %0 = load %class.D** %m_ptr.i, align 8
+  %0 = load %class.D*, %class.D** %m_ptr.i, align 8
   %_ref.i.i = getelementptr inbounds %class.D, %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
-  %1 = load i32* %_ref.i.i, align 4
+  %1 = load i32, i32* %_ref.i.i, align 4
   %tobool.i.i = icmp eq i32 %1, 0
   br i1 %tobool.i.i, label %_ZN1BI1DED2Ev.exit, label %if.then.i.i
 
@@ -147,9 +147,9 @@
 define void @_ZN1BI1DED2Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 {
 entry:
   %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0
-  %0 = load %class.D** %m_ptr, align 8
+  %0 = load %class.D*, %class.D** %m_ptr, align 8
   %_ref.i = getelementptr inbounds %class.D, %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
-  %1 = load i32* %_ref.i, align 4
+  %1 = load i32, i32* %_ref.i, align 4
   %tobool.i = icmp eq i32 %1, 0
   br i1 %tobool.i, label %_ZN1AI1CE5derefEv.exit, label %if.then.i
 
@@ -167,7 +167,7 @@
 define void @_ZN1AI1CE5derefEv(%class.A* nocapture readonly %this) nounwind uwtable align 2 {
 entry:
   %_ref = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0
-  %0 = load i32* %_ref, align 4
+  %0 = load i32, i32* %_ref, align 4
   %tobool = icmp eq i32 %0, 0
   br i1 %tobool, label %if.end, label %if.then
 
@@ -187,7 +187,7 @@
   %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0
   store %class.D* %p1, %class.D** %m_ptr, align 8
   %_ref.i = getelementptr inbounds %class.D, %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
-  %0 = load i32* %_ref.i, align 4
+  %0 = load i32, i32* %_ref.i, align 4
   %inc.i = add nsw i32 %0, 1
   store i32 %inc.i, i32* %_ref.i, align 4
   ret void
@@ -196,7 +196,7 @@
 define void @_ZN1AI1CE3refEv(%class.A* nocapture %this) nounwind uwtable align 2 {
 entry:
   %_ref = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0
-  %0 = load i32* %_ref, align 4
+  %0 = load i32, i32* %_ref, align 4
   %inc = add nsw i32 %0, 1
   store i32 %inc, i32* %_ref, align 4
   ret void
diff --git a/llvm/test/Transforms/JumpThreading/lvi-load.ll b/llvm/test/Transforms/JumpThreading/lvi-load.ll
index d2c4fa4..8c993ae 100644
--- a/llvm/test/Transforms/JumpThreading/lvi-load.ll
+++ b/llvm/test/Transforms/JumpThreading/lvi-load.ll
@@ -17,7 +17,7 @@
 define zeroext i8 @_Z3fooPN4llvm5ValueE(%"struct.llvm::Value"* %V) ssp {
 entry:
   %0 = getelementptr inbounds %"struct.llvm::Value", %"struct.llvm::Value"* %V, i64 0, i32 1 ; <i8*> [#uses=1]
-  %1 = load i8* %0, align 8                       ; <i8> [#uses=2]
+  %1 = load i8, i8* %0, align 8                       ; <i8> [#uses=2]
   %2 = icmp ugt i8 %1, 20                         ; <i1> [#uses=1]
   br i1 %2, label %bb.i, label %bb2
 
diff --git a/llvm/test/Transforms/JumpThreading/or-undef.ll b/llvm/test/Transforms/JumpThreading/or-undef.ll
index 6311b6d..b55bddd 100644
--- a/llvm/test/Transforms/JumpThreading/or-undef.ll
+++ b/llvm/test/Transforms/JumpThreading/or-undef.ll
@@ -32,13 +32,13 @@
   br i1 %tmp7, label %bb7, label %bb5
 
 bb5:                                              ; preds = %bb2
-  %tmp8 = load i8** %argv.0, align 8              ; <i8*> [#uses=1]
+  %tmp8 = load i8*, i8** %argv.0, align 8              ; <i8*> [#uses=1]
   %tmp9 = icmp eq i8* %tmp8, null                 ; <i1> [#uses=1]
   br i1 %tmp9, label %bb7, label %bb6
 
 bb6:                                              ; preds = %bb5
-  %tmp10 = load i8** %argv.0, align 8             ; <i8*> [#uses=1]
-  %tmp11 = load i8* %tmp10, align 1               ; <i8> [#uses=1]
+  %tmp10 = load i8*, i8** %argv.0, align 8             ; <i8*> [#uses=1]
+  %tmp11 = load i8, i8* %tmp10, align 1               ; <i8> [#uses=1]
   %tmp12 = icmp eq i8 %tmp11, 0                   ; <i1> [#uses=1]
   br i1 %tmp12, label %bb7, label %bb8
 
@@ -47,7 +47,7 @@
   br label %bb9
 
 bb8:                                              ; preds = %bb6
-  %tmp13 = load i8** %argv.0, align 8             ; <i8*> [#uses=1]
+  %tmp13 = load i8*, i8** %argv.0, align 8             ; <i8*> [#uses=1]
   %tmp14 = call i64 @f5(i8* %tmp13) nounwind      ; <i64> [#uses=0]
   br label %bb9
 
diff --git a/llvm/test/Transforms/JumpThreading/phi-eq.ll b/llvm/test/Transforms/JumpThreading/phi-eq.ll
index 78351ad..f158d7e 100644
--- a/llvm/test/Transforms/JumpThreading/phi-eq.ll
+++ b/llvm/test/Transforms/JumpThreading/phi-eq.ll
@@ -98,33 +98,33 @@
 get_filter_list.exit6:                            ; preds = %sw.bb3.i4, %sw.bb2.i3, %sw.bb1.i2, %sw.bb.i1
   %1 = phi %struct._GList** [ @display_edited_filters, %sw.bb3.i4 ], [ @capture_edited_filters, %sw.bb2.i3 ], [ @display_filters, %sw.bb1.i2 ], [ @capture_filters, %sw.bb.i1 ]
 ; CHECK: %2 = load
-  %2 = load %struct._GList** %1, align 8
+  %2 = load %struct._GList*, %struct._GList** %1, align 8
 ; We should have jump-threading insert an additional load here for the value
 ; coming out of the first switch, which is picked up by a subsequent phi
-; CHECK: %.pr = load %struct._GList** %0
+; CHECK: %.pr = load %struct._GList*, %struct._GList** %0
 ; CHECK-NEXT:  br label %while.cond
   br label %while.cond
 
 ; CHECK: while.cond
 while.cond:                                       ; preds = %while.body, %get_filter_list.exit6
 ; CHECK: {{= phi .*%.pr}}
-  %3 = load %struct._GList** %0, align 8
+  %3 = load %struct._GList*, %struct._GList** %0, align 8
 ; CHECK: tobool
   %tobool = icmp ne %struct._GList* %3, null
   br i1 %tobool, label %while.body, label %while.end
 
 while.body:                                       ; preds = %while.cond
-  %4 = load %struct._GList** %0, align 8
-  %5 = load %struct._GList** %0, align 8
+  %4 = load %struct._GList*, %struct._GList** %0, align 8
+  %5 = load %struct._GList*, %struct._GList** %0, align 8
   %call2 = call %struct._GList* @g_list_first(%struct._GList* %5)
   %data.i = getelementptr inbounds %struct._GList, %struct._GList* %call2, i32 0, i32 0
-  %6 = load i8** %data.i, align 8
+  %6 = load i8*, i8** %data.i, align 8
   %7 = bitcast i8* %6 to %struct.filter_def*
   %name.i = getelementptr inbounds %struct.filter_def, %struct.filter_def* %7, i32 0, i32 0
-  %8 = load i8** %name.i, align 8
+  %8 = load i8*, i8** %name.i, align 8
   call void @g_free(i8* %8) nounwind
   %strval.i = getelementptr inbounds %struct.filter_def, %struct.filter_def* %7, i32 0, i32 1
-  %9 = load i8** %strval.i, align 8
+  %9 = load i8*, i8** %strval.i, align 8
   call void @g_free(i8* %9) nounwind
   %10 = bitcast %struct.filter_def* %7 to i8*
   call void @g_free(i8* %10) nounwind
@@ -136,7 +136,7 @@
   br label %do.body4
 
 do.body4:                                         ; preds = %while.end
-  %11 = load %struct._GList** %0, align 8
+  %11 = load %struct._GList*, %struct._GList** %0, align 8
   %call5 = call i32 @g_list_length(%struct._GList* %11)
   %cmp6 = icmp eq i32 %call5, 0
   br i1 %cmp6, label %if.then7, label %if.else8
@@ -161,13 +161,13 @@
 
 while.body13:                                     ; preds = %while.cond11
   %data = getelementptr inbounds %struct._GList, %struct._GList* %cond10, i32 0, i32 0
-  %12 = load i8** %data, align 8
+  %12 = load i8*, i8** %data, align 8
   %13 = bitcast i8* %12 to %struct.filter_def*
-  %14 = load %struct._GList** %0, align 8
+  %14 = load %struct._GList*, %struct._GList** %0, align 8
   %name = getelementptr inbounds %struct.filter_def, %struct.filter_def* %13, i32 0, i32 0
-  %15 = load i8** %name, align 8
+  %15 = load i8*, i8** %name, align 8
   %strval = getelementptr inbounds %struct.filter_def, %struct.filter_def* %13, i32 0, i32 1
-  %16 = load i8** %strval, align 8
+  %16 = load i8*, i8** %strval, align 8
   %call.i7 = call noalias i8* @g_malloc(i64 16) nounwind
   %17 = bitcast i8* %call.i7 to %struct.filter_def*
   %call1.i = call noalias i8* @g_strdup(i8* %15) nounwind
@@ -184,7 +184,7 @@
 
 cond.true:                                        ; preds = %while.body13
   %next = getelementptr inbounds %struct._GList, %struct._GList* %cond10, i32 0, i32 1
-  %19 = load %struct._GList** %next, align 8
+  %19 = load %struct._GList*, %struct._GList** %next, align 8
   br label %cond.end
 
 cond.false:                                       ; preds = %while.body13
diff --git a/llvm/test/Transforms/JumpThreading/select.ll b/llvm/test/Transforms/JumpThreading/select.ll
index 545e86c..d0df772 100644
--- a/llvm/test/Transforms/JumpThreading/select.ll
+++ b/llvm/test/Transforms/JumpThreading/select.ll
@@ -135,7 +135,7 @@
 ; CHECK: icmp
 define void @test_switch_default(i32* nocapture %status) nounwind {
 entry:
-  %0 = load i32* %status, align 4
+  %0 = load i32, i32* %status, align 4
   switch i32 %0, label %L2 [
     i32 5061, label %L1
     i32 0, label %L2
@@ -146,7 +146,7 @@
   br label %L2
 
 L2:
-  %1 = load i32* %status, align 4
+  %1 = load i32, i32* %status, align 4
   %cmp57.i = icmp eq i32 %1, 0
   br i1 %cmp57.i, label %L3, label %L4
 
diff --git a/llvm/test/Transforms/JumpThreading/thread-loads.ll b/llvm/test/Transforms/JumpThreading/thread-loads.ll
index 4351f99..008eac7 100644
--- a/llvm/test/Transforms/JumpThreading/thread-loads.ll
+++ b/llvm/test/Transforms/JumpThreading/thread-loads.ll
@@ -21,7 +21,7 @@
 
 bb1:		; preds = %entry, %bb
 	%res.0 = phi i32 [ 1, %bb ], [ 0, %entry ]		; <i32> [#uses=2]
-	%2 = load i32* %P, align 4		; <i32> [#uses=1]
+	%2 = load i32, i32* %P, align 4		; <i32> [#uses=1]
 	%3 = icmp sgt i32 %2, 36		; <i1> [#uses=1]
 	br i1 %3, label %bb3, label %bb2
 
@@ -60,7 +60,7 @@
 
 bb1:		; preds = %entry, %bb
 	%res.0 = phi i32 [ 1, %bb ], [ 0, %entry ]
-	%2 = load i32* %P, align 4, !tbaa !0
+	%2 = load i32, i32* %P, align 4, !tbaa !0
 	%3 = icmp sgt i32 %2, 36
 	br i1 %3, label %bb3, label %bb2
 
@@ -83,16 +83,16 @@
 ; CHECK-LABEL: @test3(
 entry:
   %0 = bitcast i8** %x to i32**
-  %1 = load i32** %0, align 8
+  %1 = load i32*, i32** %0, align 8
   br i1 %f, label %if.end57, label %if.then56
-; CHECK: %[[LOAD:.*]] = load i32**
+; CHECK: %[[LOAD:.*]] = load i32*, i32**
 ; CHECK: %[[CAST:.*]] = bitcast i32* %[[LOAD]] to i8*
 
 if.then56:
   br label %if.end57
 
 if.end57:
-  %2 = load i8** %x, align 8
+  %2 = load i8*, i8** %x, align 8
   %tobool59 = icmp eq i8* %2, null
   br i1 %tobool59, label %return, label %if.then60
 ; CHECK: %[[PHI:.*]] = phi i8* [ %[[CAST]], %[[PRED:[^ ]+]] ], [ %[[CAST]], %[[PRED]] ]