[all-commits] [llvm/llvm-project] 52b449: [IR] fix crash in Constant::isElementWiseEqual() w...

RotateRight via All-commits all-commits at lists.llvm.org
Thu Jan 16 13:51:01 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 52b44902d059e68c6b5553c1d043f768c516064a
      https://github.com/llvm/llvm-project/commit/52b44902d059e68c6b5553c1d043f768c516064a
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-01-16 (Thu, 16 Jan 2020)

  Changed paths:
    M llvm/lib/IR/Constants.cpp
    M llvm/unittests/IR/ConstantsTest.cpp

  Log Message:
  -----------
  [IR] fix crash in Constant::isElementWiseEqual() with FP types

We lifted this code from InstCombine for general usage in:
rL369842
...but it's not safe as-is. There are no existing users that can
trigger this bug, but I discovered it via crashing several
regression tests when trying to use it for select folding in
InstSimplify.

ICmp requires (vector) integer types, so give up on anything that's
not integer or FP (pointers and ?) then bitcast the constants
before trying the match. That matches the definition of "equal or
undef" that I was looking for. If someone wants an FP-aware version
of equality (deal with NaN, -0.0), that could be a different mode
or different function.

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




More information about the All-commits mailing list