HPCC-12408 Various code generator optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
If it isn't the case it won't actually go wrong - it is really an optimization avoiding adding a table that will never be matched and avoiding a LINK()