This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fix handling of div_scale with undef inputs
ClosedPublic

Authored by arsenm on Jul 13 2017, 11:28 AM.

Details

Reviewers
tstellar
rampitec
Summary

The src0 register must match src1 or src2, but if these
were undefined they could end up using different implicit_defed
virtual registers. Force these to use one undef vreg or pick the
defined other register.

Also fixes producing invalid nodes without the right number of
inputs when src2 is undef.

Diff Detail

Event Timeline

arsenm created this revision.Jul 13 2017, 11:28 AM
rampitec added inline comments.Aug 1 2017, 12:35 PM
lib/Target/AMDGPU/SIISelLowering.cpp
3625

Is it really needed? If the parameter required to be a constant why not just error out?

arsenm added inline comments.Aug 1 2017, 12:44 PM
lib/Target/AMDGPU/SIISelLowering.cpp
3625

Yes. If using a proper error message (i.e. not report_fatal_error) there isn't a way to abort the compilation here and you still need to produce something. The problem here before was the type didn't match since this expects to produce 2 values.

3625

undef also is a constant, just not a ConstantInt

This revision is now accepted and ready to land.Aug 1 2017, 12:47 PM
arsenm closed this revision.Aug 1 2017, 1:50 PM

r309743