Fix an LLVM assertion when matching against static strings

Fixes #8315
Fixes #11940
I was actually looking at this just now and yes, it should be doable!