[llvm] b05801d - [InlineFunction] Only check pointer arguments for a call

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 02:39:54 PDT 2022


Author: Chen Zheng
Date: 2022-06-30T05:39:47-04:00
New Revision: b05801de35aa3eae2046224de975879b313d3ed7

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

LOG: [InlineFunction] Only check pointer arguments for a call

Reviewed By: nikic

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

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/InlineFunction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index c69ca70db91d..226b00afc082 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1043,12 +1043,10 @@ static void AddAliasScopeMetadata(CallBase &CB, ValueToValueMapTy &VMap,
         }
 
         for (Value *Arg : Call->args()) {
-          // We need to check the underlying objects of all arguments, not just
-          // the pointer arguments, because we might be passing pointers as
-          // integers, etc.
-          // However, if we know that the call only accesses pointer arguments,
-          // then we only need to check the pointer arguments.
-          if (IsArgMemOnlyCall && !Arg->getType()->isPointerTy())
+          // Only care about pointer arguments. If a noalias argument is
+          // accessed through a non-pointer argument, it must be captured
+          // first (e.g. via ptrtoint), and we protect against captures below.
+          if (!Arg->getType()->isPointerTy())
             continue;
 
           PtrArgs.push_back(Arg);


        


More information about the llvm-commits mailing list