aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/AssumptionCache.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-01-03 17:05:08 +0100
committerGitHub <noreply@github.com>2024-01-03 17:05:08 +0100
commitb07bf16a6f57b5bfa487d2291dc246ada37b0dfc (patch)
tree5fbf2c18ece817f71be6d4b70e3c177985da59fc /llvm/lib/Analysis/AssumptionCache.cpp
parentc17af94b9619997ce7c060ff112988e0ec218c10 (diff)
downloadllvm-b07bf16a6f57b5bfa487d2291dc246ada37b0dfc.zip
llvm-b07bf16a6f57b5bfa487d2291dc246ada37b0dfc.tar.gz
llvm-b07bf16a6f57b5bfa487d2291dc246ada37b0dfc.tar.bz2
[AssumptionCache] Add affected values for separate_storage (#76806)
Add the underlying object of both separate_storage arguments as affected values. This allows us to use assumptionsFor() in BasicAA, which will be more efficient if there are many assumes in the function.
Diffstat (limited to 'llvm/lib/Analysis/AssumptionCache.cpp')
-rw-r--r--llvm/lib/Analysis/AssumptionCache.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp
index fb3a6f8..1b7277d 100644
--- a/llvm/lib/Analysis/AssumptionCache.cpp
+++ b/llvm/lib/Analysis/AssumptionCache.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
@@ -77,9 +78,15 @@ findAffectedValues(CallBase *CI, TargetTransformInfo *TTI,
};
for (unsigned Idx = 0; Idx != CI->getNumOperandBundles(); Idx++) {
- if (CI->getOperandBundleAt(Idx).Inputs.size() > ABA_WasOn &&
- CI->getOperandBundleAt(Idx).getTagName() != IgnoreBundleTag)
- AddAffected(CI->getOperandBundleAt(Idx).Inputs[ABA_WasOn], Idx);
+ OperandBundleUse Bundle = CI->getOperandBundleAt(Idx);
+ if (Bundle.getTagName() == "separate_storage") {
+ assert(Bundle.Inputs.size() == 2 &&
+ "separate_storage must have two args");
+ AddAffected(getUnderlyingObject(Bundle.Inputs[0]), Idx);
+ AddAffected(getUnderlyingObject(Bundle.Inputs[1]), Idx);
+ } else if (Bundle.Inputs.size() > ABA_WasOn &&
+ Bundle.getTagName() != IgnoreBundleTag)
+ AddAffected(Bundle.Inputs[ABA_WasOn], Idx);
}
Value *Cond = CI->getArgOperand(0), *A, *B;