[Attributor] Compare an indirect call's callee in the program address space (#222097)
Specializing an indirect call emits, for each candidate callee, an
`icmp` between
the call's callee operand and the candidate. The operand was first
normalized to
address space 0, but the candidates are functions, and functions live in
the
target's program address space. Where that is not 0 the two sides of the
comparison had different types and the `icmp` asserted:
```
Instructions.h:1266: void llvm::ICmpInst::AssertOK(): Assertion
`getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to ICmp instruction are not of the same type!"' failed.
```
Normalize to the program address space instead. It is 0 unless a target
says
otherwise, so nothing changes for those; for `spirv64`, whose data
layout sets
`P9`, it is the difference between comparing a `ptr` with a `ptr
addrspace(9)`
and comparing two `ptr addrspace(9)`.
This was found on the `intel-sycl-gpu` builder, which crashed compiling
`offload/test/offloading/nested_parallel_reduction.c` for
`spirv64-intel` once
841d4ad6b315 let that call site reach the specialization path: before,
it took
the single-callee promotion path, which emits no comparison. The bug it
reached
is older than that commit and is not specific to OpenMP, so the test
added here
is a plain Attributor one that needs only a data layout with a non-zero
program
address space.