[PATCH] D12866: [InstCombine] fold zexts and constants into a phi (PR24766)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 07:57:01 PDT 2015


spatel added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:399
@@ +398,3 @@
+      else if (Cast->getSrcTy() != FirstCast->getSrcTy() ||
+               Cast->getOpcode() != FirstCast->getOpcode() ||
+               !Cast->hasOneUse())
----------------
sanjoy wrote:
> When will `Cast->getOpcode() != FirstCast->getOpcode()`?  Doesn't `Cast->getOpcode()` always have to be `Instruction::ZExt`?
Hi Sanjoy - thanks for looking at this!
Yes, this check is unnecessary. This and the code structure (and the variable names and comments) are more general than they need to be because I started off hoping to handle any cast type. Let me make everything zext-specific for this patch, and then we can generalize it later if needed.


http://reviews.llvm.org/D12866





More information about the llvm-commits mailing list