[X86] Check MI.isConvertibleTo3Addr() before calling convertToThreeAddress in X86Fixu...
authorCraig Topper <craig.topper@intel.com>
Tue, 2 Apr 2019 20:52:10 +0000 (20:52 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 2 Apr 2019 20:52:10 +0000 (20:52 +0000)
commitffd8662558b8db500117c92d16f6f82edbc894a7
tree22d5f8375eca307524ef6f741fcbc48d55a4ffc3
parentb64f915ae0fdd3b6d0a46f17b2d30367f2d56c0b
[X86] Check MI.isConvertibleTo3Addr() before calling convertToThreeAddress in X86FixupLEAs.

X86FixupLEAs just assumes convertToThreeAddress will return nullptr for any instruction that isn't convertible.

But the code in convertToThreeAddress for X86 assumes that any instruction coming in has at least 2 operands and that the second one is a register. But those properties aren't guaranteed of all instructions. We should check the instruction property first.

llvm-svn: 357528
llvm/lib/Target/X86/X86FixupLEAs.cpp