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

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 16:10:29 PDT 2017


dberlin 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
----------------
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).



================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1011
+        TranslatableLoadedPhiPtr
+            ? TranslatableLoadedPhiPtr->DoPHITranslation(LoadBB, PredBB)
+            : LI->getPointerOperand();
----------------
And here, translateableloadedphiptr will already be LI->getOperand(0) (which is the pointer operand)
or LI->getPointerOperand (if the translation fails)



https://reviews.llvm.org/D30543





More information about the llvm-commits mailing list