[PATCH] D29037: Constant fold switch inst when looking for trivial conditions to unswitch on.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 12:30:55 PST 2017
efriedma added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:922
+ const DataLayout &DL = I->getModule()->getDataLayout();
+ if (Constant *Fold = ConstantFoldInstruction(I, DL))
+ Cond = Fold;
----------------
Is this likely to actually do anything in practice...? Most passes (including LoopUnswitch itself) will constant-fold newly generated code.
================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:928
+ // At this point, the switched value is a constant.
+ assert(isa<Constant>(Cond) && "Switched value must be a constant");
+ bool FoundDest = false;
----------------
Checking for a Constant isn't good enough here: you need a ConstantInt.
https://reviews.llvm.org/D29037
More information about the llvm-commits
mailing list