Revert "[DAG] Extend SearchForAndLoads with any_extend handling"
authorHans Wennborg <hans@chromium.org>
Tue, 18 Jan 2022 09:50:55 +0000 (10:50 +0100)
committerHans Wennborg <hans@chromium.org>
Tue, 18 Jan 2022 09:50:55 +0000 (10:50 +0100)
commitf4615feaa1fb686b12db518299a372d0c99824ae
treed1ede3fe500ad93d75850651d1e673bf0aba0fcc
parent9e68557e6437a7cb997cf571542b3638839dcaa0
Revert "[DAG] Extend SearchForAndLoads with any_extend handling"

This caused builds to fail with

  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5638:
  bool (anonymous namespace)::DAGCombiner::BackwardsPropagateMask(llvm::SDNode *):
  Assertion `NewLoad && "Shouldn't be masking the load if it can't be narrowed"' failed.

See the code review for a link to a reproducer.

> This extends the code in SearchForAndLoads to be able to look through
> ANY_EXTEND nodes, which can be created from mismatching IR types where
> the AND node we begin from only demands the low parts of the register.
> That turns zext and sext into any_extends as only the low bits are
> demanded. To be able to look through ANY_EXTEND nodes we need to handle
> mismatching types in a few places, potentially truncating the mask to
> the size of the final load.
>
> Differential Revision: https://reviews.llvm.org/D117457

This reverts commit 578008789fd061a88ce47dac6ff627001b404348.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/combine-andintoload.ll
llvm/test/CodeGen/X86/pr35763.ll
llvm/test/CodeGen/X86/pr35765.ll