aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/Annotation2Metadata.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/Annotation2Metadata.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp b/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp
index 5ca4e24df8fc..6cc04544cabc 100644
--- a/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp
+++ b/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp
@@ -47,20 +47,13 @@ static bool convertAnnotation2Metadata(Module &M) {
auto *OpC = dyn_cast<ConstantStruct>(&Op);
if (!OpC || OpC->getNumOperands() != 4)
continue;
- auto *StrGEP = dyn_cast<ConstantExpr>(OpC->getOperand(1));
- if (!StrGEP || StrGEP->getNumOperands() < 2)
- continue;
- auto *StrC = dyn_cast<GlobalValue>(StrGEP->getOperand(0));
+ auto *StrC = dyn_cast<GlobalValue>(OpC->getOperand(1)->stripPointerCasts());
if (!StrC)
continue;
auto *StrData = dyn_cast<ConstantDataSequential>(StrC->getOperand(0));
if (!StrData)
continue;
- // Look through bitcast.
- auto *Bitcast = dyn_cast<ConstantExpr>(OpC->getOperand(0));
- if (!Bitcast || Bitcast->getOpcode() != Instruction::BitCast)
- continue;
- auto *Fn = dyn_cast<Function>(Bitcast->getOperand(0));
+ auto *Fn = dyn_cast<Function>(OpC->getOperand(0)->stripPointerCasts());
if (!Fn)
continue;