The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This reassociates it back to allow the creation of more mls instructions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The patch looks good to me, but I was just wondering if another approach would be to just match the sub(x, add(m1, m2)). pattern as mls, or is this easier/better?
Thats for taking a look. That might be an option, but it would need to match sub(x, add(mul(a,b), mul(c,d))) to two msub(msub(x, a, b), c, d) for all the different types of mls. I think it is probably simpler to go the un-reassociate route.
This caused hangs when compiling some source files from ffmpeg, libvpx and libaom. One repro is available at https://martin.st/temp/adxenc.c, triggered with clang -target aarch64-w64-mingw32 -c -O2 adxenc.c -w.
I’ll push a revert soon.
Thanks for the report. I had somehow missed vector constants even though scalars were being correctly handled. I thought I had added tests for them but apparently not.
It might be good to use the same names here as in the comment above, i.e. m1 and m2?