[PATCH] D55563: [BDCE][DemandedBits] Detect dead uses of undead instructions

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 16:03:23 PST 2018


hfinkel added inline comments.


================
Comment at: lib/Analysis/DemandedBits.cpp:440
+bool DemandedBits::isUseDead(Use *U) {
+  assert((*U)->getType()->isIntOrIntVectorTy() &&
+         "Expected integer or vector of integer use");
----------------
Please remove this assert. For consistency with the other interfaces, we should just have the function return false in this case.


================
Comment at: lib/Analysis/DemandedBits.cpp:455
+  if (UserI->getType()->isIntOrIntVectorTy()) {
+    auto Found = AliveBits.find(UserI);
+    if (Found->second.isNullValue())
----------------
We know that this will never return AliveBits.end()? A comment or assert should explain this.


================
Comment at: lib/Transforms/Scalar/BDCE.cpp:113
+
+      // TODO We could also find dead non-instruction uses, e.g. arguments.
+      if (!isa<Instruction>(U))
----------------
TODO: (add colon)


================
Comment at: lib/Transforms/Scalar/BDCE.cpp:130
       Changed = true;
     }
   }
----------------
With this new logic, where do we now remove instructions for which all uses have been trivialized?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55563





More information about the llvm-commits mailing list