[GlobalISel] Fix G_ZEXTLOAD being converted to G_SEXTLOAD incorrectly.
authorAmara Emerson <amara@apple.com>
Sat, 18 Feb 2023 17:51:17 +0000 (09:51 -0800)
committerAmara Emerson <amara@apple.com>
Sat, 18 Feb 2023 18:05:08 +0000 (10:05 -0800)
commitddf167c442018e807819aa0b2e56546977870333
tree9bf15d9ca5f659b54ddb22042dad392942d58b86
parenta9a1950115d7db95c7439128b14af2cefe8f796d
[GlobalISel] Fix G_ZEXTLOAD being converted to G_SEXTLOAD incorrectly.

The extending loads combine tries to prefer sign-extends folding into loads vs
zexts, and in cases where a G_ZEXTLOAD is first used by a G_ZEXT, and then used
by a G_SEXT, it would select the G_SEXT even though the load is already
zero-extending.

Fixes issue #59630
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-extending-loads.mir