[PATCH] D85184: [Attributor][WIP] Deduce noundef attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 11:04:58 PDT 2020


jdoerfert added a comment.

In D85184#2207536 <https://reviews.llvm.org/D85184#2207536>, @okura wrote:

> In D85184#2207205 <https://reviews.llvm.org/D85184#2207205>, @jdoerfert wrote:
>
>> One last question. Shouldn't we use `isGuaranteedNotToBeUndefOrPoison` in the initialization on the associated value?
>> Unsure but this example might be impacted:
>>
>>   void unknown();
>>   void bar(int*);
>>   void foo() {
>>     int x;
>>     unknown();
>>     bar(&x /* <- should be noundef as far as I can tell */);
>>   }
>
> I think we can deduce noundef more strongly by using `isGuaranteedNotToBeUndefOrPoison` in the initialization.
> But I'm not sure whether we "should" do or not.
>
> In your example, I understand a pointer of an allocated variable should be noundef, but I don't understand why `unknown` function is needed and important.

Just to make sure we don't deduce `noundef` for the alloca based on the must-be-executed-context. I haven't tried this but when we run this with the patch, is there a `noundef` for the call site argument? You need to add `-attributor-annotate-decl-cs` as well to make sure we don't just skip it. I would expect there is none because we never initialized the alloca as noundef. If we did, please elaborate how so I understand ;)


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

https://reviews.llvm.org/D85184



More information about the llvm-commits mailing list