Adapt llvm_codegen.cpp to LLVM TOT (#70810)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70810
Adapt to LLVM top-of-tree APIs.
For context: LLVM is moving towards opaque pointers for IR values: https://llvm.org/docs/OpaquePointers.html
I also changed some `value->getScalarType()->getPointerElementType()` expressions to directly reference relevant types. This is simpler and more in line with the intentions of the opaque IR pointers. (In fact I would expect those expressions to break in the future). I did not fix places where the relevant type wasn't obvious to me though.
Test Plan:
-
```
$ cd fbsource/fbcode
$ tp2_update_fbcode llvm-fb --branch=staging
# symlinks point to d9c037cf2b4f0268cb1897b99c8c87c5d0232616 TP2 revision
$ buck build mode/opt-clang-thinlto unicorn:index_server -c unicorn.hfsort="1" -c cxx.profile="fbcode//fdo/autofdo/unicorn/index_server:autofdo" -c cxx.modules=False -c cxx.extra_cxxflags="-Wforce-no-error"
```
- Check sandcastle jobs
Reviewed By: modiking
Differential Revision: D33431503
fbshipit-source-id: 33f39d0a0c0f4b805ab877a811ea0a670f834abf