[PATCH] D23896: [InstCombine] Try to resubmit the combine of A->B->A BitCast and fix for pr27996

Guozhi Wei via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 16:32:26 PDT 2016


Carrot added a comment.

In https://reviews.llvm.org/D23896#540377, @evstupac wrote:

> > Yes, optimizeBitCastFromPhi only generates new BitCast for load/store instructions,
>
>
> In the code I see Constants as well.


I expect the BitCasted Constant will be returned by instruction builder directly.


================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1860
@@ +1859,3 @@
+        Builder->SetInsertPoint(OldPN->getIncomingBlock(j)->getTerminator());
+        NewV = Builder->CreateBitCast(LI, DestTy);
+        Worklist.Add(LI);
----------------
evstupac wrote:
> New BitCast instruction is created if one of OldPN operands is Load, right?
> 
> L = Load
> X = Phi [L, ...]
> 
> To:
> 
> L = Load
> NewL = BitCast (L)
> NewX = Phi [NewL, ...]
> 
> The new BitCast instruction user is PHI, not Load or Store.
> Will it pass your fix point?
> 
This function is called on the following pattern

p = Phi [...]
b =BitCast(p)

The BitCast of Load is not a candidate of this optimization.


https://reviews.llvm.org/D23896





More information about the llvm-commits mailing list