[PATCH] D31091: [InstCombine] Print a debug message when we constant fold an operand during worklist creation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 11:36:06 PDT 2017


craig.topper created this revision.

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.


https://reviews.llvm.org/D31091

Files:
  lib/Transforms/InstCombine/InstructionCombining.cpp


Index: lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- lib/Transforms/InstCombine/InstructionCombining.cpp
+++ lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3043,6 +3043,8 @@
           FoldRes = C;
 
         if (FoldRes != C) {
+          DEBUG(dbgs() << "IC: ConstFold operand of: " << *Inst << "\n    Old = " << *C
+                       << "\n    New = " << *FoldRes << '\n');
           *i = FoldRes;
           MadeIRChange = true;
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31091.92175.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170317/6734623e/attachment.bin>


More information about the llvm-commits mailing list