[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)
authorSanjay Patel <spatel@rotateright.com>
Fri, 11 Dec 2020 21:18:56 +0000 (16:18 -0500)
committerSanjay Patel <spatel@rotateright.com>
Fri, 11 Dec 2020 22:23:35 +0000 (17:23 -0500)
commit204bdc5322cc89603d503fb1f02a0eba19a1b496
tree9cc0f8773f6212369edbf1eecc75c8332d9276ec
parent0d48d265db6633e4e575f81f9d3a52139b1dc5ca
[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)

This transform was added at:
c63799fc52ff

From what I see, it's the first demanded elements transform that adds
a new instruction using the IRBuilder. There are similar folds in
the generic demanded bits chunk of instcombine that also use the
InsertPointGuard code pattern.

The tests here would assert/crash because the new instruction was
being added at the start of the demanded elements analysis rather
than at the instruction that is being replaced.
llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
llvm/test/Transforms/InstCombine/X86/x86-addsub.ll