llvm-stress crashes DAG.getLoad()
| Bugzilla Link | 32505 |
| Resolution | FIXED |
| Resolved on | Apr 06, 2017 12:59 |
| Version | trunk |
| OS | Linux |
| Attachments | reduced test case |
| CC | @efriedma-quic,@uweigand |
Extended Description
A small nonsense function looks like:
Optimized type-legalized selection DAG: BB#0 'autogen_SD5046:CF265' SelectionDAG has 9 nodes: t0: ch = EntryToken t27: i32,ch = load<LD1[undef+1], sext from i8> t0, undef:i64, undef:i64 t22: f32 = bitcast t27 t11: ch = CopyToReg t0, Register:f32 %vreg0, t22 t13: ch = CopyToReg t0, Register:f32 %vreg1, t22 t14: ch = TokenFactor t11, t13
SystemZTargetLowering::lowerBITCAST() calls DAG.getLoad() in the first if statement.
This causes an assert to trigger: assert(memvt.getStoreSize() <= MMO->getSize() && "Size mismatch!");
The problem here is that memvt.getStoreSize()==4, while MMO->getSize()==1. The load which has the 'sext from i8' flag, while it is only loading one byte.
How should this be handled? Should the load be expanded into load+sext somehow in the SystemZ method instead of calling getLoad() directly?
Run with llc -mtriple=s390x-linux-gnu -mcpu=zEC12 ./stress_fail_bitcast_load.ll
Fixed in rL299552.
https://reviews.llvm.org/D31609