[PATCH] D22537: [InstSimplify] recognize trunc + icmp sgt/slt variants of select simplifications (PR28466)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 16:26:39 PDT 2016


eli.friedman added a comment.

It looks like there are other places that look for bit-tests which are affected... see https://github.com/llvm-mirror/llvm/blob/dba9c3285e87768e80da6ca60f73b8913392dd98/lib/Transforms/InstCombine/InstCombineSelect.cpp#L579 , https://github.com/llvm-mirror/llvm/blob/65165b21da2aaed908f7bde1b8a16e7a8fe0c955/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp#L597 .  Maybe we want a separate utility function to condense this functionality, so we don't end up with so many versions of it?


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3411
@@ +3410,3 @@
+/// eq/ne.
+static Value *simplifySelectWithFakeICmpEq(Value *CmpLHS, Value *TrueVal,
+                                           Value *FalseVal, bool TrueWhenUnset,
----------------
Do we want to look through the truncate in something like "(trunc X) & C == C2 ? X : Y"?

================
Comment at: lib/Analysis/InstructionSimplify.cpp:3414
@@ +3413,3 @@
+                                           const DataLayout &DL) {
+  unsigned BitWidth = DL.getTypeSizeInBits(TrueVal->getType());
+  APInt MinSignedValue;
----------------
getScalarSizeInBits?  (This could be a vector select.)


https://reviews.llvm.org/D22537





More information about the llvm-commits mailing list