From: Craig Topper Date: Mon, 20 Mar 2017 16:31:14 +0000 (+0000) Subject: [InstCombine] Print a debug message when we constant fold an operand during worklist... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1813f21f5fa26e3e1825a523cf5b739290f80a2;p=llvm [InstCombine] Print a debug message when we constant fold an operand during worklist creation InstCombine tries to constant fold instruction operands during worklist building, but we don't print that we're doing this. We also set a change flag here that causes us to rebuild and rerun the worklist one more time even if processing the worklist itself created no additional changes. So in the log I saw two inst combine runs that visited all instructions without printing that anything was changed. I may be submitting another patch to remove the change flag unless I can find some reason why we should be doing that. Differential Revision: https://reviews.llvm.org/D31091 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298264 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index a0b93668128..7586e481028 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3032,6 +3032,8 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB, const DataLayout &DL, FoldRes = C; if (FoldRes != C) { + DEBUG(dbgs() << "IC: ConstFold operand of: " << *Inst << "\n Old = " << *C + << "\n New = " << *FoldRes << '\n'); *i = FoldRes; MadeIRChange = true; }