[X86] Don't exit from foldOffsetIntoAddress if the Offset is 0, but AM.Disp is non...
authorCraig Topper <craig.topper@gmail.com>
Fri, 31 Jan 2020 05:23:05 +0000 (21:23 -0800)
committerCraig Topper <craig.topper@gmail.com>
Sat, 1 Feb 2020 19:26:17 +0000 (11:26 -0800)
commitd975910c50fb05b466f64beab1d43f8e8402bbdd
treef17ad991019ab55761ce3a898ec9401584b282ea
parent234f3b16918b5721bbc3449d11e4f317142271e7
[X86] Don't exit from foldOffsetIntoAddress if the Offset is 0, but AM.Disp is non-zero.

This is an alternate fix for the issue D73606 was trying to
solve.

The main issue here is that we bailed out of
foldOffsetIntoAddress if Offset is 0. But if we just found a
symbolic displacement and AM.Disp became non-zero
earlier, we still need to validate that AM.Disp with the symbolic
displacement.

This is my second attempt at committing this after failing
build bots previously. One thing I realized about the previous
attempt is that its possible that AM.Disp is already non-zero
and the new Offset changes it back to zero. In that case my
previous attempt failed to update AM.Disp to zero. So this patch
removes the early out for 0 and appropriately handle the 0 case
in each check so we still update AM.Disp at the end.
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp