Ignore:
Timestamp:
Dec 9, 2017, 5:05:16 PM (18 months ago)
Author:
nmedfort
Message:

Minor changes and hopefully a fix for bug exposed by base64 test

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.cpp

    r5761 r5771  
    9393    DataLayout DL(b->getModule());
    9494    IntegerType * const intPtrTy = cast<IntegerType>(DL.getIntPtrType(Ptr->getType()));
    95     Value * sz = ConstantExpr::getTrunc(ConstantExpr::getSizeOf(Base->getAllocatedType()), intPtrTy);
     95    Value * sz = ConstantExpr::getBitCast(ConstantExpr::getSizeOf(Base->getAllocatedType()), intPtrTy);
    9696    if (dyn_cast_or_null<Constant>(Base->getArraySize()) && !cast<Constant>(Base->getArraySize())->isNullValue()) {
    9797        sz = b->CreateMul(sz, b->CreateZExtOrTrunc(Base->getArraySize(), intPtrTy));
     
    966966#endif
    967967
    968 void CBuilder::__CreateAssert(Value * const assertion, const Twine failureMessage) {
     968void CBuilder::__CreateAssert(Value * const assertion, const Twine & failureMessage) {
    969969    if (LLVM_UNLIKELY(isa<Constant>(assertion))) {
    970970        if (LLVM_UNLIKELY(cast<Constant>(assertion)->isNullValue())) {
     
    10821082        IRBuilder<>::CreateCall(function, {assertion, GetString(failureMessage.toStringRef(tmp)), trace, depth});
    10831083    } else { // if assertions are not enabled, make it a compiler assumption.
    1084         IRBuilder<>::CreateAssumption(assertion);
     1084
     1085        // INVESTIGATE: while interesting, this does not seem to produce faster code and only provides a trivial reduction
     1086        // of compiled code size in LLVM 3.8 but nearly doubles compilation time. This may have been improved with later
     1087        // versions of LLVM but it's likely that assumptions ought to be hand placed once they're prove to improve performance.
     1088
     1089        // IRBuilder<>::CreateAssumption(assertion);
    10851090    }
    10861091}
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5761 r5771  
    236236    virtual llvm::StoreInst *  CreateAtomicStoreRelease(llvm::Value * val, llvm::Value * ptr);
    237237
    238     void CreateAssert(llvm::Value * assertion, const llvm::Twine failureMessage) {
     238    void CreateAssert(llvm::Value * assertion, const llvm::Twine & failureMessage) {
    239239        if (LLVM_UNLIKELY(assertion->getType()->isVectorTy())) {
    240240            assertion = CreateBitCast(assertion, getIntNTy(assertion->getType()->getPrimitiveSizeInBits()));
     
    243243    }
    244244
    245     void CreateAssertZero(llvm::Value * assertion, const llvm::Twine failureMessage) {
     245    void CreateAssertZero(llvm::Value * assertion, const llvm::Twine & failureMessage) {
    246246        if (LLVM_UNLIKELY(assertion->getType()->isVectorTy())) {
    247247            assertion = CreateBitCast(assertion, getIntNTy(assertion->getType()->getPrimitiveSizeInBits()));
     
    355355    bool hasAddressSanitizer() const;
    356356
    357     void __CreateAssert(llvm::Value * assertion, const llvm::Twine failureMessage);
     357    void __CreateAssert(llvm::Value * assertion, const llvm::Twine & failureMessage);
    358358
    359359    llvm::Function * LinkFunction(llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const;
Note: See TracChangeset for help on using the changeset viewer.