================ @@ -1268,42 +1259,21 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function &F) { LLVMContext &C = F.getContext(); IRBuilder<> IRB(C); SmallVector<Instruction *, 64> ToErase; - // Vector of %setjmpTable values - SmallVector<Instruction *, 4> SetjmpTableInsts; - // Vector of %setjmpTableSize values - SmallVector<Instruction *, 4> SetjmpTableSizeInsts; // Setjmp preparation - // This instruction effectively means %setjmpTableSize = 4. - // We create this as an instruction intentionally, and we don't want to fold - // this instruction to a constant 4, because this value will be used in - // SSAUpdater.AddAvailableValue(...) later. BasicBlock *Entry = &F.getEntryBlock(); DebugLoc FirstDL = getOrCreateDebugLoc(&*Entry->begin(), F.getSubprogram()); SplitBlock(Entry, &*Entry->getFirstInsertionPt()); - BinaryOperator *SetjmpTableSize = - BinaryOperator::Create(Instruction::Add, IRB.getInt32(4), IRB.getInt32(0), - "setjmpTableSize", Entry->getTerminator()); - SetjmpTableSize->setDebugLoc(FirstDL); - // setjmpTable = (int *) malloc(40); - Type *IntPtrTy = getAddrIntType(&M); - Constant *size = ConstantInt::get(IntPtrTy, 40); - IRB.SetInsertPoint(SetjmpTableSize); - auto *SetjmpTable = IRB.CreateMalloc(IntPtrTy, IRB.getInt32Ty(), size, - nullptr, nullptr, "setjmpTable"); - SetjmpTable->setDebugLoc(FirstDL); - // CallInst::CreateMalloc may return a bitcast instruction if the result types - // mismatch. We need to set the debug loc for the original call too. - auto *MallocCall = SetjmpTable->stripPointerCasts(); - if (auto *MallocCallI = dyn_cast<Instruction>(MallocCall)) { - MallocCallI->setDebugLoc(FirstDL); - } - // setjmpTable[0] = 0; - IRB.CreateStore(IRB.getInt32(0), SetjmpTable); - SetjmpTableInsts.push_back(SetjmpTable); - SetjmpTableSizeInsts.push_back(SetjmpTableSize); + Instruction *FunctionInvocationId; + IRB.SetInsertPoint(Entry->getTerminator()); + // This alloca'ed pointer is used by the runtime to identify function + // inovactions. It's just for pointer comparisons. It will never + // be dereferenced. ---------------- aheejin wrote:
```suggestion // invocations. It's just for pointer comparisons. It will never be // dereferenced. ``` https://github.com/llvm/llvm-project/pull/84137 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits