diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index bf91d99edf24c..25a73c83d8b53 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -88,6 +88,8 @@ bool InstCombiner::SimplifyDemandedBits(Instruction *I, unsigned OpNo, Depth, I); if (!NewVal) return false; U = NewVal; + // Add the simplified instruction back to the worklist. + Worklist.addValue(U.get()); return true; } diff --git a/llvm/test/Transforms/InstCombine/pr44541.ll b/llvm/test/Transforms/InstCombine/pr44541.ll index 782526a10e33a..3d4082a770911 100644 --- a/llvm/test/Transforms/InstCombine/pr44541.ll +++ b/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. diff --git a/llvm/test/Transforms/InstCombine/select-imm-canon.ll b/llvm/test/Transforms/InstCombine/select-imm-canon.ll index f73c32bf23809..4c59be6686261 100644 --- a/llvm/test/Transforms/InstCombine/select-imm-canon.ll +++ b/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(