When you inspect a Legendary or Exotic item check the "Mod' slot. If it has a Legendary mod it will be boosting the item by 5 power levels, all exotics should have this by default. The infusion is based on the Power level without this.
Two Items Without Legendary Mods: Lower Power item becomes the same power as the destroyed item
Two Items With Legendary Mods: Lower Power item becomes the same power as the destroyed item, this isn't really advisable as this type of item is quite valuable
Lower Power Item Has Legendary Mod Item Higher One Does Not: Lower Power item becomes 5 power levels higher than the destroyed item. Best case scenario.
Lower Power Item Does Not Have Legendary Item Higher One Does: Lower Power item becomes 5 power levels lower than the destroyed item, not a great idea.