Index: include/llvm/Transforms/InstCombine/InstCombineWorklist.h =================================================================== --- include/llvm/Transforms/InstCombine/InstCombineWorklist.h +++ include/llvm/Transforms/InstCombine/InstCombineWorklist.h @@ -14,6 +14,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/IR/Instruction.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -39,7 +40,7 @@ /// Add - Add the specified instruction to the worklist if it isn't already /// in it. void Add(Instruction *I) { - if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) { + if (!isa(I) && WorklistMap.insert(std::make_pair(I, Worklist.size())).second) { DEBUG(dbgs() << "IC: ADD: " << *I << '\n'); Worklist.push_back(I); } @@ -60,8 +61,10 @@ DEBUG(dbgs() << "IC: ADDING: " << List.size() << " instrs to worklist\n"); unsigned Idx = 0; for (Instruction *I : reverse(List)) { - WorklistMap.insert(std::make_pair(I, Idx++)); - Worklist.push_back(I); + if (!isa(I)) { + WorklistMap.insert(std::make_pair(I, Idx++)); + Worklist.push_back(I); + } } }