[all-commits] [llvm/llvm-project] d077d6: [ValueTracking] Avoid blind cast from Operator to ...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Sun Mar 22 06:46:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d077d678d34efdb811e6e2e05ef4417770806d1b
      https://github.com/llvm/llvm-project/commit/d077d678d34efdb811e6e2e05ef4417770806d1b
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2020-03-22 (Sun, 22 Mar 2020)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    A llvm/test/Analysis/ValueTracking/known-bits-from-operator-constexpr.ll

  Log Message:
  -----------
  [ValueTracking] Avoid blind cast from Operator to Instruction

Summary:
Avoid blind cast from Operator to ExtractElementInst in
computeKnownBitsFromOperator. This resulted in some crashes
in downstream fuzzy testing. Instead we use getOperand directly
on the Operator when accessing the vector/index operands.

Haven't seen any problems with InsertElement and ShuffleVector,
but I believe those could be used in constant expressions as well.
So the same kind of fix as for ExtractElement was also applied for
InsertElement.

When it comes to ShuffleVector we now simply bail out if a dynamic
cast of the Operator to ShuffleVectorInst fails. I've got no
reproducer indicating problems for ShuffleVector, and a fix would be
slightly more complicated as getShuffleDemandedElts is involved.

Reviewers: RKSimon, nikic, spatel, efriedma

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list