Created attachment 18213
reduced test case
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
stress_fail_bitcast_load.ll
(671 bytes, text/plain)