This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Add fcmp UNDEF handling to SelectionDAG::FoldSetCC
ClosedPublic

Authored by RKSimon on Mar 29 2019, 11:56 AM.

Details

Summary

Second half of PR40800, this patch adds DAG undef handling to fcmp instructions to match the behaviour in llvm::ConstantFoldCompareInstruction, this permits constant folding of vector comparisons where some elements had been reduced to UNDEF (by SimplifyDemandedVectorElts etc.).

This involves a lot of tweaking to reduced tests as bugpoint loves to reduce fcmp arguments to undef........

I've gone through these tests best I can, and AFAICT I haven't changed their purposes in any critical way - many are fragile and difficult to reduce from scratch as they are often 5+ years old.... I'd appreciate it if the respective target specialists could check my changes.

While these pre-commit changes are getting approved, I'll start adding constant folding tests so we have proper coverage.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Mar 29 2019, 11:56 AM

I'm seeing issues with arm/fp16-instructions.ll against trunk - I'll update once I've got that fixed.

The Hexagon part is ok.

RKSimon updated this revision to Diff 192888.Mar 29 2019, 12:18 PM

rebased - includes arm\fp16-instructions.ll fixes as well.

The SystemZ test case change is fine with me, thanks!

The MIPS test change looks good.

RKSimon updated this revision to Diff 193060.Apr 1 2019, 4:03 AM

rebase with some additional constant folding tests

RKSimon updated this revision to Diff 193062.Apr 1 2019, 4:26 AM

Updated patch to prefer const+undef folding to fcmp setcc commutation

bogner accepted this revision.Apr 4 2019, 1:46 PM
bogner added a subscriber: bogner.

lgtm

This revision is now accepted and ready to land.Apr 4 2019, 1:46 PM
This revision was automatically updated to reflect the committed changes.