@@ -60,30 +60,30 @@ void IRTranslator::getAnalysisUsage(AnalysisUsage &AU) const {
60
60
61
61
unsigned IRTranslator::getOrCreateVReg (const Value &Val) {
62
62
unsigned &ValReg = ValToVReg[&Val];
63
- // Check if this is the first time we see Val.
64
- if (! ValReg) {
65
- // Fill ValRegsSequence with the sequence of registers
66
- // we need to concat together to produce the value.
67
- assert (Val. getType ()-> isSized () &&
68
- " Don't know how to create an empty vreg " );
69
- unsigned VReg = MRI-> createGenericVirtualRegister (LLT{* Val.getType (), *DL});
70
- ValReg = VReg ;
71
-
72
- if ( auto CV = dyn_cast<Constant>(&Val)) {
73
- bool Success = translate (*CV, VReg);
74
- if (!Success ) {
75
- if (!TPC-> isGlobalISelAbortEnabled ()) {
76
- MF-> getProperties (). set (
77
- MachineFunctionProperties::Property::FailedISel);
78
- return VReg;
79
- }
80
- reportTranslationError (Val, " unable to translate constant " ) ;
63
+
64
+ if (ValReg)
65
+ return ValReg;
66
+
67
+ // Fill ValRegsSequence with the sequence of registers
68
+ // we need to concat together to produce the value.
69
+ assert ( Val.getType ()-> isSized () &&
70
+ " Don't know how to create an empty vreg " ) ;
71
+ unsigned VReg = MRI-> createGenericVirtualRegister (LLT{*Val. getType (), *DL});
72
+ ValReg = VReg;
73
+
74
+ if ( auto CV = dyn_cast<Constant>(&Val) ) {
75
+ bool Success = translate (*CV, VReg);
76
+ if (!Success) {
77
+ if (!TPC-> isGlobalISelAbortEnabled ()) {
78
+ MF-> getProperties (). set (
79
+ MachineFunctionProperties::Property::FailedISel);
80
+ return VReg ;
81
81
}
82
+ reportTranslationError (Val, " unable to translate constant" );
82
83
}
83
84
}
84
85
85
- // Look Val up again in case the reference has been invalidated since.
86
- return ValToVReg[&Val];
86
+ return VReg;
87
87
}
88
88
89
89
int IRTranslator::getOrCreateFrameIndex (const AllocaInst &AI) {
0 commit comments