[PATCH] D39147: Do not abort if overflow check does not use EQ or NE.

Joel Galenson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 15:30:10 PDT 2017


jgalenson created this revision.
Herald added a subscriber: javed.absar.

As suggested by Eli Friedman, instead of aborting if an overflow check uses something other than SETEQ or SETNE, simply do not apply the optimization.


https://reviews.llvm.org/D39147

Files:
  lib/Target/AArch64/AArch64ISelLowering.cpp


Index: lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- lib/Target/AArch64/AArch64ISelLowering.cpp
+++ lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -3988,9 +3988,8 @@
 
   // Optimize {s|u}{add|sub|mul}.with.overflow feeding into a branch
   // instruction.
-  if (isOverflowIntrOpRes(LHS) && isOneConstant(RHS)) {
-    assert((CC == ISD::SETEQ || CC == ISD::SETNE) &&
-           "Unexpected condition code.");
+  if (isOverflowIntrOpRes(LHS) && isOneConstant(RHS) &&
+      (CC == ISD::SETEQ || CC == ISD::SETNE)) {
     // Only lower legal XALUO ops.
     if (!DAG.getTargetLoweringInfo().isTypeLegal(LHS->getValueType(0)))
       return SDValue();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39147.119719.patch
Type: text/x-patch
Size: 719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171020/5126c97f/attachment.bin>


More information about the llvm-commits mailing list