File tree 4 files changed +287
-7
lines changed 4 files changed +287
-7
lines changed Original file line number Diff line number Diff line change @@ -975,15 +975,15 @@ class AdjointGenerator
975
975
BasicBlock *oBB = phi.getParent ();
976
976
BasicBlock *nBB = gutils->getNewFromOriginal (oBB);
977
977
978
- IRBuilder<> diffeBuilder(nBB->getFirstNonPHI());
979
- diffeBuilder.setFastMathFlags(getFast());
980
-
981
978
IRBuilder<> phiBuilder (&phi);
982
979
getForwardBuilder (phiBuilder);
980
+ phiBuilder.SetInsertPoint (
981
+ gutils->getNewFromOriginal (&phi)->getNextNode ());
983
982
984
983
Type *diffeType = gutils->getShadowType (phi.getType ());
985
984
986
985
auto newPhi = phiBuilder.CreatePHI (diffeType, 1 , phi.getName () + " '" );
986
+
987
987
for (unsigned int i = 0 ; i < phi.getNumIncomingValues (); ++i) {
988
988
auto val = phi.getIncomingValue (i);
989
989
auto block = phi.getIncomingBlock (i);
@@ -1000,7 +1000,10 @@ class AdjointGenerator
1000
1000
}
1001
1001
}
1002
1002
1003
+ IRBuilder<> diffeBuilder (nBB->getFirstNonPHI ());
1004
+ diffeBuilder.setFastMathFlags (getFast ());
1003
1005
setDiffe (&phi, newPhi, diffeBuilder);
1006
+
1004
1007
return ;
1005
1008
}
1006
1009
}
Original file line number Diff line number Diff line change @@ -1315,6 +1315,7 @@ void TypeAnalyzer::visitStoreInst(StoreInst &I) {
1315
1315
template <typename T>
1316
1316
std::set<std::vector<T>> getSet (const std::vector<std::set<T>> &todo,
1317
1317
size_t idx) {
1318
+ assert (idx < todo.size ());
1318
1319
std::set<std::vector<T>> out;
1319
1320
if (idx == 0 ) {
1320
1321
for (auto val : todo[0 ]) {
@@ -1406,6 +1407,7 @@ void TypeAnalyzer::visitGetElementPtrInst(GetElementPtrInst &gep) {
1406
1407
if (idnext.back ().size () == 0 )
1407
1408
return ;
1408
1409
}
1410
+ assert (idnext.size () != 0 );
1409
1411
1410
1412
TypeTree upTree;
1411
1413
TypeTree downTree;
You can’t perform that action at this time.
0 commit comments