[PATCH] D51028: [BranchFolder] Drop kill/dead flags if they aren't present in all merged instructions

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 14:45:59 PST 2020


bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/BranchFolding.cpp:861
+        // in $r0 that actually reaches <instr1> will indeed be killed there.
+        if (!OtherMO.isKill() && !OtherMO.isUndef())
+          MO.setIsKill(false);
----------------
Afaict this isn't consistent with the mirrored situation (if MO says "undef" and OtherMO says "killed") the result will be that "undef" is dropped, but not an addition of "killed". 
I think the result should be the same regardless of which bb that use as a base for the merge. Shouldn't it?

Btw, is there a problem with simply clearing the killed flag unless it is set in both operands?
(I'm not sure if an undef implies killed today. Or if it that might change in the future when the freeze stuff has been implemented. In your example above instr2 is a def, but I assume it could be a use as well, that could be undef, or maybe even a use of the same undef value as used in instr1.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51028/new/

https://reviews.llvm.org/D51028





More information about the llvm-commits mailing list