-
-
Save nikic/0f9733122887065d656d0301e47504a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit a9d3878bb78af5a60739728ef8ca732514e2ce46 | |
Author: Nikita Popov <nikita.ppv@gmail.com> | |
Date: Wed Mar 24 17:56:23 2021 +0100 | |
[IR] Lift attribute handling for assume bundles into CallBase | |
Rather than special-casing assume in BasicAA getModRefBehavior(), | |
do this one level higher, in the attribute handling of CallBase. | |
For assumes with operand bundles, the inaccessiblememonly attribute | |
applies regardless of operand bundles. | |
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h | |
index 5c1d2bdd296e..86e86c454d8f 100644 | |
--- a/llvm/include/llvm/IR/InstrTypes.h | |
+++ b/llvm/include/llvm/IR/InstrTypes.h | |
@@ -2013,12 +2013,7 @@ public: | |
/// Return true if this operand bundle user has operand bundles that | |
/// may read from the heap. | |
- bool hasReadingOperandBundles() const { | |
- // Implementation note: this is a conservative implementation of operand | |
- // bundle semantics, where *any* operand bundle forces a callsite to be at | |
- // least readonly. | |
- return hasOperandBundles(); | |
- } | |
+ bool hasReadingOperandBundles() const; | |
/// Return true if this operand bundle user has operand bundles that | |
/// may write to the heap. | |
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
index 65117d82a81c..acf7bef3aeb0 100644 | |
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
@@ -683,11 +683,6 @@ FunctionModRefBehavior BasicAAResult::getModRefBehavior(const CallBase *Call) { | |
// Can't do better than this. | |
return FMRB_DoesNotAccessMemory; | |
- // The assume intrinsic can have operand bundles, but still only accesses | |
- // inaccessible memory in that case (to maintain control dependencies). | |
- if (isIntrinsicCall(Call, Intrinsic::assume)) | |
- return FMRB_OnlyAccessesInaccessibleMem; | |
- | |
FunctionModRefBehavior Min = FMRB_UnknownModRefBehavior; | |
// If the callsite knows it only reads memory, don't return worse | |
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp | |
index 6666d74ecabb..15567e94cb2e 100644 | |
--- a/llvm/lib/IR/Instructions.cpp | |
+++ b/llvm/lib/IR/Instructions.cpp | |
@@ -466,6 +466,13 @@ CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID, | |
return CreateNew ? Create(CB, Bundles, InsertPt) : CB; | |
} | |
+bool CallBase::hasReadingOperandBundles() const { | |
+ // Implementation note: this is a conservative implementation of operand | |
+ // bundle semantics, where *any* non-assume operand bundle forces a callsite | |
+ // to be at least readonly. | |
+ return hasOperandBundles() && getIntrinsicID() != Intrinsic::assume; | |
+} | |
+ | |
//===----------------------------------------------------------------------===// | |
// CallInst Implementation | |
//===----------------------------------------------------------------------===// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment