[DAGCombine] Handle promotion of shift with both operands the same
authorNikita Popov <npopov@redhat.com>
Thu, 2 Jun 2022 15:09:07 +0000 (17:09 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 3 Jun 2022 08:00:44 +0000 (10:00 +0200)
commitad742cf85da105c9374aa24764b30f5ff668e361
tree9a778991b12ad38e8748198190cee909534d76e5
parentc698189696d33e7304d94cd4212bd81818ea81a0
[DAGCombine] Handle promotion of shift with both operands the same

When promoting a shift, make sure we only fetch the second operand
after promoting the first. Load promotion may replace users of the
old load, and we don't want to be left with a dangling reference to
the old load instruction.

The crashing test case is from https://reviews.llvm.org/D126689#3553212.

Differential Revision: https://reviews.llvm.org/D126886
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/promote-sra-by-itself.ll [new file with mode: 0644]