[PATCH] D30543: [JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 16:23:52 PDT 2017


trentxintong added inline comments.


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:940
+
+  if (Instruction *PtrOp = dyn_cast<Instruction>(LoadedPtr)) {
+    // If the loaded operand is a phi not inside LoadBB, we can not
----------------
dberlin wrote:
> This logic looks overly complex.
> 
> Isn't this all simply 
> ```
> TranslateableLoaddedPhiPtr = LoadedPtr->doPhiTranslation(LoadBB, PredBB) 
> ```
> 
> here, and then
> 
> 
> ```
> if (TranslateableLoadedPhiPtr == LoadedPtr)
>     if (Instruction *PtrOp = dyn_cast<Instruction>(LoadedPtr))
>     return false
> 
> ```
> (IE what it was before).
> 
Do not we need the PredBB then ? we are not iterating over the predecessors here. Otherwise, I think doPhiTranslation would be a perfect fit for this.


https://reviews.llvm.org/D30543





More information about the llvm-commits mailing list