Revert "Revert "Simplify some code and make it easier to understand.""
Revert "Revert "Simplify some code and make it easier to understand.""

This reverts commit r25949, reinstating r25941.

This had been preemptively reverted fearing it might have broken
test/SILPasses/devirt_value_metatypes.swift, but that turned out to not
have been the case.

Swift SVN r25956

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