[PATCH] D27853: [CodeGenPrep]Restructure promoting Ext to form ExtLoad
Chad Rosier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 12:07:28 PST 2017
mcrosier added a comment.
I'm still trying to understand the interaction between this patch and https://reviews.llvm.org/D28680. In the mean time I do have one quick comment about an existing bug.
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4305
TotalCreatedInstsCost -= ExtCost;
+ if (TotalCreatedInstsCost < 0)
+ TotalCreatedInstsCost = 0;
You might also write this as
TotalCreatedInstsCost = std::max(0, TotalCreatedInstsCost - ExtCost);
Can you please add a comment as to why we ensure TotalCreatedInstsCost is non-negative? I believe it's because we're passing a signed value to tryToPromoteExts(), which expects an unsigned argument.
Lastly, is this something that could be fixed independently of this patch? And do you have a test case that covers this change?
More information about the llvm-commits