[PATCH] Fix urem instruction with power of two to compute known bit.

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu May 22 14:41:07 PDT 2014


LGTM with a code nit and a test change.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2198
@@ +2197,3 @@
+        // The low bits of the first operand are unchanged by the urem.
+        KnownZero = KnownZero2 & LowBits;
+        KnownOne = KnownOne2 & LowBits;
----------------
This assignment is redundant. How about just

// The upper bits are all zero, the lower ones are unchanged.
KnownOne = KnownOne2 & LowBits;
KnownZero = KnowZero2 | ~LowBits;

================
Comment at: test/CodeGen/Generic/computeKnownBits_urem.ll:1
@@ +1,2 @@
+; RUN: llc -debug %s -o /dev/null 2>&1 | FileCheck %s
+define i32 @main() #0 {
----------------
This should probably also check the generated assembly. It is fine to move it to a cpu specific directory and use a -mtriple.

http://reviews.llvm.org/D3823






More information about the llvm-commits mailing list