Fixes the build issue with D111034, whose goal was to optimize
add/sub with long immediates.
Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
The change which fixed the build issue in D111034 was the use of new virtual
registers so that SSA form is maintained until deleting MI.
Testing:
Tested by replicating the 2 stage bootstage process using QEMU and Docker,
replicating an AArch64 Linux environment. The steps for the build process
are taken from the "clang-aarch64-full-2stage" BuildBot.
Ran a 2 stage build on a clean LLVM repo to verify the environment.
Ran a 2 stage build on D111034 which failed in when building stage 2.
Ran a 2 stage build of these changes and it built with no errors.
Notes on the Docker Environment:
To set up the environment, make sure to have QEMU and Docker installed then run
the following commands:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker run -it --entrypoint=/bin/bash linaro/ci-arm64-tcwg-llvmbot-ubuntu:bionic
I mounted my LLVM folder in the Docker container so that I could quickly edit
the source from my host environment.
Some of the tests will due to the QEMU environment, which I found when verifying
the clean branch of LLVM. These appear to mainly be associated with the
Compiler-RT, such as libFuzzer and some of the sanitizers.