File tree 1 file changed +8
-10
lines changed 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,14 @@ bool llvm::canTrackGlobalVariableInterprocedurally(GlobalVariable *GV) {
28
28
if (GV->isConstant () || !GV->hasLocalLinkage () ||
29
29
!GV->hasDefinitiveInitializer ())
30
30
return false ;
31
- return !any_of (GV->users (), [&](User *U) {
32
- if (auto *Store = dyn_cast<StoreInst>(U)) {
33
- if (Store->getValueOperand () == GV || Store->isVolatile ())
34
- return true ;
35
- } else if (auto *Load = dyn_cast<LoadInst>(U)) {
36
- if (Load->isVolatile ())
37
- return true ;
38
- } else {
39
- return true ;
40
- }
31
+ return all_of (GV->users (), [&](User *U) {
32
+ // Currently all users of a global variable have to be none-volatile loads
33
+ // or stores and the global cannot be stored itself.
34
+ if (auto *Store = dyn_cast<StoreInst>(U))
35
+ return Store->getValueOperand () != GV && !Store->isVolatile ();
36
+ if (auto *Load = dyn_cast<LoadInst>(U))
37
+ return !Load->isVolatile ();
38
+
41
39
return false ;
42
40
});
43
41
}
You can’t perform that action at this time.
0 commit comments