This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] remove fdiv and frem from canOpTrap() (PR29114)
ClosedPublic

Authored by spatel on Aug 28 2016, 11:52 AM.

Details

Summary

Assuming the default FP env, we should not treat fdiv and frem any differently in terms of trapping behavior than any other FP op. Ie, FP ops do not trap with the default FP env.

This matches how we treat these ops in IR with isSafeToSpeculativelyExecute(). If this patch is correct, there's a similar bug in Constant::canTrap().

This bug manifests in PR29114:
https://llvm.org/bugs/show_bug.cgi?id=29114
...as a sequence of scalar divisions instead of a vector division on x86 for a <3 x float> type.

Diff Detail

Event Timeline

spatel updated this revision to Diff 69516.Aug 28 2016, 11:52 AM
spatel retitled this revision from to [TargetLowering] remove fdiv and frem from canOpTrap() (PR29114).
spatel updated this object.
spatel added reviewers: hfinkel, scanon, RKSimon.
spatel added a subscriber: llvm-commits.
hfinkel accepted this revision.Aug 28 2016, 11:56 AM
hfinkel edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 28 2016, 11:56 AM
This revision was automatically updated to reflect the committed changes.

Thanks, Hal. I committed the related change to Constant::canTrap() at rL279973 .