[PATCH] D31257: [ARM] PR32379 - fix CMOV operands in computeKnownBits

Ariel Ben-Yehuda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 13:15:51 PDT 2017

arielb1 created this revision.
Herald added subscribers: rengolin, aemerson.

ARMISD::CMOV has operands as the following:

  CMOV <on-false> <on-true> <armcc> <ccr> <cmp>

In particular, the return value of it is either operand 0 or operand 1, so computeKnownBits can return the mutually-known bits in these operands - it used to return the mutually-known bits in operands *1* and *2*, which was bogus.



Index: lib/Target/ARM/ARMISelLowering.cpp
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -11628,8 +11628,8 @@
   if (Op.getOpcode() == ARMISD::CMOV) {
     APInt KZ2(KnownZero.getBitWidth(), 0);
     APInt KO2(KnownOne.getBitWidth(), 0);
-    computeKnownBits(DAG, Op.getOperand(1), KnownZero, KnownOne);
-    computeKnownBits(DAG, Op.getOperand(2), KZ2, KO2);
+    computeKnownBits(DAG, Op.getOperand(0), KnownZero, KnownOne);
+    computeKnownBits(DAG, Op.getOperand(1), KZ2, KO2);
     KnownZero &= KZ2;
     KnownOne &= KO2;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31257.92695.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170322/ba8c48f2/attachment.bin>

More information about the llvm-commits mailing list