llvm/test/CodeGen/X86/pr32515.ll
Nirav Dave e9ec240bfb [DAG] Avoid deleting nodes before combining them.
When replacing a node and it's operand, replacing the operand node may
cause the deletion of the original node leading to an assertion
failure. Case around these replacements to avoid this without relying
on inspecting the DELETED_NODE opcode in various extend
dagcombiner cases.

Fixes PR32515.

Reviewers: dbabokin, RKSimon, davide, chandlerc

Subscribers: chandlerc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 17:39:15 +00:00

30 lines
827 B
LLVM

; RUN: llc -O0 -mtriple=x86_64-unknown -mcpu=skx -o - %s
; RUN: llc -mtriple=x86_64-unknown -mcpu=skx -o - %s
; RUN: llc -O0 -mtriple=i686-unknown -mcpu=skx -o - %s
; RUN: llc -mtriple=i686-unknown -mcpu=skx -o - %s
; REQUIRES: asserts
@var_26 = external global i16, align 2
define void @foo() #0 {
%1 = alloca i16, align 2
%2 = load i16, i16* @var_26, align 2
%3 = zext i16 %2 to i32
%4 = icmp ne i32 %3, 7
%5 = zext i1 %4 to i16
store i16 %5, i16* %1, align 2
%6 = load i16, i16* @var_26, align 2
%7 = zext i16 %6 to i32
%8 = and i32 1, %7
%9 = shl i32 %8, 0
%10 = load i16, i16* @var_26, align 2
%11 = zext i16 %10 to i32
%12 = icmp ne i32 %11, 7
%13 = zext i1 %12 to i32
%14 = and i32 %9, %13
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i8
store i8 %16, i8* undef, align 1
unreachable
}