[llvm] [Reassociate] Drop weight reduction to fix issue 91417 (PR #91469)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 01:26:21 PDT 2024


================
@@ -1,69 +1,100 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt < %s -passes=reassociate -S | FileCheck %s
 
 ; Tests involving repeated operations on the same value.
 
 define i8 @nilpotent(i8 %x) {
-; CHECK-LABEL: @nilpotent(
+; CHECK-LABEL: define i8 @nilpotent(
+; CHECK-SAME: i8 [[X:%.*]]) {
+; CHECK-NEXT:    ret i8 0
+;
   %tmp = xor i8 %x, %x
   ret i8 %tmp
-; CHECK: ret i8 0
 }
 
 define i2 @idempotent(i2 %x) {
-; CHECK-LABEL: @idempotent(
+; CHECK-LABEL: define i2 @idempotent(
+; CHECK-SAME: i2 [[X:%.*]]) {
+; CHECK-NEXT:    ret i2 -1
----------------
dtcxzyw wrote:

> But we are using finite precision arithmetic, and the APInt sum LHS + RHS may not be correct if it wraps (it is correct for nilpotent operations and addition, but not for idempotent operations and multiplication)

We need to rework this patch.



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


More information about the llvm-commits mailing list