[PATCH] D30322: [SCCP] Resolve indirect branch target when possible.
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 20:24:46 PST 2017
davide added inline comments.
================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1531-1548
+ if (auto *IBR = dyn_cast<IndirectBrInst>(TI)) {
+ if (!getValueState(IBR->getAddress()).isUnknown())
+ continue;
+
+ // If the input to SCCP is actually branch on undef, fix the undef to
+ // the first successor of the indirect branch.
+ if (isa<UndefValue>(IBR->getAddress())) {
----------------
I'm very wary of adding more code here, as it caused a fair amount of pain in the past. This, tho, seems to be in line with what was already there.
================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1895-1896
assert(isa<UndefValue>(SI->getCondition()) && "Switch should fold");
+ } else if (auto *IBR = dyn_cast<IndirectBrInst>(I)) {
+ assert(isa<UndefValue>(IBR->getAddress()) && "IndirectBr should fold");
} else {
----------------
Can this assertion ever fire?
https://reviews.llvm.org/D30322
More information about the llvm-commits
mailing list