Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

llvm-stress crashes DAG.getLoad() #31477

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR32505
Status RESOLVED FIXED
Importance P enhancement
Reported by Jonas Paulsson (paulsson@linux.vnet.ibm.com)
Reported on 2017-04-03 08:57:13 -0700
Last modified on 2017-04-06 12:59:38 -0700
Version trunk
Hardware PC Linux
CC efriedma@quicinc.com, llvm-bugs@lists.llvm.org, llvm-dev@ndave.org, uweigand@de.ibm.com
Fixed by commit(s)
Attachments stress_fail_bitcast_load.ll (671 bytes, text/plain)
Blocks
Blocked by
See also
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
Quuxplusone commented 7 years ago

Attached stress_fail_bitcast_load.ll (671 bytes, text/plain): reduced test case

Quuxplusone commented 7 years ago

https://reviews.llvm.org/D31609

Quuxplusone commented 7 years ago

Fixed in rL299552.