Refactor the favored-constraints optimization for binary expressions.
Refactor the favored-constraints optimization for binary expressions.

Pull the favored-constraints optimization for binary expressions out
into its own function. Use early exits to de-nest the code a few
levels, eliminate some dead code paths that couldn't actually occur,
replace a dyn_cast/.getPointer() dance with getAs<>, and and avoid
excess SmallVector traffic by only copying the "old" constraints in
cases where we might be added new ones (e.g., due to the synthesized
==). NFC



Swift SVN r22170

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