IRGen: Use local type metadata for generic downcasts.
IRGen: Use local type metadata for generic downcasts.

We can only directly use class metadata and swift_dynamicCastClass*  for a downcast to a concrete class. For generic classes we need to instantiate the metadata at runtime. Fixes <rdar://problem/14266071>.

Swift SVN r5804

kentya6/swift,harlanhaskins/swift,kusl/swift,uasys/swift,huonw/swift,jtbandes/swift,manavgabhawala/swift,shahmishal/swift,swiftix/swift.old,calebd/swift,tjw/swift,aschwaighofer/swift,nathawes/swift,amraboelela/swift,Ivacker/swift,cbrentharris/swift,aschwaighofer/swift,swiftix/swift.old,khizkhiz/swift,harlanhaskins/swift,allevato/swift,shajrawi/swift,parkera/swift,dduan/swift,modocache/swift,bitjammer/swift,kentya6/swift,calebd/swift,codestergit/swift,practicalswift/swift,gregomni/swift,OscarSwanros/swift,hooman/swift,huonw/swift,airspeedswift/swift,alblue/swift,sdulal/swift,manavgabhawala/swift,swiftix/swift.old,uasys/swift,shajrawi/swift,natecook1000/swift,therealbnut/swift,Jnosh/swift,kperryua/swift,gregomni/swift,kperryua/swift,djwbrown/swift,tardieu/swift,glessard/swift,uasys/swift,milseman/swift,harlanhaskins/swift,atrick/swift,shajrawi/swift,gottesmm/swift,SwiftAndroid/swift,shajrawi/swift,kusl/swift,frootloops/swift,practicalswift/swift,jtbandes/swift,kusl/swift,atrick/swift,slavapestov/swift,felix91gr/swift,ahoppen/swift,Jnosh/swift,hooman/swift,frootloops/swift,CodaFi/swift,sdulal/swift,tkremenek/swift,MukeshKumarS/Swift,mightydeveloper/swift,benlangmuir/swift,ben-ng/swift,parkera/swift,parkera/swift,Ivacker/swift,djwbrown/swift,jckarter/swift,practicalswift/swift,Jnosh/swift,SwiftAndroid/swift,airspeedswift/swift,russbishop/swift,KrishMunot/swift,cbrentharris/swift,kperryua/swift,djwbrown/swift,emilstahl/swift,lorentey/swift,swiftix/swift.old,sschiau/swift,nathawes/swift,aschwaighofer/swift,hughbe/swift,IngmarStein/swift,bitjammer/swift,gottesmm/swift,LeoShimonaka/swift,SwiftAndroid/swift,JaSpa/swift,aschwaighofer/swift,apple/swift,brentdax/swift,therealbnut/swift,gribozavr/swift,gmilos/swift,gmilos/swift,tardieu/swift,zisko/swift,KrishMunot/swift,tkremenek/swift,karwa/swift,CodaFi/swift,zisko/swift,amraboelela/swift,adrfer/swift,JaSpa/swift,karwa/swift,return/swift,sdulal/swift,glessard/swift,harlanhaskins/swift,Ivacker/swift,milseman/swift,natecook1000/swift,jtbandes/swift,russbishop/swift,tinysun212/swift-windows,CodaFi/swift,ken0nek/swift,kstaring/swift,aschwaighofer/swift,arvedviehweger/swift,IngmarStein/swift,apple/swift,slavapestov/swift,jmgc/swift,lorentey/swift,adrfer/swift,codestergit/swift,gribozavr/swift,benlangmuir/swift,sdulal/swift,JGiola/swift,karwa/swift,calebd/swift,kusl/swift,gmilos/swift,kperryua/swift,johnno1962d/swift,ben-ng/swift,practicalswift/swift,allevato/swift,modocache/swift,mightydeveloper/swift,kperryua/swift,kusl/swift,brentdax/swift,shahmishal/swift,jckarter/swift,kentya6/swift,stephentyrone/swift,return/swift,tinysun212/swift-windows,russbishop/swift,jmgc/swift,milseman/swift,atrick/swift,hughbe/swift,MukeshKumarS/Swift,OscarSwanros/swift,tjw/swift,calebd/swift,Ivacker/swift,alblue/swift,zisko/swift,karwa/swift,devincoughlin/swift,practicalswift/swift,calebd/swift,jopamer/swift,emilstahl/swift,LeoShimonaka/swift,jckarter/swift,roambotics/swift,harlanhaskins/swift,jopamer/swift,milseman/swift,IngmarStein/swift,tardieu/swift,tjw/swift,danielmartin/swift,MukeshKumarS/Swift,xedin/swift,rudkx/swift,lorentey/swift,shahmishal/swift,huonw/swift,apple/swift,atrick/swift,LeoShimonaka/swift,amraboelela/swift,deyton/swift,swiftix/swift,sschiau/swift,swiftix/swift,CodaFi/swift,sschiau/swift,slavapestov/swift,milseman/swift,kstaring/swift,shajrawi/swift,kusl/swift,karwa/swift,parkera/swift,uasys/swift,cbrentharris/swift,gregomni/swift,roambotics/swift,allevato/swift,harlanhaskins/swift,nathawes/swift,tinysun212/swift-windows,parkera/swift,return/swift,russbishop/swift,rudkx/swift,tardieu/swift,hooman/swift,Jnosh/swift,natecook1000/swift,jtbandes/swift,aschwaighofer/swift,dduan/swift,nathawes/swift,hughbe/swift,jmgc/swift,SwiftAndroid/swift,OscarSwanros/swift,khizkhiz/swift,codestergit/swift,frootloops/swift,amraboelela/swift,sdulal/swift,kstaring/swift,lorentey/swift,mightydeveloper/swift,stephentyrone/swift,JGiola/swift,swiftix/swift.old,LeoShimonaka/swift,alblue/swift,lorentey/swift,roambotics/swift,cbrentharris/swift,Ivacker/swift,djwbrown/swift,kstaring/swift,gribozavr/swift,gregomni/swift,IngmarStein/swift,JGiola/swift,danielmartin/swift,ken0nek/swift,IngmarStein/swift,ken0nek/swift,practicalswift/swift,ken0nek/swift,arvedviehweger/swift,ahoppen/swift,ben-ng/swift,bitjammer/swift,danielmartin/swift,emilstahl/swift,swiftix/swift,swiftix/swift,jmgc/swift,hooman/swift,felix91gr/swift,modocache/swift,tjw/swift,karwa/swift,shahmishal/swift,arvedviehweger/swift,kstaring/swift,codestergit/swift,khizkhiz/swift,Jnosh/swift,shahmishal/swift,djwbrown/swift,shajrawi/swift,karwa/swift,khizkhiz/swift,jopamer/swift,bitjammer/swift,ben-ng/swift,tinysun212/swift-windows,emilstahl/swift,shajrawi/swift,rudkx/swift,kentya6/swift,gottesmm/swift,bitjammer/swift,manavgabhawala/swift,deyton/swift,manavgabhawala/swift,roambotics/swift,mightydeveloper/swift,johnno1962d/swift,rudkx/swift,manavgabhawala/swift,shahmishal/swift,gribozavr/swift,benlangmuir/swift,codestergit/swift,danielmartin/swift,stephentyrone/swift,codestergit/swift,hughbe/swift,rudkx/swift,sdulal/swift,tinysun212/swift-windows,alblue/swift,ahoppen/swift,roambotics/swift,shajrawi/swift,CodaFi/swift,devincoughlin/swift,JGiola/swift,xwu/swift,russbishop/swift,felix91gr/swift,russbishop/swift,zisko/swift,tkremenek/swift,swiftix/swift.old,arvedviehweger/swift,hughbe/swift,natecook1000/swift,cbrentharris/swift,allevato/swift,emilstahl/swift,gribozavr/swift,kentya6/swift,frootloops/swift,slavapestov/swift,brentdax/swift,deyton/swift,karwa/swift,mightydeveloper/swift,jopamer/swift,austinzheng/swift,allevato/swift,kperryua/swift,emilstahl/swift,atrick/swift,JGiola/swift,SwiftAndroid/swift,nathawes/swift,xedin/swift,manavgabhawala/swift,deyton/swift,xedin/swift,therealbnut/swift,sschiau/swift,adrfer/swift,JGiola/swift,xedin/swift,dduan/swift,modocache/swift,amraboelela/swift,MukeshKumarS/Swift,amraboelela/swift,tkremenek/swift,austinzheng/swift,parkera/swift,sdulal/swift,austinzheng/swift,deyton/swift,benlangmuir/swift,jmgc/swift,gottesmm/swift,uasys/swift,modocache/swift,arvedviehweger/swift,kstaring/swift,sdulal/swift,JaSpa/swift,jtbandes/swift,xedin/swift,tjw/swift,sschiau/swift,zisko/swift,roambotics/swift,gottesmm/swift,milseman/swift,stephentyrone/swift,natecook1000/swift,Jnosh/swift,felix91gr/swift,ken0nek/swift,JaSpa/swift,hooman/swift,KrishMunot/swift,manavgabhawala/swift,Ivacker/swift,return/swift,ben-ng/swift,gmilos/swift,airspeedswift/swift,khizkhiz/swift,hooman/swift,danielmartin/swift,dreamsxin/swift,austinzheng/swift,cbrentharris/swift,deyton/swift,gottesmm/swift,cbrentharris/swift,airspeedswift/swift,JaSpa/swift,tardieu/swift,tardieu/swift,xedin/swift,SwiftAndroid/swift,MukeshKumarS/Swift,return/swift,CodaFi/swift,danielmartin/swift,swiftix/swift.old,stephentyrone/swift,gregomni/swift,cbrentharris/swift,shahmishal/swift,xwu/swift,adrfer/swift,brentdax/swift,hughbe/swift,felix91gr/swift,LeoShimonaka/swift,jtbandes/swift,sschiau/swift,sschiau/swift,dduan/swift,glessard/swift,adrfer/swift,therealbnut/swift,gribozavr/swift,johnno1962d/swift,danielmartin/swift,calebd/swift,gribozavr/swift,allevato/swift,russbishop/swift,apple/swift,frootloops/swift,khizkhiz/swift,glessard/swift,IngmarStein/swift,airspeedswift/swift,brentdax/swift,tinysun212/swift-windows,brentdax/swift,austinzheng/swift,ahoppen/swift,milseman/swift,benlangmuir/swift,kentya6/swift,jopamer/swift,natecook1000/swift,IngmarStein/swift,sschiau/swift,kperryua/swift,KrishMunot/swift,LeoShimonaka/swift,jckarter/swift,uasys/swift,devincoughlin/swift,huonw/swift,bitjammer/swift,zisko/swift,xwu/swift,lorentey/swift,huonw/swift,aschwaighofer/swift,nathawes/swift,OscarSwanros/swift,arvedviehweger/swift,parkera/swift,tkremenek/swift,ben-ng/swift,KrishMunot/swift,emilstahl/swift,mightydeveloper/swift,adrfer/swift,stephentyrone/swift,johnno1962d/swift,mightydeveloper/swift,tjw/swift,amraboelela/swift,devincoughlin/swift,Jnosh/swift,swiftix/swift,bitjammer/swift,kentya6/swift,CodaFi/swift,parkera/swift,swiftix/swift.old,practicalswift/swift,airspeedswift/swift,glessard/swift,gmilos/swift,jmgc/swift,khizkhiz/swift,dduan/swift,JaSpa/swift,stephentyrone/swift,devincoughlin/swift,SwiftAndroid/swift,OscarSwanros/swift,rudkx/swift,therealbnut/swift,glessard/swift,felix91gr/swift,uasys/swift,kusl/swift,Ivacker/swift,alblue/swift,devincoughlin/swift,modocache/swift,slavapestov/swift,kentya6/swift,OscarSwanros/swift,modocache/swift,jmgc/swift,codestergit/swift,alblue/swift,ben-ng/swift,practicalswift/swift,hughbe/swift,tjw/swift,johnno1962d/swift,jckarter/swift,KrishMunot/swift,MukeshKumarS/Swift,jopamer/swift,gmilos/swift,devincoughlin/swift,tinysun212/swift-windows,return/swift,therealbnut/swift,ahoppen/swift,therealbnut/swift,jckarter/swift,xwu/swift,harlanhaskins/swift,zisko/swift,xedin/swift,allevato/swift,xwu/swift,ken0nek/swift,felix91gr/swift,LeoShimonaka/swift,apple/swift,alblue/swift,tkremenek/swift,xwu/swift,JaSpa/swift,djwbrown/swift,xwu/swift,johnno1962d/swift,deyton/swift,ahoppen/swift,KrishMunot/swift,airspeedswift/swift,xedin/swift,slavapestov/swift,OscarSwanros/swift,frootloops/swift,Ivacker/swift,apple/swift,arvedviehweger/swift,calebd/swift,austinzheng/swift,emilstahl/swift,jopamer/swift,lorentey/swift,nathawes/swift,hooman/swift,huonw/swift,gribozavr/swift,mightydeveloper/swift,johnno1962d/swift,brentdax/swift,tkremenek/swift,gmilos/swift,jtbandes/swift,atrick/swift,jckarter/swift,dduan/swift,shahmishal/swift,swiftix/swift,kstaring/swift,dreamsxin/swift,LeoShimonaka/swift,gottesmm/swift,kusl/swift,return/swift,adrfer/swift,huonw/swift,lorentey/swift,ken0nek/swift,natecook1000/swift,slavapestov/swift,gregomni/swift,tardieu/swift,austinzheng/swift,dduan/swift,MukeshKumarS/Swift,benlangmuir/swift,frootloops/swift,devincoughlin/swift,swiftix/swift,djwbrown/swift