[PATCH] D140993: [DAGCombine] fold (sext (sext_inreg x)) -> (sext (trunc x))

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 03:08:44 PST 2023


RKSimon added a comment.

If you're after test cases: https://gcc.godbolt.org/z/dPzYvz6dW - you might want to look to see why this isn't helping

This is from x86/sdiv_fix.ll which is currently repeating sign extensions: https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/X86/sdiv_fix.ll#L68:L71

        t2: i32,ch = CopyFromReg t0, Register:i32 %0
      t21: i16 = truncate t2
    t22: i16 = sign_extend_inreg t21, ValueType:ch:i8
  t53: i32 = sign_extend t22

  ; X64-NEXT:    movsbl %dil, %eax
  ; X64-NEXT:    movsbl %sil, %ecx
  ; X64-NEXT:    movswl %cx, %esi  ; <-- ECX IS ALREADY SIGN-EXTENDED FROM i8
  ; X64-NEXT:    movswl %ax, %ecx  ; <-- EAX IS ALREADY SIGN-EXTENDED FROM i8


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140993



More information about the llvm-commits mailing list