Fix an LLVM assertion when matching against static strings

Fixes #8315
Fixes #11940