[PATCH] D107989: Fix bad assert in print-changed code

Jamie Schmeiser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 06:07:33 PDT 2021


jamieschmeiser updated this revision to Diff 366261.
jamieschmeiser added a comment.

[NFC] Rename test to match PR name and move into directory so that it will only
be run on systems that have an appropriate diff.


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

https://reviews.llvm.org/D107989

Files:
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/ChangePrinters/print-changed-D107989.ll


Index: llvm/test/Other/ChangePrinters/print-changed-D107989.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/ChangePrinters/print-changed-D107989.ll
@@ -0,0 +1,15 @@
+; D107989 This triggered an assert
+
+; RUN: opt  -passes=globalopt < %s -disable-output -print-changed=diff-quiet
+
+define signext i32 @main()  {
+entry:
+  ret i32 0
+}
+
+define internal void @f() {
+entry:
+  ret void
+}
+
+
Index: llvm/lib/Passes/StandardInstrumentations.cpp
===================================================================
--- llvm/lib/Passes/StandardInstrumentations.cpp
+++ llvm/lib/Passes/StandardInstrumentations.cpp
@@ -647,13 +647,12 @@
 
   ChangedIRData::report(
       Before, After, [&](const ChangedFuncData *B, const ChangedFuncData *A) {
+        assert((B || A) && "Both functions cannot be missing.");
         ChangedFuncData Missing;
         if (!B)
           B = &Missing;
         else if (!A)
           A = &Missing;
-        assert(B != &Missing && A != &Missing &&
-               "Both functions cannot be missing.");
         handleFunctionCompare(Name, Prefix, PassID, true, *B, *A);
       });
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107989.366261.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210813/31239f90/attachment.bin>


More information about the llvm-commits mailing list