[llvm] [IR][TRE] Support associative intrinsics (PR #74226)

Joshua Cao via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 3 14:31:49 PST 2023


================
@@ -2556,6 +2556,32 @@ Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty,
   }
 }
 
+Constant *ConstantExpr::getIntrinsicIdentity(Intrinsic::ID ID, Type *Ty) {
+  switch (ID) {
+  case Intrinsic::umax:
----------------
caojoshua wrote:

I don't think that is right. `getSaturationPoint()` is getting us the opposite. We want identity `I` such that `op(C, I) == C`. By using the saturaiton point, we get `op(C, I) == I`.

For example, the saturation point for `umax` int is 2^32-1. Then anything we umax against will still be 2^32-1.

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


More information about the llvm-commits mailing list