1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/CodeGen/Generic/pr33094.ll
Simon Pilgrim 78bcdd73d3 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
2017-07-09 16:01:04 +00:00

19 lines
469 B
LLVM

; 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)
}