diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-07-09 16:01:04 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-07-09 16:01:04 +0000 |
| commit | 55a4b6700f61f5a51a32e652368503b7583b971a (patch) | |
| tree | 67a95e06eb84bc1ea47b6c3db72ccf73b8792967 /llvm/test | |
| parent | 983f7915ac9211fa4e97c506c94e49e7fb920411 (diff) | |
| download | bcm5719-llvm-55a4b6700f61f5a51a32e652368503b7583b971a.tar.gz bcm5719-llvm-55a4b6700f61f5a51a32e652368503b7583b971a.zip | |
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
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/Generic/pr33094.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/pr33094.ll b/llvm/test/CodeGen/Generic/pr33094.ll new file mode 100644 index 00000000000..afa464f63f6 --- /dev/null +++ b/llvm/test/CodeGen/Generic/pr33094.ll @@ -0,0 +1,18 @@ +; RUN: llc < %s + +; PR33094 +; Make sure that a constant extractvalue doesn't cause a crash in +; SelectionDAGBuilder::visitExtractValue. + +%A = type {} +%B = type {} +%Tuple = type { i64 } + +@A_Inst = global %A zeroinitializer +@B_Inst = global %B zeroinitializer + +define i64 @foo() { + ret i64 extractvalue (%Tuple select (i1 icmp eq + (%B* bitcast (%A* @A_Inst to %B*), %B* @B_Inst), + %Tuple { i64 33 }, %Tuple { i64 42 }), 0) +} |

