[all-commits] [llvm/llvm-project] a9d6b0: [InstCombine] Fix big-endian miscompile of (bitcas...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Mon Dec 2 02:06:24 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a9d6b0e5444741d08ff1df7cf71d1559e7fefc1f
      https://github.com/llvm/llvm-project/commit/a9d6b0e5444741d08ff1df7cf71d1559e7fefc1f
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2019-12-02 (Mon, 02 Dec 2019)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/cast.ll

  Log Message:
  -----------
  [InstCombine] Fix big-endian miscompile of (bitcast (zext/trunc (bitcast)))

Summary:
optimizeVectorResize is rewriting patterns like:
  %1 = bitcast vector %src to integer
  %2 = trunc/zext %1
  %dst = bitcast %2 to vector

Since bitcasting between integer an vector types gives
different integer values depending on endianness, we need
to take endianness into account. As it happens the old
implementation only produced the correct result for little
endian targets.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=44178

Reviewers: spatel, lattner, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, hiraditya, uabelho, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70844




More information about the All-commits mailing list