[PATCH] D49919: [InstCombine] Fold Select with AND/OR condition

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 13:54:51 PDT 2018


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Ok, i think this looks good, other than nits.
Please wait a bit (1 day?) before committing in case others want to comment.



================
Comment at: lib/Analysis/InstructionSimplify.cpp:68-77
+/// Folds
+/// %A = icmp ne i8 %X, %V1
+/// %B = icmp ne i8 %X, %V2
+/// %C = or i1 %A, %B
+/// %D = select i1 %C, i8 %X, i8 %V1
+/// ret i8 %D
+/// =>
----------------
Maybe something like
```
/// Fold
///   %A = icmp ne/eq i8 %X, %V1
///   %B = icmp ne/eq i8 %X, %V2
///   %C = or/and i1 %A, %B
///   %D = select i1 %C, i8 %X, i8 %V1
/// To
///   %X/%V1
```



================
Comment at: lib/Analysis/InstructionSimplify.cpp:3792
 
+  if (Value *V = foldSelectWithBinaryOp(Cond, TrueVal, FalseVal))
+    return V;
----------------
Can we come up with more descriptive name?
I don't have any good ideas here.


https://reviews.llvm.org/D49919





More information about the llvm-commits mailing list