This is an archive of the discontinued LLVM Phabricator instance.

Fix computeKnownBits for ARMISD::CMOV
ClosedPublic

Authored by pirama on Mar 22 2017, 3:40 PM.

Details

Summary

The true and false operands for the CMOV are operands 0 and 1.
ARMISelLowering.cpp::computeKnownBits was looking at operands 1 and 2
instead. This can cause CMOV instructions to be incorrectly folded into
BFI if value set by the CMOV is another CMOV, whose known bits are
computed incorrectly.

This patch fixes the issue and adds a test case.

Diff Detail

Repository
rL LLVM

Event Timeline

pirama created this revision.Mar 22 2017, 3:40 PM
jmolloy accepted this revision.Mar 23 2017, 2:28 AM

Ouch! LGTM, thanks!

This revision is now accepted and ready to land.Mar 23 2017, 2:28 AM
pirama updated this revision to Diff 92827.Mar 23 2017, 9:58 AM

Added '[ARM]' to commit message.

This revision was automatically updated to reflect the committed changes.