[PATCH] D34990: Fix endianness bug in DAGCombiner::visitTRUNCATE

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 10:26:55 PDT 2017


sdardis edited reviewers, added: sdardis; removed: llvm-commits.
sdardis added a comment.

You should upload patches with more context i.e. git diff -U9999.

I'm seeing the reported issue with MIPS, here's a testcase, you may need to file the rough edges off.

It can go in test/CodeGen/Mips/pr33682.ll

  ; RUN: llc -march=mips -mcpu=mips32  < %s | FileCheck --check-prefixes=ALL,BE
  ; RUN: llc -march=mipsel -mcpu=mips32  < %s | FileCheck --check-prefixes=ALL,LE
    
  ; Verify visitTRUNCATE respects endianness when transforming truncates to extract vector element.
  
  ; ALL-LABEL: a:
  ; BE: lw $2, 4($4)
  ; LE: lw $2, 0($4) 
    
  define i32 @a(<2 x i32> * %a) {
  entry:
    %0 = load <2 x i32>, <2 x i32> * %a
    %1 = bitcast <2 x i32> %0 to i64
    %2 = trunc i64 %1 to i32
    ret i32 %2
  }


https://reviews.llvm.org/D34990





More information about the llvm-commits mailing list