[PATCH] D63812: [InstCombine] Shift amount reassociation (PR42391)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 12:18:16 PDT 2019
lebedev.ri added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:51
+ // All good, we can do this fold.
+ return BinaryOperator::Create(ShiftOpcode, X, NewShAmt);
+}
----------------
nikic wrote:
> Would it be possible to preserve nowrap/exact flags that exist on both shifts?
* `exact` on both `lshr` => `exact` https://rise4fun.com/Alive/plHk
* `exact` on both `ashr` => `exact` https://rise4fun.com/Alive/QDAA
* `nuw` on both `shl` => `nuw` https://rise4fun.com/Alive/5Uk
* `nsw` on both `shl` => `nsw` https://rise4fun.com/Alive/0plg
So basically if the same flag is set on both original shifts -> set it on new shift.
Don't think we can do anything with non-matching flags on `shl`.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63812/new/
https://reviews.llvm.org/D63812
More information about the llvm-commits
mailing list