[PATCH] D138537: GlobalIFunc: Fix verifier asserting on unhandled ConstantExpr
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 19:00:15 PST 2022
arsenm created this revision.
arsenm added reviewers: MaskRay, ibookstein, dexonsmith, tejohnson.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
https://reviews.llvm.org/D138537
Files:
llvm/lib/IR/Globals.cpp
llvm/test/Assembler/ifunc-unhandled-constantexpr.ll
Index: llvm/test/Assembler/ifunc-unhandled-constantexpr.ll
===================================================================
--- /dev/null
+++ llvm/test/Assembler/ifunc-unhandled-constantexpr.ll
@@ -0,0 +1,12 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+; Make sure nothing asserts on an unhandled constantexpr for the
+; resolver.
+
+; CHECK: IFunc must have a Function resolver
+; CHECK-NEXT: ptr @ifunc_shl
+ at ifunc_shl = ifunc void (), ptr inttoptr (i64 shl (i64 ptrtoint (ptr @resolver to i64), i64 4) to ptr)
+
+define ptr @resolver() {
+ ret ptr null
+}
Index: llvm/lib/IR/Globals.cpp
===================================================================
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -590,7 +590,7 @@
const Function *GlobalIFunc::getResolverFunction() const {
DenseSet<const GlobalAlias *> Aliases;
- return dyn_cast<Function>(
+ return dyn_cast_or_null<Function>(
findBaseObject(getResolver(), Aliases, [](const GlobalValue &) {}));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138537.477369.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221123/583d11b7/attachment.bin>
More information about the llvm-commits
mailing list