[PATCH] D115781: Try to do somethink with misscompile bug in widenable condition.

Dmitry Bakunevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 14 21:00:22 PST 2021


dbakunevich created this revision.
dbakunevich added a reviewer: mkazantsev.
Herald added a subscriber: hiraditya.
dbakunevich requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When working with optimizations on widenable condition, a misscompile bug was found. 
@mkazantsev tried to fix it, but was never approved. 
Yesterday I ran into this bug again. Therefore, I decided that in the case of an infinite loop, do not fall by assert, but break out of the loop.
Link to Maxim's patch https://reviews.llvm.org/D112693


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115781

Files:
  llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp


Index: llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -227,7 +227,9 @@
   unsigned IterCnt = 0;
   (void)IterCnt;
   while (LocalChange) {
-    assert(IterCnt++ < 1000 && "Iterative simplification didn't converge!");
+    if (IterCnt++ < 1000)
+      break;
+    // TODO: Fix infinite loop bug when working with widenable condition.
     LocalChange = false;
 
     // Loop over all of the basic blocks and remove them if they are unneeded.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115781.394463.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211215/0e9f1705/attachment.bin>


More information about the llvm-commits mailing list