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)
commit55a4b6700f61f5a51a32e652368503b7583b971a
tree67a95e06eb84bc1ea47b6c3db72ccf73b8792967
parent983f7915ac9211fa4e97c506c94e49e7fb920411
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

llvm-svn: 307502
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/test/CodeGen/Generic/pr33094.ll [new file with mode: 0644]