Lines Matching +full:un +full:- +full:masked
1 //===- Miscompilation.cpp - Debug program miscompilations -----------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
38 "disable-loop-extraction",
42 "disable-block-extraction",
57 /// TestResult - After passes have been split into a test group and a control
74 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
116 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
161 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
294 if (!I->hasName()) in DisambiguateGlobalSymbols()
295 I->setName("anon_global"); in DisambiguateGlobalSymbols()
297 if (!I->hasName()) in DisambiguateGlobalSymbols()
298 I->setName("anon_fn"); in DisambiguateGlobalSymbols()
353 errs() << " Continuing on with un-loop-extracted version.\n"; in ExtractLoops()
355 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-tno.bc", in ExtractLoops()
357 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to.bc", in ExtractLoops()
359 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to-le.bc", in ExtractLoops()
363 << "-loop-extract-fail-*.bc files.\n"; in ExtractLoops()
386 outs() << "*** Loop extraction masked the problem. Undoing.\n"; in ExtractLoops()
388 // that masked the error. Stop loop extraction now. in ExtractLoops()
392 MisCompFunctions.emplace_back(std::string(F->getName()), in ExtractLoops()
393 F->getFunctionType()); in ExtractLoops()
402 Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first); in ExtractLoops()
415 for (Module::iterator I = ToOptimizeLoopExtracted->begin(), in ExtractLoops()
416 E = ToOptimizeLoopExtracted->end(); in ExtractLoops()
418 if (!I->isDeclaration()) in ExtractLoops()
419 MisCompFunctions.emplace_back(std::string(I->getName()), in ExtractLoops()
420 I->getFunctionType()); in ExtractLoops()
434 Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first); in ExtractLoops()
483 /// TestFuncs - Extract all blocks for the miscompiled functions except for the
494 outs() << BBs[i]->getName() << " "; in TestFuncs()
588 for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; in ExtractBlocks()
590 if (!I->isDeclaration()) in ExtractBlocks()
591 MisCompFunctions.emplace_back(std::string(I->getName()), in ExtractBlocks()
592 I->getFunctionType()); in ExtractBlocks()
601 Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first); in ExtractBlocks()
621 // miscompiled... first build a list of all of the non-external functions in in DebugAMiscompilation()
711 BD.EmitProgressBitcode(*Test, "pass-error", false); in TestOptimizer()
732 /// debugMiscompilation - This method is used when the passes selected are not
768 outs() << " Non-optimized portion: "; in debugMiscompilation()
794 if (Function *oldMain = Safe->getFunction("main")) in CleanupAndPrepareModules()
795 if (!oldMain->isDeclaration()) { in CleanupAndPrepareModules()
797 oldMain->setName("llvm_bugpoint_old_main"); in CleanupAndPrepareModules()
800 Function::Create(oldMain->getFunctionType(), in CleanupAndPrepareModules()
804 Function *oldMainProto = Function::Create(oldMain->getFunctionType(), in CleanupAndPrepareModules()
806 oldMain->getName(), Test.get()); in CleanupAndPrepareModules()
809 for (Function::arg_iterator I = newMain->arg_begin(), in CleanupAndPrepareModules()
810 E = newMain->arg_end(), in CleanupAndPrepareModules()
811 OI = oldMain->arg_begin(); in CleanupAndPrepareModules()
813 I->setName(OI->getName()); // Copy argument names from oldMain in CleanupAndPrepareModules()
818 BasicBlock *BB = BasicBlock::Create(Safe->getContext(), "entry", newMain); in CleanupAndPrepareModules()
822 ReturnInst::Create(Safe->getContext(), call, BB); in CleanupAndPrepareModules()
832 FunctionCallee resolverFunc = Safe->getOrInsertFunction( in CleanupAndPrepareModules()
833 "getPointerToNamedFunction", PointerType::getUnqual(Safe->getContext()), in CleanupAndPrepareModules()
834 PointerType::getUnqual(Safe->getContext())); in CleanupAndPrepareModules()
837 for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { in CleanupAndPrepareModules()
838 if (F->isDeclaration() && !F->use_empty() && in CleanupAndPrepareModules()
840 !F->isIntrinsic() /* ignore intrinsics */) { in CleanupAndPrepareModules()
841 Function *TestFn = Test->getFunction(F->getName()); in CleanupAndPrepareModules()
844 if (TestFn && !TestFn->isDeclaration()) { in CleanupAndPrepareModules()
847 ConstantDataArray::getString(F->getContext(), F->getName()); in CleanupAndPrepareModules()
849 *Safe, InitArray->getType(), true /*isConstant*/, in CleanupAndPrepareModules()
850 GlobalValue::InternalLinkage, InitArray, F->getName() + "_name"); in CleanupAndPrepareModules()
857 2, Constant::getNullValue(Type::getInt32Ty(F->getContext()))); in CleanupAndPrepareModules()
858 Value *GEP = ConstantExpr::getGetElementPtr(InitArray->getType(), in CleanupAndPrepareModules()
865 if (!F->use_empty()) { in CleanupAndPrepareModules()
867 Constant *NullPtr = ConstantPointerNull::get(F->getType()); in CleanupAndPrepareModules()
869 *F->getParent(), F->getType(), false, in CleanupAndPrepareModules()
870 GlobalValue::InternalLinkage, NullPtr, F->getName() + ".fpcache"); in CleanupAndPrepareModules()
872 // Construct a new stub function that will re-route calls to F in CleanupAndPrepareModules()
873 FunctionType *FuncTy = F->getFunctionType(); in CleanupAndPrepareModules()
876 F->getName() + "_wrapper", F->getParent()); in CleanupAndPrepareModules()
878 BasicBlock::Create(F->getContext(), "entry", FuncWrapper); in CleanupAndPrepareModules()
880 BasicBlock::Create(F->getContext(), "usecache", FuncWrapper); in CleanupAndPrepareModules()
882 BasicBlock::Create(F->getContext(), "lookupfp", FuncWrapper); in CleanupAndPrepareModules()
886 new LoadInst(F->getType(), Cache, "fpcache", EntryBB); in CleanupAndPrepareModules()
897 // Cast the result from the resolver to correctly-typed function. in CleanupAndPrepareModules()
899 Resolver, PointerType::getUnqual(F->getFunctionType()), in CleanupAndPrepareModules()
907 PHINode::Create(NullPtr->getType(), 2, "fp", DoCallBB); in CleanupAndPrepareModules()
908 FuncPtr->addIncoming(CastedResolver, LookupBB); in CleanupAndPrepareModules()
909 FuncPtr->addIncoming(CachedVal, EntryBB); in CleanupAndPrepareModules()
913 for (Argument &A : FuncWrapper->args()) in CleanupAndPrepareModules()
917 if (F->getReturnType()->isVoidTy()) { in CleanupAndPrepareModules()
919 ReturnInst::Create(F->getContext(), DoCallBB); in CleanupAndPrepareModules()
923 ReturnInst::Create(F->getContext(), Call, DoCallBB); in CleanupAndPrepareModules()
927 F->replaceAllUsesWith(FuncWrapper); in CleanupAndPrepareModules()
1007 /// debugCodeGenerator - debug errors in LLC, LLI, or CBE.
1015 << "the reference diff. This may be due to a\n front-end " in debugCodeGenerator()
1080 outs() << " lli -load " << *SharedObject << " " << TestModuleBC; in debugCodeGenerator()
1082 outs() << " llc " << TestModuleBC << " -o " << TestModuleBC << ".s\n"; in debugCodeGenerator()
1083 outs() << " cc " << *SharedObject << " " << TestModuleBC.str() << ".s -o " in debugCodeGenerator()
1090 outs() << "The shared object was created with:\n llc -march=c " in debugCodeGenerator()
1091 << SafeModuleBC.str() << " -o temporary.c\n" in debugCodeGenerator()
1092 << " cc -xc temporary.c -O2 -o " << *SharedObject; in debugCodeGenerator()
1094 outs() << " -G"; // Compile a shared library, `-G' for Sparc in debugCodeGenerator()
1096 outs() << " -fPIC -shared"; // `-shared' for Linux/X86, maybe others in debugCodeGenerator()
1098 outs() << " -fno-strict-aliasing\n"; in debugCodeGenerator()