diff --git a/.gitmodules b/.gitmodules index 32ba47b83..7f5dd3116 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "sea-dsa"] path = sea-dsa - url = https://github.com/seahorn/sea-dsa.git + url = https://github.com/shaobo-he/sea-dsa.git diff --git a/bin/versions b/bin/versions index 35146303e..3765fd1a3 100644 --- a/bin/versions +++ b/bin/versions @@ -5,6 +5,6 @@ BOOGIE_VERSION="2.9.6" CORRAL_VERSION="1.1.8" SYMBOOGLIX_COMMIT="ccb2e7f2b3" LOCKPWN_COMMIT="12ba58f1ec" -LLVM_SHORT_VERSION="12" -LLVM_FULL_VERSION="12.0.1" -RUST_VERSION="nightly-2021-03-01" +LLVM_SHORT_VERSION="13" +LLVM_FULL_VERSION="13.0.1" +RUST_VERSION="nightly-2022-01-01" diff --git a/include/smack/AddTiming.h b/include/smack/AddTiming.h index 06871a32a..7e9be67dd 100644 --- a/include/smack/AddTiming.h +++ b/include/smack/AddTiming.h @@ -6,6 +6,7 @@ #include "llvm/IR/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Support/InstructionCost.h" namespace llvm { class TargetTransformInfo; @@ -16,7 +17,6 @@ using namespace llvm; class AddTiming : public FunctionPass { - enum Flags { NO_TIMING_INFO = -1 }; static const std::string INT_TIMING_COST_METADATA; static const std::string INSTRUCTION_NAME_METADATA; @@ -25,10 +25,10 @@ class AddTiming : public FunctionPass { AddTiming() : FunctionPass(ID), F(nullptr), TTI(nullptr) {} /// Returns the expected cost of the instruction. - /// Returns -1 if the cost is unknown. + /// Returns invalid `InstructionCost` if the cost is unknown. /// Note, this method does not cache the cost calculation and it /// can be expensive in some cases. - unsigned getInstructionCost(const Instruction *I) const; + InstructionCost getInstructionCost(const Instruction *I) const; private: void addMetadata(Instruction *Inst, const std::string &name, diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 06e77157c..67f747d41 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -4,6 +4,7 @@ #ifndef BOOGIEAST_H #define BOOGIEAST_H +#include "llvm/ADT/StringRef.h" #include #include #include @@ -33,11 +34,13 @@ class Expr { static const Expr *id(std::string x); static const Expr *impl(const Expr *l, const Expr *r); static const Expr *lit(bool b); + static const Expr *lit(llvm::StringRef s); static const Expr *lit(std::string v); static const Expr *lit(unsigned v) { return lit((unsigned long long)v); } static const Expr *lit(unsigned long long v); static const Expr *lit(long long v); static const Expr *lit(std::string v, unsigned w); + static const Expr *lit(llvm::StringRef v, unsigned w); static const Expr *lit(unsigned long long v, unsigned w); static const Expr *lit(bool n, std::string s, std::string e, unsigned ss, unsigned es); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index dc3584fde..a01247ab1 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -4,6 +4,7 @@ #ifndef SMACKREP_H #define SMACKREP_H +#include "llvm/ADT/SmallString.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/IR/InstVisitor.h" diff --git a/lib/smack/AddTiming.cpp b/lib/smack/AddTiming.cpp index e678a398c..f781afee9 100644 --- a/lib/smack/AddTiming.cpp +++ b/lib/smack/AddTiming.cpp @@ -91,9 +91,9 @@ bool AddTiming::runOnFunction(Function &F) { } void AddTiming::addTimingMetadata(Instruction *Inst) const { - unsigned Cost = getInstructionCost(Inst); - if (Cost != (unsigned)NO_TIMING_INFO) { - addMetadata(Inst, "smack.InstTimingCost.Int64", Cost); + auto Cost = getInstructionCost(Inst); + if (Cost.isValid()) { + addMetadata(Inst, "smack.InstTimingCost.Int64", *Cost.getValue()); } } @@ -118,9 +118,9 @@ static TargetTransformInfo::OperandValueKind getOperandInfo(Value *V) { return OpInfo; } -unsigned AddTiming::getInstructionCost(const Instruction *I) const { +InstructionCost AddTiming::getInstructionCost(const Instruction *I) const { if (!TTI) - return NO_TIMING_INFO; + return InstructionCost::getInvalid(); // When an assume statement appears in the C code // llvm turns it into a series of IR instructions @@ -132,7 +132,7 @@ unsigned AddTiming::getInstructionCost(const Instruction *I) const { // return 0 if (VerifierCodeMetadata::isMarked(*I)) { - return 0; + return InstructionCost(0); } switch (I->getOpcode()) { @@ -216,14 +216,10 @@ unsigned AddTiming::getInstructionCost(const Instruction *I) const { return TTI->getCastInstrCost(I->getOpcode(), I->getType(), SrcTy, TTI->getCastContextHint(I)); } - case Instruction::ExtractElement: { - return NO_TIMING_INFO; - } - case Instruction::InsertElement: { - return NO_TIMING_INFO; - } + case Instruction::ExtractElement: + case Instruction::InsertElement: case Instruction::ShuffleVector: { - return NO_TIMING_INFO; + return InstructionCost::getInvalid(); } case Instruction::Call: { if (const IntrinsicInst *II = dyn_cast(I)) { @@ -241,11 +237,11 @@ unsigned AddTiming::getInstructionCost(const Instruction *I) const { TargetTransformInfo::TargetCostKind::TCK_Latency); } - return NO_TIMING_INFO; + return InstructionCost::getInvalid(); } default: // We don't have any information on this instruction. - return NO_TIMING_INFO; + return InstructionCost::getInvalid(); } } @@ -271,8 +267,8 @@ void AddTiming::print(raw_ostream &OS, const Module *) const { for (Function::iterator B = F->begin(), BE = F->end(); B != BE; ++B) { for (BasicBlock::iterator it = B->begin(), e = B->end(); it != e; ++it) { Instruction *Inst = &*it; - unsigned Cost = getInstructionCost(Inst); - if (Cost != (unsigned)NO_TIMING_INFO) { + auto Cost = getInstructionCost(Inst); + if (Cost.isValid()) { OS << "Cost Model: Found an estimated cost of " << Cost; } else { OS << "Cost Model: Unknown cost"; diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 15781ac6f..d2e74e59b 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -72,12 +72,16 @@ const Expr *Expr::impl(const Expr *l, const Expr *r) { const Expr *Expr::lit(bool b) { return new BoolLit(b); } +const Expr *Expr::lit(llvm::StringRef s) { return lit(s.str()); } + const Expr *Expr::lit(std::string v) { return new StringLit(v); } const Expr *Expr::lit(unsigned long long v) { return new IntLit(v); } const Expr *Expr::lit(long long v) { return new IntLit(v); } +const Expr *Expr::lit(llvm::StringRef v, unsigned w) { return lit(v.str(), w); } + const Expr *Expr::lit(std::string v, unsigned w) { return w ? (const Expr *)new BvLit(v, w) : (const Expr *)new IntLit(v); } diff --git a/lib/smack/ExtractContracts.cpp b/lib/smack/ExtractContracts.cpp index 3554313f4..f9a709cf2 100644 --- a/lib/smack/ExtractContracts.cpp +++ b/lib/smack/ExtractContracts.cpp @@ -188,7 +188,8 @@ Function *getContractExpr(Function *F, CallInst *I) { DestA->setName(A.getName()); VMap[&A] = &*DestA++; } - CloneFunctionInto(NewF, F, VMap, false, Returns); + CloneFunctionInto(NewF, F, VMap, CloneFunctionChangeType::LocalChangesOnly, + Returns); setReturnToArgumentValue(NewF, dyn_cast(VMap[I])); return NewF; } diff --git a/lib/smack/IntegerOverflowChecker.cpp b/lib/smack/IntegerOverflowChecker.cpp index 31e38c53f..fea66eb4d 100644 --- a/lib/smack/IntegerOverflowChecker.cpp +++ b/lib/smack/IntegerOverflowChecker.cpp @@ -33,17 +33,21 @@ const std::map {"mul", Instruction::Mul}}; std::string IntegerOverflowChecker::getMax(unsigned bits, bool isSigned) { + SmallString<32> ret; if (isSigned) - return APInt::getSignedMaxValue(bits).toString(10, true); + APInt::getSignedMaxValue(bits).toString(ret, 10, true); else - return APInt::getMaxValue(bits).toString(10, false); + APInt::getMaxValue(bits).toString(ret, 10, false); + return ret.str().str(); } std::string IntegerOverflowChecker::getMin(unsigned bits, bool isSigned) { + SmallString<32> ret; if (isSigned) - return APInt::getSignedMinValue(bits).toString(10, true); + APInt::getSignedMinValue(bits).toString(ret, 10, true); else - return APInt::getMinValue(bits).toString(10, false); + APInt::getMinValue(bits).toString(ret, 10, false); + return ret.str().str(); } /* diff --git a/lib/smack/Prelude.cpp b/lib/smack/Prelude.cpp index ba20202ba..deb5891c1 100644 --- a/lib/smack/Prelude.cpp +++ b/lib/smack/Prelude.cpp @@ -169,7 +169,9 @@ FuncDecl *builtinOp(std::string baseName, const Attr *attr, std::string getIntLimit(unsigned size) { auto n = APInt(size + 1, 0); n.setBit(size); - return n.toString(10, false); + SmallString<32> rstr; + n.toStringUnsigned(rstr, 10); + return std::string(rstr); } const std::vector IntOpGen::INTEGER_SIZES{ diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 357a5dc36..1141ae2d5 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -640,7 +640,8 @@ const Expr *SmackRep::lit(const llvm::Value *v, bool isUnsigned, bool neg = width > 1 && (isUnsigned ? (isUnsignedInst ? false : API.getSExtValue() == -1) : ci->isNegative()); - std::string str = (neg ? API.abs() : API).toString(10, false); + SmallString<32> str; + (neg ? API.abs() : API).toString(str, 10, false); const Expr *e = SmackOptions::BitPrecise ? Expr::lit(str, width) : Expr::lit(str, 0); std::stringstream op; @@ -706,10 +707,14 @@ const Expr *SmackRep::lit(const llvm::Value *v, bool isUnsigned, sig.setBit(sig.getBitWidth() - 1); - std::string hexSig = sig.toString(16, false).substr(1); + SmallString<32> sigStr; + sig.toString(sigStr, 16, false); + std::string hexSig = sigStr.substr(1).str(); hexSig.insert(leftSize / 4, "."); - return Expr::lit(API.isNegative(), hexSig, finalExp.toString(10, true), + SmallString<32> finalExpStr; + finalExp.toString(finalExpStr, 10, true); + return Expr::lit(API.isNegative(), hexSig, finalExpStr.str().str(), sigSize, expSize); } else { const APFloat APF = CFP->getValueAPF(); diff --git a/lib/smack/VectorOperations.cpp b/lib/smack/VectorOperations.cpp index c9ee78e5b..0bf7a2bff 100644 --- a/lib/smack/VectorOperations.cpp +++ b/lib/smack/VectorOperations.cpp @@ -55,7 +55,8 @@ const Expr *VectorOperations::constant(const ConstantDataVector *C) { const Expr *VectorOperations::constant(const ConstantAggregateZero *C) { auto T = C->getType(); std::list args; - for (unsigned i = 0; i < C->getNumElements(); i++) + auto elemCount = C->getElementCount().getFixedValue(); + for (unsigned i = 0; i < elemCount; i++) args.push_back(rep->expr(C->getElementValue(i))); return Expr::fn(constructor(T), args); } diff --git a/sea-dsa b/sea-dsa index 934b99861..47ca85c5f 160000 --- a/sea-dsa +++ b/sea-dsa @@ -1 +1 @@ -Subproject commit 934b99861602df3e5a29b0f86819a03e2da676d0 +Subproject commit 47ca85c5feffa70d619206e75adc1af3641aa9f0 diff --git a/test/c/failing/floppy_false.i.cil.c b/test/c/failing/floppy_false.i.cil.c index 705e74efd..5aff5e431 100644 --- a/test/c/failing/floppy_false.i.cil.c +++ b/test/c/failing/floppy_false.i.cil.c @@ -2291,8 +2291,7 @@ NTSTATUS FloppyAddDevice(PDRIVER_OBJECT DriverObject, disketteExtension->TargetObject = IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject); } - {} - { + {} { /* KeInitializeSemaphore(& disketteExtension->RequestSemaphore, * 0L, 2147483647); */ /* INLINED */ disketteExtension->PowerDownMutex.Count = 1; @@ -2615,11 +2614,9 @@ NTSTATUS FlQueueIrpToThread(PIRP Irp, PDISKETTE_EXTENSION DisketteExtension) { } else { } { - /* ExReleaseFastMutex(& DisketteExtension->PowerDownMutex); */ /* INLINED - */ - } - {} - { + /* ExReleaseFastMutex(& DisketteExtension->PowerDownMutex); */ /* INLINED + */ + } {} { /* ExAcquireFastMutex(& DisketteExtension->ThreadReferenceMutex); */ /* INLINED */ DisketteExtension->ThreadReferenceCount += 1L; } @@ -3221,8 +3218,7 @@ NTSTATUS FloppyDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) { goto switch_16_break; } else { } - {} - { + {} { ntStatus = FlQueueIrpToThread( Irp, disketteExtension); } @@ -4172,9 +4168,7 @@ void FlFinishOperation(PIRP Irp, PDISKETTE_EXTENSION DisketteExtension) { _L___0 : /* CIL Label */ {} } - {} - {} - { IofCompleteRequest(Irp, 1); } + {} {} { IofCompleteRequest(Irp, 1); } return; } } @@ -4775,8 +4769,7 @@ NTSTATUS FlDetermineMediaType(PDISKETTE_EXTENSION DisketteExtension) { .__annonCompField16.CurrentStackLocation -= 1; ntStatus = FlReadWrite(DisketteExtension, irp, 1); } - {} - { + {} { /* MmUnlockPages(irp->MdlAddress); */ /* INLINED */ /* IoFreeMdl(irp->MdlAddress); @@ -5059,10 +5052,11 @@ void FloppyThread(PVOID Context) { } } else { } - { /* ExReleaseFastMutex(PagingMutex); */ /* INLINED */ + { + /* ExReleaseFastMutex(PagingMutex); */ /* INLINED */ + } {} { + PsTerminateSystemThread(0L); } - {} - { PsTerminateSystemThread(0L); } } else { } { @@ -5666,8 +5660,7 @@ void FlConsolidateMediaTypeWithBootSector(PDISKETTE_EXTENSION DisketteExtension, } } else { } - {} - {} + {} {} if ((int)bpbMediaType == (int)DisketteExtension->MediaType) { changeToBpbMedia = 0; {} diff --git a/test/c/failing/floppy_true.i.cil.c b/test/c/failing/floppy_true.i.cil.c index 15c4a7c77..5318113a4 100644 --- a/test/c/failing/floppy_true.i.cil.c +++ b/test/c/failing/floppy_true.i.cil.c @@ -2291,8 +2291,7 @@ NTSTATUS FloppyAddDevice(PDRIVER_OBJECT DriverObject, disketteExtension->TargetObject = IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject); } - {} - { + {} { /* KeInitializeSemaphore(& disketteExtension->RequestSemaphore, * 0L, 2147483647); */ /* INLINED */ disketteExtension->PowerDownMutex.Count = 1; @@ -2615,11 +2614,9 @@ NTSTATUS FlQueueIrpToThread(PIRP Irp, PDISKETTE_EXTENSION DisketteExtension) { } else { } { - /* ExReleaseFastMutex(& DisketteExtension->PowerDownMutex); */ /* INLINED - */ - } - {} - { + /* ExReleaseFastMutex(& DisketteExtension->PowerDownMutex); */ /* INLINED + */ + } {} { /* ExAcquireFastMutex(& DisketteExtension->ThreadReferenceMutex); */ /* INLINED */ DisketteExtension->ThreadReferenceCount += 1L; } @@ -3221,8 +3218,7 @@ NTSTATUS FloppyDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) { goto switch_16_break; } else { } - {} - { + {} { ntStatus = FlQueueIrpToThread( Irp, disketteExtension); } @@ -4172,9 +4168,7 @@ void FlFinishOperation(PIRP Irp, PDISKETTE_EXTENSION DisketteExtension) { _L___0 : /* CIL Label */ {} } - {} - {} - { IofCompleteRequest(Irp, 1); } + {} {} { IofCompleteRequest(Irp, 1); } return; } } @@ -4775,8 +4769,7 @@ NTSTATUS FlDetermineMediaType(PDISKETTE_EXTENSION DisketteExtension) { .__annonCompField16.CurrentStackLocation -= 1; ntStatus = FlReadWrite(DisketteExtension, irp, 1); } - {} - { + {} { /* MmUnlockPages(irp->MdlAddress); */ /* INLINED */ /* IoFreeMdl(irp->MdlAddress); @@ -5059,10 +5052,11 @@ void FloppyThread(PVOID Context) { } } else { } - { /* ExReleaseFastMutex(PagingMutex); */ /* INLINED */ + { + /* ExReleaseFastMutex(PagingMutex); */ /* INLINED */ + } {} { + PsTerminateSystemThread(0L); } - {} - { PsTerminateSystemThread(0L); } } else { } { @@ -5666,8 +5660,7 @@ void FlConsolidateMediaTypeWithBootSector(PDISKETTE_EXTENSION DisketteExtension, } } else { } - {} - {} + {} {} if ((int)bpbMediaType == (int)DisketteExtension->MediaType) { changeToBpbMedia = 0; {} diff --git a/test/c/ntdrivers/parport_false.i.cil.c b/test/c/ntdrivers/parport_false.i.cil.c index 2e063859f..619b84168 100644 --- a/test/c/ntdrivers/parport_false.i.cil.c +++ b/test/c/ntdrivers/parport_false.i.cil.c @@ -2523,8 +2523,7 @@ void PptDebugDumpResourceRequirementsList( } else { goto while_12_break; } - {} - { + {} { PptDebugDumpResourceList(curList); curList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + curList->Count); @@ -2933,10 +2932,9 @@ PptRemovePptRemovalRelation(PDEVICE_EXTENSION Extension, } } { - /* ExAcquireFastMutex(& Extension->ExtensionFastMutex); */ /* INLINED - */ - } - { + /* ExAcquireFastMutex(& Extension->ExtensionFastMutex); */ /* INLINED + */ + } { while (1) { while_27_continue: /* CIL Label */; if (!done) { @@ -3820,8 +3818,7 @@ BOOLEAN PptIsNecR98Machine(void) { } return (0); } - {} - { /* ExFreePool(identifierString.Buffer); */ /* INLINED */ + {} { /* ExFreePool(identifierString.Buffer); */ /* INLINED */ } return (0); } @@ -3878,8 +3875,7 @@ NTSTATUS PptDispatchCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) { InterlockedIncrement(&extension->OpenCloseRefCount); /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED */ } - {} - { + {} { PptReleaseRemoveLock(&extension->RemoveLock, Irp); Irp->IoStatus.__annonCompField4.Status = status; myStatus = status; @@ -3926,10 +3922,9 @@ NTSTATUS PptDispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp) { } else { } { - /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED - */ - } - {} + /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED + */ + } {} } else { { /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED @@ -4930,8 +4925,7 @@ NTSTATUS PptDetectPortType(PDEVICE_EXTENSION Extension) { Status = RtlQueryRegistryValues(1, ParportPath.Buffer, RegTable, (void *)0, (void *)0); } - {} - {} + {} {} if (Status >= 0L) { if (IdentifierHex == 0UL) { @@ -4959,8 +4953,7 @@ NTSTATUS PptDetectPortType(PDEVICE_EXTENSION Extension) { } else { Status = 3221225473UL; } - {} - { Status = PptDetectPortCapabilities(Extension); } + {} { Status = PptDetectPortCapabilities(Extension); } {} Status = 0L; {} @@ -4996,8 +4989,7 @@ NTSTATUS PptDetectPortCapabilities(PDEVICE_EXTENSION Extension) { {} Extension->CheckedForGenericEpp = 1; } - {} - { PptDetectBytePort(Extension); } + {} { PptDetectBytePort(Extension); } if (Extension->PnpInfo.HardwareCapabilities & 11UL) { {} return (0L); @@ -5029,8 +5021,7 @@ void PptDetectEcpPort(PDEVICE_EXTENSION Extension) { ecr = READ_PORT_UCHAR(wPortECR); ecrLast = ecr; } - {} - { + {} { dcr = (unsigned char)14; WRITE_PORT_UCHAR(wPortDCR, dcr); ecr = READ_PORT_UCHAR(wPortECR); @@ -5174,8 +5165,7 @@ void PptDetectEppPort(PDEVICE_EXTENSION Extension) { dcr = READ_PORT_UCHAR(Controller + 2); Extension->PnpInfo.HardwareCapabilities |= 2UL; } - {} - { + {} { PptEcrSetMode(Extension, 148); WRITE_PORT_UCHAR(Controller + 2, Reverse); KeStallExecutionProcessor(5); @@ -5999,8 +5989,7 @@ PDEVICE_RELATIONS PptPnpBuildRemovalRelations(PDEVICE_EXTENSION Extension) { } while_185_break: /* CIL Label */; } - {} - { + {} { tmp = ExAllocatePoolWithTag(1, (ULONG)sizeof(DEVICE_RELATIONS) + (count - 1UL) * @@ -6859,9 +6848,7 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, pResourceRequirementsIn = (struct _IO_RESOURCE_REQUIREMENTS_LIST *)Irp->IoStatus.Information; } - {} - {} - { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } + {} {} { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } if (filterResourceMethod == 1) { goto switch_229_1; } else { @@ -6889,8 +6876,9 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, pResourceRequirementsIn); } } - {} - { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } + {} { + PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); + } goto switch_229_break; switch_229_0: /* CIL Label */; {} { @@ -6901,8 +6889,7 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, {} { PptPnpFilterRemoveIrqResourceLists(pResourceRequirementsIn); } - {} - { + {} { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } } else { @@ -7019,9 +7006,7 @@ void PptPnpFilterRemoveIrqResourceLists( } else { goto while_249_break; } - {} - {} - { tmp___0 = PptPnpListContainsIrqResourceDescriptor(curList); } + {} {} { tmp___0 = PptPnpListContainsIrqResourceDescriptor(curList); } if (tmp___0) { {} nextList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + @@ -7096,8 +7081,7 @@ void PptPnpFilterNukeIrqResourceDescriptorsFromAllLists( } else { goto while_257_break; } - {} - { + {} { PptPnpFilterNukeIrqResourceDescriptors(curList); curList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + curList->Count); @@ -8058,9 +8042,9 @@ void PptRegInitDriverSettings(PUNICODE_STRING RegistryPath___0) { PptBreakOn = defaultBreakOn; } else { } - { /* ExFreePool(path); */ /* INLINED */ - } - {} + { + /* ExFreePool(path); */ /* INLINED */ + } {} return; } } @@ -8931,8 +8915,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { status = PptGetPortNumberFromLptName(portName, &portNumber); } + {} { status = PptGetPortNumberFromLptName(portName, &portNumber); } if (!(status >= 0L)) { {} { /* ExFreePool(portName); */ /* INLINED */ } @@ -8947,8 +8930,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { + {} { status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), &uniNameString, 22, 256, 0, &deviceObject); } @@ -8969,8 +8951,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { + {} { status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), &uniNameString, 22, 256, 0, &deviceObject); } diff --git a/test/c/ntdrivers/parport_true.i.cil.c b/test/c/ntdrivers/parport_true.i.cil.c index a393ae368..4ef6ca1f3 100644 --- a/test/c/ntdrivers/parport_true.i.cil.c +++ b/test/c/ntdrivers/parport_true.i.cil.c @@ -2523,8 +2523,7 @@ void PptDebugDumpResourceRequirementsList( } else { goto while_12_break; } - {} - { + {} { PptDebugDumpResourceList(curList); curList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + curList->Count); @@ -2933,10 +2932,9 @@ PptRemovePptRemovalRelation(PDEVICE_EXTENSION Extension, } } { - /* ExAcquireFastMutex(& Extension->ExtensionFastMutex); */ /* INLINED - */ - } - { + /* ExAcquireFastMutex(& Extension->ExtensionFastMutex); */ /* INLINED + */ + } { while (1) { while_27_continue: /* CIL Label */; if (!done) { @@ -3820,8 +3818,7 @@ BOOLEAN PptIsNecR98Machine(void) { } return (0); } - {} - { /* ExFreePool(identifierString.Buffer); */ /* INLINED */ + {} { /* ExFreePool(identifierString.Buffer); */ /* INLINED */ } return (0); } @@ -3878,8 +3875,7 @@ NTSTATUS PptDispatchCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) { InterlockedIncrement(&extension->OpenCloseRefCount); /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED */ } - {} - { + {} { PptReleaseRemoveLock(&extension->RemoveLock, Irp); Irp->IoStatus.__annonCompField4.Status = status; myStatus = status; @@ -3926,10 +3922,9 @@ NTSTATUS PptDispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp) { } else { } { - /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED - */ - } - {} + /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED + */ + } {} } else { { /* ExReleaseFastMutex(& extension->OpenCloseMutex); */ /* INLINED @@ -4930,8 +4925,7 @@ NTSTATUS PptDetectPortType(PDEVICE_EXTENSION Extension) { Status = RtlQueryRegistryValues(1, ParportPath.Buffer, RegTable, (void *)0, (void *)0); } - {} - {} + {} {} if (Status >= 0L) { if (IdentifierHex == 0UL) { @@ -4959,8 +4953,7 @@ NTSTATUS PptDetectPortType(PDEVICE_EXTENSION Extension) { } else { Status = 3221225473UL; } - {} - { Status = PptDetectPortCapabilities(Extension); } + {} { Status = PptDetectPortCapabilities(Extension); } {} Status = 0L; {} @@ -4996,8 +4989,7 @@ NTSTATUS PptDetectPortCapabilities(PDEVICE_EXTENSION Extension) { {} Extension->CheckedForGenericEpp = 1; } - {} - { PptDetectBytePort(Extension); } + {} { PptDetectBytePort(Extension); } if (Extension->PnpInfo.HardwareCapabilities & 11UL) { {} return (0L); @@ -5029,8 +5021,7 @@ void PptDetectEcpPort(PDEVICE_EXTENSION Extension) { ecr = READ_PORT_UCHAR(wPortECR); ecrLast = ecr; } - {} - { + {} { dcr = (unsigned char)14; WRITE_PORT_UCHAR(wPortDCR, dcr); ecr = READ_PORT_UCHAR(wPortECR); @@ -5174,8 +5165,7 @@ void PptDetectEppPort(PDEVICE_EXTENSION Extension) { dcr = READ_PORT_UCHAR(Controller + 2); Extension->PnpInfo.HardwareCapabilities |= 2UL; } - {} - { + {} { PptEcrSetMode(Extension, 148); WRITE_PORT_UCHAR(Controller + 2, Reverse); KeStallExecutionProcessor(5); @@ -5999,8 +5989,7 @@ PDEVICE_RELATIONS PptPnpBuildRemovalRelations(PDEVICE_EXTENSION Extension) { } while_185_break: /* CIL Label */; } - {} - { + {} { tmp = ExAllocatePoolWithTag(1, (ULONG)sizeof(DEVICE_RELATIONS) + (count - 1UL) * @@ -6859,9 +6848,7 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, pResourceRequirementsIn = (struct _IO_RESOURCE_REQUIREMENTS_LIST *)Irp->IoStatus.Information; } - {} - {} - { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } + {} {} { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } if (filterResourceMethod == 1) { goto switch_229_1; } else { @@ -6889,8 +6876,9 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, pResourceRequirementsIn); } } - {} - { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } + {} { + PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); + } goto switch_229_break; switch_229_0: /* CIL Label */; {} { @@ -6901,8 +6889,7 @@ NTSTATUS PptPnpFilterResourceRequirements(PDEVICE_OBJECT DeviceObject, {} { PptPnpFilterRemoveIrqResourceLists(pResourceRequirementsIn); } - {} - { + {} { PptDebugDumpResourceRequirementsList(pResourceRequirementsIn); } } else { @@ -7019,9 +7006,7 @@ void PptPnpFilterRemoveIrqResourceLists( } else { goto while_249_break; } - {} - {} - { tmp___0 = PptPnpListContainsIrqResourceDescriptor(curList); } + {} {} { tmp___0 = PptPnpListContainsIrqResourceDescriptor(curList); } if (tmp___0) { {} nextList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + @@ -7096,8 +7081,7 @@ void PptPnpFilterNukeIrqResourceDescriptorsFromAllLists( } else { goto while_257_break; } - {} - { + {} { PptPnpFilterNukeIrqResourceDescriptors(curList); curList = (struct _IO_RESOURCE_LIST *)(curList->Descriptors + curList->Count); @@ -8058,9 +8042,9 @@ void PptRegInitDriverSettings(PUNICODE_STRING RegistryPath___0) { PptBreakOn = defaultBreakOn; } else { } - { /* ExFreePool(path); */ /* INLINED */ - } - {} + { + /* ExFreePool(path); */ /* INLINED */ + } {} return; } } @@ -8931,8 +8915,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { status = PptGetPortNumberFromLptName(portName, &portNumber); } + {} { status = PptGetPortNumberFromLptName(portName, &portNumber); } if (!(status >= 0L)) { {} { /* ExFreePool(portName); */ /* INLINED */ } @@ -8947,8 +8930,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { + {} { status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), &uniNameString, 22, 256, 0, &deviceObject); } @@ -8969,8 +8951,7 @@ PDEVICE_OBJECT PptBuildDeviceObject(PDRIVER_OBJECT DriverObject, goto targetExit; } else { } - {} - { + {} { status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), &uniNameString, 22, 256, 0, &deviceObject); } diff --git a/tools/externalizer/ExternalizePass.cpp b/tools/externalizer/ExternalizePass.cpp index ac4b16fc6..ad336fd54 100644 --- a/tools/externalizer/ExternalizePass.cpp +++ b/tools/externalizer/ExternalizePass.cpp @@ -34,7 +34,8 @@ Function *externalizeFunction(Function *Fn) { SmallVector Returns; // Copy the body of the original function to the new one - CloneFunctionInto(Copied, Fn, VMap, false, Returns); + CloneFunctionInto(Copied, Fn, VMap, CloneFunctionChangeType::LocalChangesOnly, + Returns); // Copy metadata SmallVector, 1> MDs; diff --git a/tools/externalizer/extern-statics.cpp b/tools/externalizer/extern-statics.cpp index 324858178..225251464 100644 --- a/tools/externalizer/extern-statics.cpp +++ b/tools/externalizer/extern-statics.cpp @@ -7,8 +7,10 @@ #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/ToolOutputFile.h" static llvm::cl::opt @@ -52,7 +54,7 @@ int main(int argc, char **argv) { std::error_code EC; auto out = new llvm::ToolOutputFile(OutputFilename.c_str(), EC, - llvm::sys::fs::F_None); + llvm::sys::fs::OF_None); if (EC) { llvm::errs() << "Could not create output file: " << EC.message() << "\n"; diff --git a/tools/llvm2bpl/llvm2bpl.cpp b/tools/llvm2bpl/llvm2bpl.cpp index 0502cfcde..8854704f0 100644 --- a/tools/llvm2bpl/llvm2bpl.cpp +++ b/tools/llvm2bpl/llvm2bpl.cpp @@ -254,7 +254,7 @@ int main(int argc, char **argv) { if (!FinalIrFilename.empty()) { std::error_code EC; - auto F = new ToolOutputFile(FinalIrFilename.c_str(), EC, sys::fs::F_None); + auto F = new ToolOutputFile(FinalIrFilename.c_str(), EC, sys::fs::OF_None); if (EC) check(EC.message()); F->keep(); @@ -264,7 +264,7 @@ int main(int argc, char **argv) { if (!OutputFilename.empty()) { std::error_code EC; - auto F = new ToolOutputFile(OutputFilename.c_str(), EC, sys::fs::F_None); + auto F = new ToolOutputFile(OutputFilename.c_str(), EC, sys::fs::OF_None); if (EC) check(EC.message()); F->keep();