[PATCH] D30280: [InstCombine] don't try SimplifyDemandedInstructionBits from zext/sext because it's slow and unnecessary
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 16:17:39 PST 2017
spatel created this revision.
Herald added a subscriber: mcrosier.
Since https://reviews.llvm.org/D30270 was approved, let's try again. :)
This one seems more obvious to me that it can't make improvements because an extension always needs all of the incoming bits. There's one specific transform of converting a sext to a zext when the sign-bit is known zero in SimplifyDemandedInstructionBits, but that is handled explicitly in visitSext() with ComputeSignBit() (just below that deleted hunk).
Again, there are no IR differences (other than instruction names) for the case in PR32037:
https://bugs.llvm.org//show_bug.cgi?id=32037
...and no regression test differences.
Zext/sext are a smaller part of the profile, but this still appears to shave off another 0.5% or so from 'opt -O2'. I didn't try very hard to accurately measure the difference because I think this is a pure win amputation of redundant calls to SimplifyDemandedInstructionBits.
https://reviews.llvm.org/D30280
Files:
lib/Transforms/InstCombine/InstCombineCasts.cpp
Index: lib/Transforms/InstCombine/InstCombineCasts.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -838,11 +838,6 @@
if (Instruction *Result = commonCastTransforms(CI))
return Result;
- // See if we can simplify any instructions used by the input whose sole
- // purpose is to compute bits we don't care about.
- if (SimplifyDemandedInstructionBits(CI))
- return &CI;
-
Value *Src = CI.getOperand(0);
Type *SrcTy = Src->getType(), *DestTy = CI.getType();
@@ -1124,11 +1119,6 @@
if (Instruction *I = commonCastTransforms(CI))
return I;
- // See if we can simplify any instructions used by the input whose sole
- // purpose is to compute bits we don't care about.
- if (SimplifyDemandedInstructionBits(CI))
- return &CI;
-
Value *Src = CI.getOperand(0);
Type *SrcTy = Src->getType(), *DestTy = CI.getType();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30280.89437.patch
Type: text/x-patch
Size: 985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170223/24995982/attachment.bin>
More information about the llvm-commits
mailing list