[PATCH] D146121: [DAG] Move lshr narrowing from visitANDLike to SimplifyDemandedBits (WIP)

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 12:41:10 PDT 2023


kazu added inline comments.


================
Comment at: llvm/test/CodeGen/X86/h-register-addressing-64.ll:67
+; CHECK-NEXT:    andl $2040, %esi # imm = 0x7F8
+; CHECK-NEXT:    movzbl (%rdi,%rsi), %eax
 ; CHECK-NEXT:    retq
----------------
goldstein.w.n wrote:
> I think this is okay here. We only get the right codegen by chance here and I don't think its something we can reasonably control during DAG isel.
> 
> I tried to improve this with D141653. Looked good for the tests but caused infinite loop in bootstrap build.
> 
> I think this (along with other `imm` level optimizations), need to be moved to a new pass (or function in isel) that runs at the very end.
> > think this (along with other `imm` level optimizations), need to be moved to a new pass (or function in isel) that runs at the very end.

I was just thinking about something similar.  Specifically, optimizations to achieve smaller encoding with the same opcode should move to a new pass.  Otherwise, we would have to see through `ISD::ZERO_EXTEND` and `ISD::TRUNCATE` everywhere, and that would be prone to missed optimizations.

Do we have known bits and demanded bits infrastructure at the x86 MIR level?  (I'm guessing not.)  Also, I am wondering whether a new pass would be more effective if we use information across basic blocks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146121/new/

https://reviews.llvm.org/D146121



More information about the llvm-commits mailing list