[PATCH] D120136: [ConstantRange] Construct constant range from xor operation
    Nikita Popov via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Feb 18 09:22:40 PST 2022
    
    
  
nikic added inline comments.
================
Comment at: llvm/lib/IR/ConstantRange.cpp:1429
+  const APInt OtherMin = Other.getSignedMin();
+  const APInt OtherMax = Other.getSignedMax();
+  if (Min.isNegative() == Max.isNegative() &&
----------------
I don't understand how signedness is relevant here. Can't you use Lower and Upper-1 here, independent of signedness?
================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:2531
+  EXPECT_EQ(R16_35.binaryXor(R0_99), ConstantRange::fromKnownBits(Known, true));
+  EXPECT_EQ(R0_99.binaryXor(R16_35), ConstantRange::fromKnownBits(Known, true));
 }
----------------
Please add an exhaustive correctness test.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120136/new/
https://reviews.llvm.org/D120136
    
    
More information about the llvm-commits
mailing list