[PATCH] D86983: [Attributor] Fix AANoUndef initialization

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 15:27:28 PDT 2020


okura created this revision.
Herald added subscribers: llvm-commits, kuter, uenoku, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: homerdin.
Herald added a project: LLVM.
okura requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a subscriber: bbn.

When the associated value is undef, we immediately forced to indicate a pessimistic fixpoint so far.
This patch changes the initialization to check the attribute given in IR at first and to indicate an optimistic fixpoint when it is given.
This change will enable us to catch , for example, the following case in AAUB.

  call void @foo(i32 noundef undef)


https://reviews.llvm.org/D86983

Files:
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp


Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -7781,6 +7781,10 @@
 
   /// See AbstractAttribute::initialize(...).
   void initialize(Attributor &A) override {
+    if (getIRPosition().hasAttr({Attribute::NoUndef})) {
+      indicateOptimisticFixpoint();
+      return;
+    }
     Value &V = getAssociatedValue();
     if (isa<UndefValue>(V))
       indicatePessimisticFixpoint();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86983.289293.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/2ee91fe2/attachment.bin>


More information about the llvm-commits mailing list