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

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

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.