[llvm] 7558e9e - [Attributor] Fix AANoUndef initialization

Shinji Okumura via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 00:07:13 PDT 2020


Author: Shinji Okumura
Date: 2020-09-02T15:40:43+09:00
New Revision: 7558e9e5a2a90ee58792e3b1327f400e63054dfe

URL: https://github.com/llvm/llvm-project/commit/7558e9e5a2a90ee58792e3b1327f400e63054dfe
DIFF: https://github.com/llvm/llvm-project/commit/7558e9e5a2a90ee58792e3b1327f400e63054dfe.diff

LOG: [Attributor] Fix AANoUndef initialization

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)
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86983

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 36d7a55df1d0..35bed8a17cf3 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -7781,6 +7781,10 @@ struct AANoUndefImpl : AANoUndef {
 
   /// See AbstractAttribute::initialize(...).
   void initialize(Attributor &A) override {
+    if (getIRPosition().hasAttr({Attribute::NoUndef})) {
+      indicateOptimisticFixpoint();
+      return;
+    }
     Value &V = getAssociatedValue();
     if (isa<UndefValue>(V))
       indicatePessimisticFixpoint();


        


More information about the llvm-commits mailing list