[NFC] Optimize kernel traversal in CompileTimePropertiesPass. (#21434)
This patch improves KernelCache to capture kernels for any target rather
than just for NVPTX and AMDGCN. Use kernel information captured by the
KernelCache to traverse kernels in CompileTimePropertiesPass.
NOTE: KernelCache is also used by GlobalOffset.cpp, but corresponding
pass explictly applies only to modules with NVPTX and AMDGCN target
triples. This means that KernelCache improvement has no impact on
GlobalOffsetPass.