OSDN Git Service

Handle ConstantExpr correctly in SelectionDAGBuilder
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 9 Jul 2017 16:01:04 +0000 (16:01 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 9 Jul 2017 16:01:04 +0000 (16:01 +0000)
commit3b637f628162677a44dcf0622a8ec65c80aa76eb
treeb30dc8d4bc3541f617ba1f5fe2babfc1c98e672b
parent2bd71f2f17d732803936c74cfa26897551c8cb91
Handle ConstantExpr correctly in SelectionDAGBuilder

This change fixes a bug in SelectionDAGBuilder::visitInsertValue and SelectionDAGBuilder::visitExtractValue where constant expressions (InsertValueConstantExpr and ExtractValueConstantExpr) would be treated as non-constant instructions (InsertValueInst and ExtractValueInst). This bug resulted in an incorrect memory access, which manifested as an assertion failure in SDValue::SDValue.

Fixes PR#33094.

Submitted on behalf of @Praetonus (Benoit Vey)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307502 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/Generic/pr33094.ll [new file with mode: 0644]