Details
Diff Detail
Event Timeline
lib/Transforms/Utils/Evaluator.cpp | ||
---|---|---|
243 | Seems it better looks like: Constant *Evaluator::substCallExprArgument(Value *CallExpr, Constant *RV) { ConstantExpr *CE = dyn_cast<ConstantExpr>(CallExpr); if (!CE || CE->getOpcode() != Instruction::BitCast) return RV; if (auto *FT = dyn_cast<FunctionType>(CE->getType()->getPointerElementType())) return ConstantFoldLoadThroughBitcast(RV, FT->getReturnType(), DL); return RV; } |
Sorry I missed this one.
lib/Transforms/Utils/Evaluator.cpp | ||
---|---|---|
232 | The name/description seem a little confusing to me. IIUC there isn't any substitution into the function call expression being done here, it is essentially casting the evaluated return value to the call's bitcast type, right? | |
508 | Is this case being tested by the new test case? | |
test/Transforms/GlobalOpt/evaluate-call.ll | ||
2 | Needs comment about what is being tested |
Thanks for looking at it @tejohnson. Sorry I was too busy to respond earlier.
I've added extra test case to check function calls which can be constant folded.
The substCallExprArgument was changed to castCallResultIfNeeded which might sound more reasonable.
Document your new functions.