[PATCH] D84220: [IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is optimized to return undef

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 23:10:52 PDT 2020


congzhe added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2056
+      if (!CB)
+        continue;
+      for (auto &arg : CB->args()) {
----------------
jdoerfert wrote:
> congzhe wrote:
> > jdoerfert wrote:
> > > Funnily, if this branch would hit we have a problem. I mean, there is a use that could have an annotation like `returned` but we did make it UB now. Not that I think this branch should ever be taken anyway. I'd propose an assertion, @fhahn @efriedma WDYT ?
> > Thank you, I guess I could replace the branch with something along the following line?
> > ` assert(CB && "Use of zapped functions should be valid direct calls!");`
> I think that would be better, yes.
Thanks, updated accordingly.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2059
+        CB->removeParamAttr(CB->getArgOperandNo(&arg), Attribute::Returned);
+      }
+    }
----------------
jdoerfert wrote:
> Style: No braces, `Arg` and I would not use `auto` but that is probably OK.
Updated accordingly


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

https://reviews.llvm.org/D84220



More information about the llvm-commits mailing list