[InstCombine] PR58901 - fix bug with swapping GEP of different types
authorWilliam Huang <williamjhuang@google.com>
Thu, 10 Nov 2022 00:34:07 +0000 (00:34 +0000)
committerWilliam Huang <williamjhuang@google.com>
Thu, 10 Nov 2022 20:24:41 +0000 (20:24 +0000)
commitbd2b5ec8038e0256dead6f1650318e6c6150e02a
treebdbb9b9b8c43f53c972483a2dfa89071b49a11f1
parentfd8ba4f5373f426d134cf48b83f96869d5a27cbd
[InstCombine] PR58901 - fix bug with swapping GEP of different types

Fix https://github.com/llvm/llvm-project/issues/58901 by adding stricter check whether non-opaque GEP can be swapped. This will not affect GEP swapping optimization in the future since we are switching to opaque GEP

Reviewed By: clin1

Differential Revision: https://reviews.llvm.org/D137752
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/pr58901.ll [new file with mode: 0644]