Fixes a compile error when the `clang::musttail` attribute is used.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D118712
--- /dev/null
+// RUN: %clangxx_hwasan -mllvm -hwasan-use-stack-safety=0 %s -o %t
+// RUN: %run %t
+//
+// REQUIRES: pointer-tagging
+
+__attribute__((noinline)) int bar(int X) { return X; }
+
+__attribute__((noinline)) int foo(int X) {
+ volatile int A = 5;
+ [[clang::musttail]] return bar(X + A);
+}
+
+int main(int Argc, char *Argv[]) { return foo(Argc) != 6; }
}
}
- if (isa<ReturnInst>(Inst) || isa<ResumeInst>(Inst) ||
- isa<CleanupReturnInst>(Inst))
+ if (isa<ReturnInst>(Inst)) {
+ if (CallInst *CI = Inst.getParent()->getTerminatingMustTailCall())
+ RetVec.push_back(CI);
+ else
+ RetVec.push_back(&Inst);
+ } else if (isa<ResumeInst, CleanupReturnInst>(Inst)) {
RetVec.push_back(&Inst);
+ }
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&Inst)) {
for (Value *V : DVI->location_ops()) {