-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[LLVMContext] Add OB_align assume bundle op ID. #158078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-llvm-transforms Author: Florian Hahn (fhahn) ChangesAssume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them. Full diff: https://github.com/llvm/llvm-project/pull/158078.diff 3 Files Affected:
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index 852a3a4e2f638..5972dcb637dfa 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -97,6 +97,8 @@ class LLVMContext {
OB_ptrauth = 7, // "ptrauth"
OB_kcfi = 8, // "kcfi"
OB_convergencectrl = 9, // "convergencectrl"
+ OB_align = 10, // "align"
+ OB_LastBundleID = OB_align // Marker for last bundle ID
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 57532cd491dd6..335c210c10e1a 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -53,6 +53,8 @@ static StringRef knownBundleName(unsigned BundleTagID) {
return "kcfi";
case LLVMContext::OB_convergencectrl:
return "convergencectrl";
+ case LLVMContext::OB_align:
+ return "align";
default:
llvm_unreachable("unknown bundle id");
}
@@ -76,7 +78,7 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
}
for (unsigned BundleTagID = LLVMContext::OB_deopt;
- BundleTagID <= LLVMContext::OB_convergencectrl; ++BundleTagID) {
+ BundleTagID <= LLVMContext::OB_LastBundleID; ++BundleTagID) {
[[maybe_unused]] const auto *Entry =
pImpl->getOrInsertBundleTag(knownBundleName(BundleTagID));
assert(Entry->second == BundleTagID && "operand bundle id drifted!");
diff --git a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
index 8555ef5c22f82..e54a2e54f9943 100644
--- a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
+++ b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
@@ -163,7 +163,7 @@ bool AlignmentFromAssumptionsPass::extractAlignmentInfo(CallInst *I,
const SCEV *&OffSCEV) {
Type *Int64Ty = Type::getInt64Ty(I->getContext());
OperandBundleUse AlignOB = I->getOperandBundleAt(Idx);
- if (AlignOB.getTagName() != "align")
+ if (AlignOB.getTagID() != LLVMContext::OB_align)
return false;
assert(AlignOB.Inputs.size() >= 2);
AAPtr = AlignOB.Inputs[0].get();
|
|
@llvm/pr-subscribers-llvm-ir Author: Florian Hahn (fhahn) ChangesAssume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them. Full diff: https://github.com/llvm/llvm-project/pull/158078.diff 3 Files Affected:
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index 852a3a4e2f638..5972dcb637dfa 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -97,6 +97,8 @@ class LLVMContext {
OB_ptrauth = 7, // "ptrauth"
OB_kcfi = 8, // "kcfi"
OB_convergencectrl = 9, // "convergencectrl"
+ OB_align = 10, // "align"
+ OB_LastBundleID = OB_align // Marker for last bundle ID
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 57532cd491dd6..335c210c10e1a 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -53,6 +53,8 @@ static StringRef knownBundleName(unsigned BundleTagID) {
return "kcfi";
case LLVMContext::OB_convergencectrl:
return "convergencectrl";
+ case LLVMContext::OB_align:
+ return "align";
default:
llvm_unreachable("unknown bundle id");
}
@@ -76,7 +78,7 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
}
for (unsigned BundleTagID = LLVMContext::OB_deopt;
- BundleTagID <= LLVMContext::OB_convergencectrl; ++BundleTagID) {
+ BundleTagID <= LLVMContext::OB_LastBundleID; ++BundleTagID) {
[[maybe_unused]] const auto *Entry =
pImpl->getOrInsertBundleTag(knownBundleName(BundleTagID));
assert(Entry->second == BundleTagID && "operand bundle id drifted!");
diff --git a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
index 8555ef5c22f82..e54a2e54f9943 100644
--- a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
+++ b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
@@ -163,7 +163,7 @@ bool AlignmentFromAssumptionsPass::extractAlignmentInfo(CallInst *I,
const SCEV *&OffSCEV) {
Type *Int64Ty = Type::getInt64Ty(I->getContext());
OperandBundleUse AlignOB = I->getOperandBundleAt(Idx);
- if (AlignOB.getTagName() != "align")
+ if (AlignOB.getTagID() != LLVMContext::OB_align)
return false;
assert(AlignOB.Inputs.size() >= 2);
AAPtr = AlignOB.Inputs[0].get();
|
arsenm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a bitcode compatibility test needed for this?
nikic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with test/Bitcode/operand-bundles-bc-analyzer.ll updated.
Assume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them.
84429c8 to
54cd488
Compare
I don't think this changes the bitcode format |
Assume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them. PR: llvm/llvm-project#158078
Assume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them. PR: llvm#158078
Assume operand bundles are emitted in a few more places now, including used in various places in libc++. Add a dedicated ID for them.