Skip to content

Commit fbcbcd4

Browse files
matborzyszkowskiigcbot
authored andcommitted
Move the bitcast instruction to the correct BB for DP emu
This change insert `i64 -> double` `BitCast` instruction to the appropriate BB. Before this change, some `BitCast` instructions can be inserted into incorrect BB, e.g. PHINode: ``` for.cond: %0 = call i64 @llvm.genx.GenISA.WaveShuffleIndex.i64(i64 %x, i32 %y, i32 0) br label %BB_01 ... BB_01: %1 = bitcast i64 %0 to double %2 = phi double [ %a, %if.then ], [ %b, %if.then1 ], [ %c, %if.then2 ], [ %1, %for.cond ] ``` With this change, we'll get: ``` for.cond: %0 = call i64 @llvm.genx.GenISA.WaveShuffleIndex.i64(i64 %x, i32 %y, i32 0) %1 = bitcast i64 %0 to double br label %BB_01 ... BB_01: %2 = phi double [ %a, %if.then ], [ %b, %if.then1 ], [ %c, %if.then2 ], [ %1, %for.cond ] ```
1 parent 8fb2cb3 commit fbcbcd4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ void PreCompiledFuncImport::handleInstrTypeChange(Instruction* oldInst, Value* n
223223
// in preProcessDouble() function. All extra bitcast instruction are deleted by InstructionCombining pass.
224224
else
225225
{
226+
builder.SetInsertPoint(oldInst);
226227
if (newVal->getType()->isIntegerTy(64))
227228
{
228229
Value* newBitCast = builder.CreateBitCast(newVal, builder.getDoubleTy());

0 commit comments

Comments
 (0)