[PATCH] D49975: [InstSimplify] Fold another Select with And/Or pattern

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 07:00:40 PDT 2018


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

LGTM with 1 more comment fix.



================
Comment at: lib/Analysis/InstructionSimplify.cpp:68-82
 /// 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
+// To
 ///   %X/%V1
----------------
The comment still doesn't match the code. Might as well move this next to the match statement inside the function in case there are other folds possible here:

```
%A = icmp eq %TV, %FV
%B = icmp eq %X, %Y (and one of these is a select operand)
%C = and %A, %B
%D = select %C, %TV, %FV
-->
%FV

%A = icmp ne %TV, %FV
%B = icmp ne %X, %Y (and one of these is a select operand)
%C = or %A, %B
%D = select %C, %TV, %FV
-->
%TV
```


https://reviews.llvm.org/D49975





More information about the llvm-commits mailing list