[llvm] [GlobalISel] Take the result size into account when const folding icmp (PR #134365)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 04:32:33 PDT 2025


================
@@ -500,6 +500,18 @@ TEST_F(AArch64GISelMITest, TestConstantFoldICMP) {
     EXPECT_TRUE(I->getOperand(1).getCImm()->getZExtValue());
   }
 
+  {
+    auto I = CSEB.buildICmp(CmpInst::Predicate::ICMP_EQ, s32, One, One);
+    EXPECT_TRUE(I->getOpcode() == TargetOpcode::G_CONSTANT);
+    EXPECT_TRUE(I->getOperand(1).getCImm()->getZExtValue());
----------------
arsenm wrote:

EXPECT_EQ with exact value 

https://github.com/llvm/llvm-project/pull/134365


More information about the llvm-commits mailing list