[llvm] 19cdc0a - [llvm] Specialize 'NoCFIValue::getType()' (#72923)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 21 01:23:44 PST 2023
Author: Youngsuk Kim
Date: 2023-11-21T04:23:39-05:00
New Revision: 19cdc0a13480806e474de6a7e6e200b1eccc7a13
URL: https://github.com/llvm/llvm-project/commit/19cdc0a13480806e474de6a7e6e200b1eccc7a13
DIFF: https://github.com/llvm/llvm-project/commit/19cdc0a13480806e474de6a7e6e200b1eccc7a13.diff
LOG: [llvm] Specialize 'NoCFIValue::getType()' (#72923)
Specialize `NoCFIValue::getType()` to give a more detailed type hint to
clients.
---------
Co-authored-by: Nikita Popov <github at npopov.com>
Added:
Modified:
llvm/include/llvm/IR/Constants.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index c443ec58822b007..2f7fc5652c2cde4 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -975,6 +975,11 @@ class NoCFIValue final : public Constant {
return cast<GlobalValue>(Op<0>().get());
}
+ /// NoCFIValue is always a pointer.
+ PointerType *getType() const {
+ return cast<PointerType>(Value::getType());
+ }
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
return V->getValueID() == NoCFIValueVal;
More information about the llvm-commits
mailing list