[PATCH] D31782: [CodeGenPrepare]Skip sext promotion if operands for multiple users is detected
Evgeny Astigeevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 04:20:14 PDT 2017
eastig added inline comments.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4572-4573
// Get the action to perform the promotion.
- TypePromotionHelper::Action TPH =
- TypePromotionHelper::getAction(I, InsertedInsts, *TLI, PromotedInsts);
+ TypePromotionHelper::Action TPH = TypePromotionHelper::getAction(
+ I, InsertedInsts, *TLI, PromotedInsts, hasMultiUserOperand);
// Check if we can promote.
----------------
junbuml wrote:
> eastig wrote:
> > Do you assume that the Exts vector always has only one instruction? Otherwise the value of hasMultiUserOperand can be changed from true to false.
> I do not assume only one instruction in Exts. After hasMultiUserOperand is initialized as false in optimizeExt(), hasMultiUserOperand can turn into true only when encountering any operand used by multiple users. I cannot see the case where hasMultiUserOperand turn from true to false ? Please let me know if you see such case.
Yes, you are right. It can be changed only from false to true and never back.
================
Comment at: test/CodeGen/AArch64/arm64-addr-type-promotion.ll:99-100
+ %add = add nsw i32 %j, 1
+ %sext1 = sext i32 %add to i64
+ %arrayidx = getelementptr inbounds %struct.GlobalData, %struct.GlobalData* @global_data, i64 0, i32 0, i64 %sext1
+ store float %s, float* %arrayidx, align 4
----------------
junbuml wrote:
> eastig wrote:
> > Does this guarantee lowering to multi usage? Is it possible to write a test in MIR?
> In this test, I intended to make %add have two users: 1) in %sext1 and 2) in %j.l. In such case, we do not allow moving %sext up through %add.
I see. Thank you for explanation.
https://reviews.llvm.org/D31782
More information about the llvm-commits
mailing list