Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Utils/Evaluator.cpp | ||
---|---|---|
243 ↗ | (On Diff #145704) | 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; } |
Comment Actions
Sorry I missed this one.
lib/Transforms/Utils/Evaluator.cpp | ||
---|---|---|
232 ↗ | (On Diff #148813) | 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? |
506 ↗ | (On Diff #148813) | Is this case being tested by the new test case? |
test/Transforms/GlobalOpt/evaluate-call.ll | ||
1 ↗ | (On Diff #148813) | Needs comment about what is being tested |
Comment Actions
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.