[PATCH] D49512: [CodeGenPrepare] Add BothExtension type to PromotedInsts

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 16:04:03 PDT 2018


Carrot added a comment.

In https://reviews.llvm.org/D49512#1190373, @qcolombet wrote:

> To be more precise, the latest promotion should be correct, but if we want the full information of multiple extension, the current patch is I believe wrong.
>  E.g., zext (sext i8 to i16) to i32, doesn't give you the same warranties on the bit pattern than what zext i8 to i32 gives, whereas we won't be able to see that.


To be even more precise, the latest committed promotions should be correct, reverted promotions are not correct.

This patch does not use the full information of multiple extensions, it just marked the fact, and later query the instruction through getOrigType, BothExtension can't match any actual extension type, so nullptr is returned.

So this is a quick but conservative patch.



================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3600
-  PromotedInsts.insert(std::pair<Instruction *, TypeIsSExt>(
-      ExtOpnd, TypeIsSExt(ExtOpnd->getType(), IsSExt)));
   // Step #1.
----------------
qcolombet wrote:
> Instead of insert, we should do update the value all the time.
Function addPromotedInst exactly does this.


https://reviews.llvm.org/D49512





More information about the llvm-commits mailing list