[PATCH] D72944: [InstCombine] Fix worklist management when simplifying demanded bits (PR44541)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 13:43:45 PST 2020


nikic updated this revision to Diff 244760.
nikic added a comment.
This revision is now accepted and ready to land.

Rebase over D74294 <https://reviews.llvm.org/D74294>.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72944/new/

https://reviews.llvm.org/D72944

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/test/Transforms/InstCombine/pr44541.ll
  llvm/test/Transforms/InstCombine/select-imm-canon.ll


Index: llvm/test/Transforms/InstCombine/select-imm-canon.ll
===================================================================
--- llvm/test/Transforms/InstCombine/select-imm-canon.ll
+++ llvm/test/Transforms/InstCombine/select-imm-canon.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt < %s -instcombine -instcombine-infinite-loop-threshold=3 -S | FileCheck %s
 
 define i8 @single(i32 %A) {
 ; CHECK-LABEL: @single(
Index: llvm/test/Transforms/InstCombine/pr44541.ll
===================================================================
--- llvm/test/Transforms/InstCombine/pr44541.ll
+++ llvm/test/Transforms/InstCombine/pr44541.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -instcombine -expensive-combines=0 -instcombine-infinite-loop-threshold=3 < %s | FileCheck %s
+; RUN: opt -S -instcombine -expensive-combines=0 -instcombine-infinite-loop-threshold=2 < %s | FileCheck %s
 
 ; This test used to cause an infinite combine loop.
 
Index: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -88,6 +88,8 @@
                                           Depth, I);
   if (!NewVal) return false;
   U = NewVal;
+  // Add the simplified instruction back to the worklist.
+  Worklist.addValue(U.get());
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72944.244760.patch
Type: text/x-patch
Size: 1608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200214/748bc96c/attachment.bin>


More information about the llvm-commits mailing list