llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm-stress causes DAGCombiner crash

Open JonPsson opened this issue 9 years ago • 2 comments

Bugzilla Link 32372
Resolution FIXED
Resolved on Mar 28, 2017 07:26
Version trunk
OS Linux
Attachments reduced test case
CC @efriedma-quic,@jmolloy

Extended Description

Reduced test case, when run with

llc -mtriple=s390x-linux-gnu -mcpu=z13

results in

llc: /home/jonas/llvm/llvm-dev/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:746: bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.

At first glance, it seems that the CombineTo(N, (N0.getNode() == Load) ? NewLoad : N0); in visitAND() should be guarded with a check if N or N0 has already been deleted?


backtracking:

21: DAG.dump() = SelectionDAG has 21 nodes: t0: ch = EntryToken t2: i64,ch = CopyFromReg t0, Register:i64 %vreg2 t32: i32,ch = load<LD1[%0], zext from i8> t0, t2, undef:i64 t38: i32,ch = load<LD1[%0], anyext from i8> t0, t2, undef:i64 t44: i32 = Constant<-1> t41: i32 = and t32, Constant:i32<255> t42: i32 = and t38, Constant:i32<255> t43: i32 = urem t41, t42 t22: v16i8 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, t43, undef:i32, undef:i32, undef:i32, undef:i32, undef:i32, undef:i32, undef:i32, undef:i32 t24: ch = CopyToReg t0, Register:v16i8 %vreg0, t22 t28: ch = CopyToReg t0, Register:i32 %vreg1, t32 t39: ch = store<ST2[undef], trunc to i16> t38:1, Constant:i32<-3825>, undef:i64, undef:i64 t29: ch = TokenFactor t24, t28, t39

Combining: t42: i32 = and t38, Constant:i32<255>

SDValue DAGCombiner::visitAND() ->

(gdb) p N->dump() t42: i32 = and t38, Constant:i32<255> CombineTo(Load, NewLoad.getValue(0), NewLoad.getValue(1)); (gdb) p N0->dump()

t38: i32,ch = load<LD1[%0], anyext from i8> t0, t2, undef:i64 ->

(gdb) p N->dump() t42: i32 = <<Deleted Node!>> (gdb) p N0->dump() t38: i32,ch = <<Deleted Node!>>

// Fold the AND away, taking care not to fold to the old load node if we // replaced it. CombineTo(N, (N0.getNode() == Load) ? NewLoad : N0); ->

Replacing.1 t42: i32 = <<Deleted Node!>>

With: t32: i32,ch = load<LD1[%0], zext from i8> t0, t2, undef:i64 and 0 other values llc: /home/jonas/llvm/llvm-dev/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:746: bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.

JonPsson avatar Mar 22 '17 14:03 JonPsson

r298920

llvmbot avatar Mar 28 '17 14:03 llvmbot

https://reviews.llvm.org/D31346

JonPsson avatar Mar 25 '17 07:03 JonPsson